1. 4FipS.com
  2. Photos
  3. Videos
  4. Code
  5. Forums
  6. pfQuizzz
  7. About
/*---{fips-meta:file-header:public}-------------------------------------*\
| o     _______ __         _______  _   ______           __            o |
|      |    ___|__|.-----.|     __|| | |      |.-----.--|  |.-----.      |
|      |    ___|  ||  _  ||__     ||_| |   ---||  _  |  _  ||  -__|      |
|      |___|   |__||   __||_______|    |______||_____|_____||_____|      |
|       FipS' CODE |__| > > > > > > > > > > > > > > > > > > > > > >      |
|    (c) 2004-13 +++ Filip Stoklas, aka FipS, http://www.4FipS.com +++   |
| o         THIS CODE IS FREE - LICENSED UNDER THE MIT LICENSE         o |
\*----------------------------------------------------------------------*/
#ifndef FS_HEADER__sources__fs_2_bundle__bu_directory_ref_h__GUARD
#define FS_HEADER__sources__fs_2_bundle__bu_directory_ref_h__GUARD

#include "bu_directory_blob.h"

namespace fs { namespace bundle {

/// A lightweight directory reference type, which maps a directory BLOB.
class Directory_ref
{
 public:

    typedef fo::Table_index_pod<size_t, Directory_ref> Index;

    Directory_ref(fo::Bytes_ref dir_blob);

    size_t num_files() const;
    fo::String_ref file(Index index) const;
    bool has_file(fo::String_ref fname) const;
    Index find_file(fo::String_ref fname) const;

 private:

    // external references to 'dir_blob'
    const blob::directory::Filelist *_filelist;
    const blob::directory::Filenames *_filenames;
};

}} // namespace fs::bundle

#endif // FS_HEADER__sources__fs_2_bundle__bu_directory_ref_h__GUARD