00001 #ifndef DIRCOLL_H
00002 #define DIRCOLL_H
00003
00004 #include "zipios++/zipios-config.h"
00005
00006
00007 #include "zipios++/fcoll.h"
00008 #include "zipios++/basicentry.h"
00009 #include "zipios++/filepath.h"
00010
00011 namespace zipios {
00012
00014 typedef BasicEntry DirEntry ;
00015
00019 class DirectoryCollection : public FileCollection {
00020 public:
00021
00023 explicit DirectoryCollection()
00024 : _entries_loaded( false ), _recursive( true ) {}
00025
00026
00033 explicit DirectoryCollection( const string &path,
00034 bool recursive = true,
00035 bool load_now = false ) ;
00036
00037
00038
00039 virtual void close() ;
00040
00041 virtual ConstEntries entries() const ;
00042
00043 virtual ConstEntryPointer getEntry( const string &name,
00044 MatchPath matchpath = MATCH ) const ;
00045
00046 virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
00047
00048 virtual istream *getInputStream( const string &entry_name,
00049 MatchPath matchpath = MATCH ) ;
00050
00051 virtual int size() const ;
00052
00053 virtual FileCollection *clone() const ;
00054
00056 virtual ~DirectoryCollection() ;
00057
00058 protected:
00059 mutable bool _entries_loaded ;
00060 bool _recursive ;
00061 FilePath _filepath ;
00062
00063 void loadEntries() const ;
00064 void load( bool recursive, const FilePath &subdir = FilePath() ) ;
00065
00066 };
00067
00068 }
00069
00070 #endif
00071
00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093