2 #include "zipios++/zipios-config.h" 6 #include "zipios++/meta-iostreams.h" 26 : _filename ( filename ),
28 _basepath ( basepath )
30 string full_path = _basepath + _filename ;
31 ifstream is( full_path.c_str(), ios::in | ios::binary ) ;
35 is.seekg( 0, ios::end ) ;
55 return vector< unsigned char > () ;
69 string::size_type pos ;
70 pos = _filename.find_last_of( separator ) ;
71 if ( pos != string::npos ) {
73 return _filename.substr(pos + 1) ;
93 assert( _filename.size() != 0 ) ;
94 return _filename[ _filename.size() - 1 ] == separator ;
128 sout << _filename <<
" (" << _size <<
" bytes)" ;
136 BasicEntry::~BasicEntry() {
virtual StorageMethod getMethod() const
Returns the method used to store the entry in the FileCollection.
virtual string getFileName() const
Returns the filename of the entry.
virtual string toString() const
Returns a human-readable string representation of the entry.
virtual uint32 getCompressedSize() const
Returns the compressed size of the entry.
virtual void setSize(uint32 size)
Sets the size field for the entry.
virtual FileEntry * clone() const
Create a heap allocated clone of the object this method is called for.
virtual void setTime(int time)
Sets the time field for the entry.
virtual vector< unsigned char > getExtra() const
Returns a vector of bytes of extra data that may be stored with the entry.
Header file that defines some simple data types.
virtual void setMethod(StorageMethod method)
Sets the storage method field for the entry.
virtual void setCompressedSize(uint32 size)
Set the compressed size field of the entry.
virtual bool isValid() const
Any method or operator that initializes a FileEntry may set a flag, that specifies whether the read e...
OutputStringStream is typedefed to ostringstream if sstream is part of the standard library (unless Z...
Header file that defines OutputStringStream.
virtual int getTime() const
Returns the date and time of FIXME: what?
virtual bool isDirectory() const
Returns true if the entry is a directory.
Header file that defines BasicEntry.
virtual void setCrc(uint32 crc)
Sets the crc field.
virtual string getName() const
Returns the full filename of the entry, including a path if the entry is stored in a subfolder...
virtual string getComment() const
Returns the comment of the entry, if it has one.
virtual void setComment(const string &comment)
Sets the comment field for the FileEntry.
string str()
Specialization of ostrstream::str() that takes care of null-terminating the string and unfreezing the...
BasicEntry(const string &filename, const string &comment, const FilePath &basepath=FilePath())
Constructor.
A FileEntry represents an entry in a FileCollection.
virtual void setName(const string &name)
Sets the name field for the entry.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
virtual uint32 getCrc() const
Returns the Crc for the entry, if it has one.
virtual void setExtra(const vector< unsigned char > &extra)
Sets the extra field.
FilePath represents a path to a file or directory name.
virtual uint32 getSize() const
Returns the (uncompressed) size of the entry data.
Header file containing miscellaneous small functions.