Zipios++
basicentry.h
Go to the documentation of this file.
1 #ifndef BASICENTRY_H
2 #define BASICENTRY_H
3 
4 #include "zipios++/zipios-config.h"
5 
6 #include "zipios++/meta-iostreams.h"
7 #include <string>
8 
10 #include "zipios++/fileentry.h"
11 #include "zipios++/filepath.h"
12 #include "zipios++/zipios_defs.h"
13 
14 namespace zipios {
15 
18 class BasicEntry : public FileEntry {
19 public:
24  explicit BasicEntry( const string &filename, const string &comment,
25  const FilePath &basepath = FilePath() ) ;
26  virtual string getComment() const ;
27  virtual uint32 getCompressedSize() const ;
28  virtual uint32 getCrc() const ;
29  virtual vector< unsigned char > getExtra() const ;
30  virtual StorageMethod getMethod() const ;
31  virtual string getName() const ;
32  virtual string getFileName() const ;
33  virtual uint32 getSize() const ;
34  virtual int getTime() const ;
35  virtual bool isValid() const ;
36 
37  // virtual int hashCode() const ;
38  virtual bool isDirectory() const ;
39 
40  virtual void setComment( const string &comment ) ;
41  virtual void setCompressedSize( uint32 size ) ;
42  virtual void setCrc( uint32 crc ) ;
43  virtual void setExtra( const vector< unsigned char > &extra ) ;
44  virtual void setMethod( StorageMethod method ) ;
45  virtual void setName( const string &name ) ;
46  virtual void setSize( uint32 size ) ;
47  virtual void setTime( int time ) ;
48 
49  virtual string toString() const ;
50 
51  virtual FileEntry *clone() const ;
52 
53  virtual ~BasicEntry() ;
54 protected:
55  string _filename ;
56  string _comment ;
57  int _size ;
58  bool _valid ;
59  FilePath _basepath ;
60 
61 };
62 
63 }
64 #endif
65 
70 /*
71  Zipios++ - a small C++ library that provides easy access to .zip files.
72  Copyright (C) 2000 Thomas Søndergaard
73 
74  This library is free software; you can redistribute it and/or
75  modify it under the terms of the GNU Lesser General Public
76  License as published by the Free Software Foundation; either
77  version 2 of the License, or (at your option) any later version.
78 
79  This library is distributed in the hope that it will be useful,
80  but WITHOUT ANY WARRANTY; without even the implied warranty of
81  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
82  Lesser General Public License for more details.
83 
84  You should have received a copy of the GNU Lesser General Public
85  License along with this library; if not, write to the Free Software
86  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
87 */
virtual StorageMethod getMethod() const
Returns the method used to store the entry in the FileCollection.
Definition: basicentry.cpp:58
virtual string getFileName() const
Returns the filename of the entry.
Definition: basicentry.cpp:66
virtual string toString() const
Returns a human-readable string representation of the entry.
Definition: basicentry.cpp:126
virtual uint32 getCompressedSize() const
Returns the compressed size of the entry.
Definition: basicentry.cpp:46
virtual void setSize(uint32 size)
Sets the size field for the entry.
Definition: basicentry.cpp:118
virtual FileEntry * clone() const
Create a heap allocated clone of the object this method is called for.
Definition: basicentry.cpp:132
virtual void setTime(int time)
Sets the time field for the entry.
Definition: basicentry.cpp:122
virtual vector< unsigned char > getExtra() const
Returns a vector of bytes of extra data that may be stored with the entry.
Definition: basicentry.cpp:54
Header file that defines some simple data types.
Header file that defines FileEntry.
virtual void setMethod(StorageMethod method)
Sets the storage method field for the entry.
Definition: basicentry.cpp:111
virtual void setCompressedSize(uint32 size)
Set the compressed size field of the entry.
Definition: basicentry.cpp:102
virtual bool isValid() const
Any method or operator that initializes a FileEntry may set a flag, that specifies whether the read e...
Definition: basicentry.cpp:87
virtual int getTime() const
Returns the date and time of FIXME: what?
Definition: basicentry.cpp:83
BasicEntry is a FileEntry that is suitable as a base class for basic entries, that e...
Definition: basicentry.h:18
virtual bool isDirectory() const
Returns true if the entry is a directory.
Definition: basicentry.cpp:92
virtual void setCrc(uint32 crc)
Sets the crc field.
Definition: basicentry.cpp:105
virtual string getName() const
Returns the full filename of the entry, including a path if the entry is stored in a subfolder...
Definition: basicentry.cpp:62
virtual string getComment() const
Returns the comment of the entry, if it has one.
Definition: basicentry.cpp:42
virtual void setComment(const string &comment)
Sets the comment field for the FileEntry.
Definition: basicentry.cpp:98
BasicEntry(const string &filename, const string &comment, const FilePath &basepath=FilePath())
Constructor.
Definition: basicentry.cpp:24
A FileEntry represents an entry in a FileCollection.
Definition: fileentry.h:52
Header file that defines a number of exceptions used by FileCollection and its subclasses.
virtual void setName(const string &name)
Sets the name field for the entry.
Definition: basicentry.cpp:114
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
Definition: fileentry.h:25
virtual uint32 getCrc() const
Returns the Crc for the entry, if it has one.
Definition: basicentry.cpp:50
virtual void setExtra(const vector< unsigned char > &extra)
Sets the extra field.
Definition: basicentry.cpp:108
FilePath represents a path to a file or directory name.
Definition: filepath.h:18
Header file that defines FilePath.
virtual uint32 getSize() const
Returns the (uncompressed) size of the entry data.
Definition: basicentry.cpp:79