2 #ifndef ZIPIOS_FILEENTRY_HPP 3 #define ZIPIOS_FILEENTRY_HPP 87 static CompressionLevel
const COMPRESSION_LEVEL_DEFAULT = -3;
88 static CompressionLevel
const COMPRESSION_LEVEL_SMALLEST = -2;
89 static CompressionLevel
const COMPRESSION_LEVEL_FASTEST = -1;
90 static CompressionLevel
const COMPRESSION_LEVEL_NONE = 0;
91 static CompressionLevel
const COMPRESSION_LEVEL_MINIMUM = 1;
92 static CompressionLevel
const COMPRESSION_LEVEL_MAXIMUM = 100;
94 FileEntry(
FilePath const & filename, std::string
const & comment = std::string());
95 virtual pointer_t clone()
const = 0;
98 virtual std::string getComment()
const;
99 virtual size_t getCompressedSize()
const;
100 virtual crc32_t getCrc()
const;
101 std::streampos getEntryOffset()
const;
102 virtual buffer_t getExtra()
const;
103 virtual size_t getHeaderSize()
const;
104 virtual CompressionLevel getLevel()
const;
106 virtual std::string getName()
const;
107 virtual std::string getFileName()
const;
108 virtual size_t getSize()
const;
111 virtual std::time_t getUnixTime()
const;
113 virtual bool isDirectory()
const;
114 virtual bool isEqual(
FileEntry const& file_entry)
const;
115 virtual bool isValid()
const;
116 virtual void setComment(std::string
const& comment);
117 virtual void setCompressedSize(
size_t size);
118 virtual void setCrc(crc32_t crc);
119 void setEntryOffset(std::streampos offset);
120 virtual void setExtra(buffer_t
const& extra);
121 virtual void setLevel(CompressionLevel level);
123 virtual void setSize(
size_t size);
125 virtual void setUnixTime(std::time_t time);
126 virtual std::string toString()
const;
128 virtual void read(std::istream& is);
129 virtual void write(std::ostream& os);
134 size_t m_uncompressed_size = 0;
135 time_t m_unix_time = 0;
136 std::streampos m_entry_offset = 0;
138 CompressionLevel m_compression_level = COMPRESSION_LEVEL_DEFAULT;
139 uint32_t m_crc_32 = 0;
141 bool m_has_crc_32 =
false;
142 bool m_valid =
false;
Define a type to manage date and time in MS-DOS format.
std::ostream & operator<<(std::ostream &os, FileCollection const &collection)
Write a FileCollection to the output stream.
The zipios namespace includes the Zipios library definitions.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
int CompressionLevel
The compression level to be used to save an entry.
A FileEntry represents an entry in a FileCollection.
Define the zipios::FilePath class.
Handle a file path and name and its statistics.
std::vector< unsigned char > buffer_t
std::shared_ptr< FileEntry > pointer_t
std::vector< pointer_t > vector_t