2#ifndef ZIPIOS_FILEENTRY_HPP
3#define ZIPIOS_FILEENTRY_HPP
94 FileEntry(
FilePath const & filename, std::string
const & comment = std::string());
106 virtual std::string
getName()
const;
108 virtual std::size_t
getSize()
const;
116 virtual void setComment(std::string
const & comment);
123 virtual void setSize(
size_t size);
126 virtual std::string
toString()
const;
128 virtual void read(std::istream & is);
129 virtual void write(std::ostream & os);
A FileEntry represents an entry in a FileCollection.
std::vector< unsigned char > buffer_t
std::size_t m_uncompressed_size
std::shared_ptr< FileEntry > pointer_t
StorageMethod m_compress_method
virtual std::string getFileName() const
Return the basename of this entry.
virtual std::size_t getSize() const
Retrieve the size of the file when uncompressed.
int CompressionLevel
The compression level to be used to save an entry.
static CompressionLevel const COMPRESSION_LEVEL_MINIMUM
virtual void setComment(std::string const &comment)
Set the comment field for the FileEntry.
virtual std::size_t getCompressedSize() const
Retrieve the size of the file when compressed.
static CompressionLevel const COMPRESSION_LEVEL_MAXIMUM
virtual std::string getComment() const
Retrieve the comment of the file entry.
bool hasCrc() const
Check whether the CRC32 was defined.
virtual void setTime(DOSDateTime::dosdatetime_t time)
Set the FileEntry time using a DOS time.
virtual std::string getName() const
Return the filename of the entry.
virtual bool isValid() const
Check whether this entry is valid.
virtual void setSize(size_t size)
Sets the size field for the entry.
virtual void setUnixTime(std::time_t time)
Sets the time field in Unix time format for the entry.
virtual void setExtra(buffer_t const &extra)
Set the extra field buffer.
virtual void read(std::istream &is)
Read this FileEntry from the input stream.
virtual void setLevel(CompressionLevel level)
Define the level of compression to use by this FileEntry.
static CompressionLevel const COMPRESSION_LEVEL_DEFAULT
virtual bool isDirectory() const
Check whether the filename represents a directory.
CompressionLevel m_compression_level
std::streampos m_entry_offset
static CompressionLevel const COMPRESSION_LEVEL_NONE
virtual pointer_t clone() const =0
Create a clone of a file entry.
virtual void setCrc(crc32_t crc)
Save the CRC of the entry.
virtual StorageMethod getMethod() const
Return the method used to create this entry.
static CompressionLevel const COMPRESSION_LEVEL_FASTEST
virtual CompressionLevel getLevel() const
Retrieve the compression level.
virtual std::string toString() const
Returns a human-readable string representation of the entry.
virtual crc32_t getCrc() const
Return the CRC of the entry.
virtual void setCompressedSize(size_t size)
Set the size when the file is compressed.
virtual buffer_t getExtra() const
Some extra data to be stored along the entry.
virtual DOSDateTime::dosdatetime_t getTime() const
Get the MS-DOS date/time of this entry.
std::streampos getEntryOffset() const
Get the offset of this entry in a Zip archive.
std::vector< pointer_t > vector_t
virtual std::time_t getUnixTime() const
Get the Unix date/time of this entry.
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
virtual void write(std::ostream &os)
Write this FileEntry to the output stream.
virtual void setMethod(StorageMethod method)
Sets the storage method field for the entry.
virtual std::size_t getHeaderSize() const
Retrieve the size of the header.
virtual ~FileEntry()
Clean up a FileEntry object.
void setEntryOffset(std::streampos offset)
Defines the position of the entry in a Zip archive.
static CompressionLevel const COMPRESSION_LEVEL_SMALLEST
Handle a file path and name and its statistics.
Define a type to manage date and time in MS-DOS format.
Define the zipios::FilePath class.
The zipios namespace includes the Zipios library definitions.
std::ostream & operator<<(std::ostream &os, FileCollection const &collection)
Write a FileCollection to the output stream.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.