fcoll.h
Go to the documentation of this file.00001 #ifndef fcoll_H
00002 #define fcoll_H
00003
00004 #include "zipios-config.h"
00005
00006 #include <vector>
00007 #include <string>
00008
00009 #include "fcollexceptions.h"
00010 #include "fileentry.h"
00011
00012 namespace zipios {
00013
00014 using std::vector;
00015
00021 class BaseExport FileCollection {
00022 public:
00024 explicit FileCollection()
00025 : _filename( "-" ),
00026 _entries ( 0 ),
00027 _valid ( false ) {}
00028
00030 FileCollection( const FileCollection &src ) ;
00031
00033 const FileCollection &operator= ( const FileCollection &src ) ;
00034
00036 virtual void close() = 0 ;
00037
00038 enum MatchPath {
00039 IGN,
00040 MATCH
00041 } ;
00048 virtual ConstEntries entries() const ;
00049
00050
00061 virtual ConstEntryPointer getEntry( const string &name,
00062 MatchPath matchpath = MATCH ) const ;
00072 virtual istream *getInputStream( const ConstEntryPointer &entry ) = 0 ;
00073
00086 virtual istream *getInputStream( const string &entry_name,
00087 MatchPath matchpath = MATCH ) = 0 ;
00091 virtual string getName() const ;
00095 virtual int size() const ;
00096
00100 bool isValid() const { return _valid ; }
00101
00106 virtual FileCollection *clone() const = 0 ;
00107
00108
00110 virtual ~FileCollection () ;
00111 protected:
00112 string _filename ;
00113 Entries _entries ;
00114 bool _valid ;
00115 };
00116
00117
00118
00119
00120
00121
00122 inline ostream & operator<< (ostream &os, const FileCollection& collection) {
00123 os << "collection '" << collection.getName() << "' {" ;
00124 ConstEntries entries = collection.entries();
00125 ConstEntries::const_iterator it;
00126 bool isFirst=true;
00127 for (it=entries.begin(); it != entries.end(); ++it) {
00128 if(! isFirst)
00129 os << ", ";
00130 isFirst = false;
00131 os << (*it)->getName();
00132 }
00133 os << "}";
00134 return os;
00135 }
00136
00137 }
00138
00139 #endif
00140
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162