4 #include "zipios++/zipios-config.h"
8 #include "zipios++/meta-iostreams.h"
25 enum StorageMethod { STORED = 0, SHRUNK, REDUCED1, REDUCED2,
26 REDUCED3, REDUCED4, IMPLODED, RESERVED,
33 typedef SimpleSmartPointer< FileEntry > EntryPointer ;
37 typedef SimpleSmartPointer< const FileEntry > ConstEntryPointer ;
40 typedef vector< EntryPointer > Entries ;
43 typedef vector< EntryPointer > ConstEntries ;
74 virtual uint32
getCrc()
const = 0 ;
80 virtual vector< unsigned char >
getExtra()
const = 0 ;
85 virtual StorageMethod
getMethod()
const = 0 ;
91 virtual string getName()
const = 0 ;
99 virtual uint32
getSize()
const = 0 ;
103 virtual int getTime()
const = 0 ;
109 virtual bool isValid()
const = 0 ;
121 virtual void setComment(
const string &comment ) = 0 ;
129 virtual void setCrc( uint32 crc ) = 0 ;
133 virtual void setExtra(
const vector< unsigned char > &extra ) = 0 ;
137 virtual void setMethod( StorageMethod method ) = 0 ;
141 virtual void setName(
const string &name ) = 0 ;
145 virtual void setSize( uint32 size ) = 0 ;
149 virtual void setTime(
int time ) = 0 ;
154 virtual string toString()
const = 0 ;
167 class MatchFileName ;
171 void ref()
const { _refcount.ref() ; }
172 unsigned int unref()
const {
return _refcount.unref() ; }
174 ReferenceCount< FileEntry > _refcount ;
183 explicit MatchName(
const string &name ) : _name( name ) {}
185 return entry->getName() == _name ;
197 explicit MatchFileName(
const string &name ) : _name( name ) {}
199 return entry->getFileName() == _name ;
205 ostream &operator<< ( ostream &os,
const FileEntry &entry ) ;
virtual void setCompressedSize(uint32 size)=0
Set the compressed size field of the entry.
virtual uint32 getCrc() const =0
Returns the Crc for the entry, if it has one.
Header file that defines some simple data types.
SimpleSmartPointer is a simple reference counting smart pointer template.
virtual int getTime() const =0
Returns the date and time of FIXME: what?
virtual void setCrc(uint32 crc)=0
Sets the crc field.
Header file that defines SimpleSmartPointer and ReferenceCount.
virtual FileEntry * clone() const =0
Create a heap allocated clone of the object this method is called for.
Function object to be used with the STL find_if algorithm to find a FileEntry in a container...
virtual bool isValid() const =0
Any method or operator that initializes a FileEntry may set a flag, that specifies whether the read e...
virtual string getComment() const =0
Returns the comment of the entry, if it has one.
virtual void setTime(int time)=0
Sets the time field for the entry.
virtual string toString() const =0
Returns a human-readable string representation of the entry.
virtual void setExtra(const vector< unsigned char > &extra)=0
Sets the extra field.
virtual void setName(const string &name)=0
Sets the name field for the entry.
virtual ~FileEntry()
FileEntry destructor.
virtual string getName() const =0
Returns the full filename of the entry, including a path if the entry is stored in a subfolder...
virtual void setComment(const string &comment)=0
Sets the comment field for the FileEntry.
virtual vector< unsigned char > getExtra() const =0
Returns a vector of bytes of extra data that may be stored with the entry.
Function object to be used with the STL find_if algorithm to find a FileEntry in a container...
virtual void setSize(uint32 size)=0
Sets the size field for the entry.
A FileEntry represents an entry in a FileCollection.
virtual void setMethod(StorageMethod method)=0
Sets the storage method field for the entry.
virtual string getFileName() const =0
Returns the filename of the entry.
virtual bool isDirectory() const =0
Returns true if the entry is a directory.
virtual StorageMethod getMethod() const =0
Returns the method used to store the entry in the FileCollection.
virtual uint32 getCompressedSize() const =0
Returns the compressed size of the entry.
virtual uint32 getSize() const =0
Returns the (uncompressed) size of the entry data.