zipios++  2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
zipios::ZipCentralDirectoryEntry Class Reference

A specialization of ZipLocalEntry for. More...

#include <zipcentraldirectoryentry.hpp>

Inheritance diagram for zipios::ZipCentralDirectoryEntry:
Inheritance graph
[legend]
Collaboration diagram for zipios::ZipCentralDirectoryEntry:
Collaboration graph
[legend]

Public Types

typedef std::vector< unsigned
char > 
buffer_t
 
typedef int CompressionLevel
 The compression level to be used to save an entry. More...
 
typedef uint32_t crc32_t
 
typedef uint32_t dostime_t
 
typedef std::shared_ptr
< FileEntry
pointer_t
 
typedef std::vector< pointer_tvector_t
 

Public Member Functions

 ZipCentralDirectoryEntry ()
 Initializes a default ZipCentralDirectoryEntry object. More...
 
 ZipCentralDirectoryEntry (FileEntry const &entry)
 Initialize a ZipCentralDirectoryEntry. More...
 
virtual ~ZipCentralDirectoryEntry () override
 Clean up the entry. More...
 
virtual pointer_t clone () const override
 Create a clone of this Central Directory entry. More...
 
virtual std::string getComment () const
 Retrieve the comment of the file entry. More...
 
virtual size_t getCompressedSize () const override
 Retrive the size of the file when compressed. More...
 
virtual crc32_t getCrc () const
 Return the CRC of the entry. More...
 
std::streampos getEntryOffset () const
 Get the offset of this entry in a Zip archive. More...
 
virtual buffer_t getExtra () const
 Some extra data to be stored along the entry. More...
 
virtual std::string getFileName () const
 Return the basename of this entry. More...
 
virtual size_t getHeaderSize () const override
 Compute and return the current header size. More...
 
virtual CompressionLevel getLevel () const
 Retrieve the compression level. More...
 
virtual StorageMethod getMethod () const
 Return the method used to create this entry. More...
 
virtual std::string getName () const
 Return the filename of the entry. More...
 
virtual size_t getSize () const
 Retrieve the size of the file when uncompressed. More...
 
virtual dostime_t getTime () const
 Get the MS-DOS date/time of this entry. More...
 
virtual std::time_t getUnixTime () const
 Get the Unix date/time of this entry. More...
 
bool hasCrc () const
 Check whether the CRC32 was defined. More...
 
bool hasTrailingDataDescriptor () const
 Is there a trailing data descriptor? More...
 
virtual bool isDirectory () const override
 Check whether the filename represents a directory. More...
 
virtual bool isEqual (FileEntry const &file_entry) const override
 Compare two file entries for equality. More...
 
virtual bool isValid () const
 Check whether this entry is valid. More...
 
virtual void read (std::istream &is) override
 Read a Central Directory entry. More...
 
virtual void setComment (std::string const &comment)
 Set the comment field for the FileEntry. More...
 
virtual void setCompressedSize (size_t size) override
 Set the size when the file is compressed. More...
 
virtual void setCrc (crc32_t crc) override
 Save the CRC of the entry. More...
 
void setEntryOffset (std::streampos offset)
 Defines the position of the entry in a Zip archive. More...
 
virtual void setExtra (buffer_t const &extra)
 Set the extra field buffer. More...
 
virtual void setLevel (CompressionLevel level)
 Define the level of compression to use by this FileEntry. More...
 
virtual void setMethod (StorageMethod method)
 Sets the storage method field for the entry. More...
 
virtual void setSize (size_t size)
 Sets the size field for the entry. More...
 
virtual void setTime (dostime_t time)
 Set the FileEntry time using a DOS time. More...
 
virtual void setUnixTime (std::time_t time)
 Sets the time field in Unix time format for the entry. More...
 
virtual std::string toString () const
 Returns a human-readable string representation of the entry. More...
 
virtual void write (std::ostream &os) override
 Write a Central Directory Entry to the output stream. More...
 

Static Public Attributes

static CompressionLevel const COMPRESSION_LEVEL_DEFAULT = -3
 
static CompressionLevel const COMPRESSION_LEVEL_FASTEST = -1
 
static CompressionLevel const COMPRESSION_LEVEL_MAXIMUM = 100
 
static CompressionLevel const COMPRESSION_LEVEL_MINIMUM = 1
 
static CompressionLevel const COMPRESSION_LEVEL_NONE = 0
 
static CompressionLevel const COMPRESSION_LEVEL_SMALLEST = -2
 
static uint16_t const g_zip_format_version = 20
 

Protected Attributes

std::string m_comment
 
StorageMethod m_compress_method = StorageMethod::STORED
 
size_t m_compressed_size = 0
 
CompressionLevel m_compression_level = COMPRESSION_LEVEL_DEFAULT
 
uint32_t m_crc_32 = 0
 
std::streampos m_entry_offset = 0
 
buffer_t m_extra_field
 
uint16_t m_extract_version = g_zip_format_version
 
FilePath m_filename
 
uint16_t m_general_purpose_bitfield = 0
 
bool m_has_crc_32 = false
 
bool m_is_directory = false
 
size_t m_uncompressed_size = 0
 
time_t m_unix_time = 0
 
bool m_valid = false
 

Detailed Description

Specialization of ZipLocalEntry, that add fields for storing the extra information, that is only present in the entries in the zip central directory and not in the local entry headers.

Definition at line 43 of file zipcentraldirectoryentry.hpp.

Member Typedef Documentation

typedef std::vector<unsigned char> zipios::FileEntry::buffer_t
inherited

Definition at line 79 of file fileentry.hpp.

Values defined using this time represent the compression level to be used when compressing an entry.

If unchanged, use the DEFAULT_COMPRESSION value.

It is possible to change the compression level to NO_COMPRESSION or use the setMethod() with STORED to avoid any compression (i.e. create a zip file which awfully looks like a tarball).

Todo:
These values are one to one mapped to zlib compression values. This is likely to change once we start offering other compression scheme for a number defined between 0 and 100 instead.

Definition at line 85 of file fileentry.hpp.

typedef uint32_t zipios::FileEntry::crc32_t
inherited

Definition at line 80 of file fileentry.hpp.

typedef uint32_t zipios::FileEntry::dostime_t
inherited

Definition at line 81 of file fileentry.hpp.

typedef std::shared_ptr<FileEntry> zipios::FileEntry::pointer_t
inherited

Definition at line 77 of file fileentry.hpp.

typedef std::vector<pointer_t> zipios::FileEntry::vector_t
inherited

Definition at line 78 of file fileentry.hpp.

Constructor & Destructor Documentation

zipios::ZipCentralDirectoryEntry::ZipCentralDirectoryEntry ( )

This function initializes a ZipCentralDirectoryEntry object that is expected to be used to read data from an input stream representing a Zip archive.

Definition at line 144 of file zipcentraldirectoryentry.cpp.

Referenced by clone().

zipios::ZipCentralDirectoryEntry::ZipCentralDirectoryEntry ( FileEntry const &  entry)

This function initializes a ZipCentralDirectoryEntry from a FileEntry.

The funtion copies all the data it may be interested in and then ignores the FileEntry.

Parameters
[in]entryThe entry to transform in a ZipCentralDirectoryEntry.

Definition at line 159 of file zipcentraldirectoryentry.cpp.

zipios::ZipCentralDirectoryEntry::~ZipCentralDirectoryEntry ( )
overridevirtual

The destructor makes sure the entry is fully cleaned up.

Definition at line 169 of file zipcentraldirectoryentry.cpp.

Member Function Documentation

FileEntry::pointer_t zipios::ZipCentralDirectoryEntry::clone ( ) const
overridevirtual

This function allocates a new copy of this ZipCentralDirectoryEntry object and returns a smart pointer to it.

Returns
A smart pointer to the copy.

Reimplemented from zipios::ZipLocalEntry.

Definition at line 205 of file zipcentraldirectoryentry.cpp.

References ZipCentralDirectoryEntry().

std::string zipios::FileEntry::getComment ( ) const
virtualinherited

This function returns the comment of this entry.

If the entry was not assigned a comment, this function returns an empty string. All entries can be given a comment, although for most it will be ignored unless you save the file to a Zip archive.

Returns
The comment associated with this entry, if there is one.

Definition at line 150 of file fileentry.cpp.

References zipios::FileEntry::m_comment.

size_t zipios::ZipLocalEntry::getCompressedSize ( ) const
overridevirtualinherited

This function returns the compressed size of the entry. If the entry is not stored in a compressed format, the uncompressed size is returned.

Returns
The compressed size of the entry.

Reimplemented from zipios::FileEntry.

Definition at line 231 of file ziplocalentry.cpp.

References zipios::ZipLocalEntry::m_compressed_size.

FileEntry::crc32_t zipios::FileEntry::getCrc ( ) const
virtualinherited

This function returns the CRC 32 of this entry, if it has one.

The CRC is set only after the file is compressed so it may not always be available. The hasCrc() function can be used to know whether it was set before.

Returns
The CRC32 for the entry, if it has one.
Todo:
Should we throw if m_has_crc_32 is false?

Definition at line 182 of file fileentry.cpp.

References zipios::FileEntry::m_crc_32.

std::streampos zipios::FileEntry::getEntryOffset ( ) const
inherited

This function retrieves the offset at which this FileEntry resides in the Zip archive it is attached to.

Note that in case of a Zip archive embedded in another file, the offset is virtual (relative to the start of the Zip archive in the larger file.)

Returns
The position in the Zip archive.

Definition at line 202 of file fileentry.cpp.

References zipios::FileEntry::m_entry_offset.

FileEntry::buffer_t zipios::FileEntry::getExtra ( ) const
virtualinherited

This function returns a copy of the vector of bytes of extra data that are stored with the entry.

This buffer should be generated using the still non-existant ZipExtra class. This includes definitions of additional meta data necessary on various operating systems. For example, Linux makes use of the "UT" (Universal Time) to save the atime, ctime, and mtime parameters, and "ux" (Unix) to save the Unix permissions and user identifier (uid) and group identifier (gid).

Returns
A buffer_t of extra bytes that are associated with this entry.

Definition at line 222 of file fileentry.cpp.

References zipios::FileEntry::m_extra_field.

std::string zipios::FileEntry::getFileName ( ) const
virtualinherited

This function returns the filename only of the entry.

Warning
The function returns the last segment of the filename whether it is a regular file or a directory so one can search for a directory with the MATCH or IGNORE search options.
Returns
The filename of the entry.

Definition at line 320 of file fileentry.cpp.

References zipios::FilePath::filename(), and zipios::FileEntry::m_filename.

size_t zipios::ZipCentralDirectoryEntry::getHeaderSize ( ) const
overridevirtual

This function computes the size that this entry will take in the Central Directory of the Zip archive.

Returns
The total size of the Central Directory entry on disk.
Todo:
Add support for 64 bit Zip. At this time this function returns an invalid size if the filename, extra field, or file comment sizes are more than allowed in an older version of the Zip format.

Reimplemented from zipios::ZipLocalEntry.

Definition at line 181 of file zipcentraldirectoryentry.cpp.

References zipios::FilePath::length(), zipios::FileEntry::m_comment, zipios::FileEntry::m_extra_field, zipios::FileEntry::m_filename, and zipios::ZipLocalEntry::m_is_directory.

FileEntry::CompressionLevel zipios::FileEntry::getLevel ( ) const
virtualinherited

Use this function to read the compression level to use to compress a file.

Note that the compression level is rarely saved in the destination file, so after reading a file from a Zip archive this parameter is set to the default compression level which does not represent the level used to create the file.

The compression level is a number between 1 and 100 if compression is wanted. 0 for no compression. A few negative numbers represent various default compression levels.

Returns
The compression level to use to write this entry to a Zip archive.
See Also
CompressionLevel
setLevel()

Definition at line 262 of file fileentry.cpp.

References zipios::FileEntry::COMPRESSION_LEVEL_NONE, zipios::FileEntry::isDirectory(), and zipios::FileEntry::m_compression_level.

StorageMethod zipios::FileEntry::getMethod ( ) const
virtualinherited

This function returns the method used to store the entry data in the FileCollection it is attached to.

Returns
the storage method used to store the entry in a collection.
See Also
StorageMethod
setMethod()

Definition at line 282 of file fileentry.cpp.

References zipios::FileEntry::isDirectory(), zipios::FileEntry::m_compress_method, and zipios::STORED.

Referenced by zipios::ZipInputStreambuf::underflow(), and zipios::ZipInputStreambuf::ZipInputStreambuf().

std::string zipios::FileEntry::getName ( ) const
virtualinherited

The function returns the full filename of the entry, including a path if the entry is stored in a sub-folder.

Returns
The filename of the entry including its path.

Definition at line 303 of file fileentry.cpp.

References zipios::FileEntry::m_filename.

size_t zipios::FileEntry::getSize ( ) const
virtualinherited

This function returns the uncompressed size of the entry data.

Returns
Returns the uncompressed size of the entry.

Definition at line 332 of file fileentry.cpp.

References zipios::FileEntry::m_uncompressed_size.

Referenced by zipios::FileEntry::getCompressedSize(), and zipios::ZipInputStreambuf::ZipInputStreambuf().

FileEntry::dostime_t zipios::FileEntry::getTime ( ) const
virtualinherited

This function returns the date and time of the entry in MSDOS date/time format.

Note
An MS-DOS date is limited to 127 years starting on 1980. So it will be over after Dec 31, 2107.
Returns
The date and time of the entry in MS-DOS format.

Definition at line 349 of file fileentry.cpp.

References zipios::FileEntry::m_unix_time, and unix2dostime().

std::time_t zipios::FileEntry::getUnixTime ( ) const
virtualinherited

This function returns the date and time of the entry in Unix date/time format (see time()).

Note
The FileEntry object saves the time as a Unix time_t value, however, the Zip file format uses the DOS time format. So for a Zip file, the precision of the date is to the next even second. Yet, this function may return a value which is odd when the time comes from a file on disk.
Unless you have an old 32 bit system that defines time_t as a 32 bit value, a Unix date can be considered infinite. Otherwise it is limited to some time in 2068.
Returns
The date and time of the entry as a time_t value.

Definition at line 374 of file fileentry.cpp.

References zipios::FileEntry::m_unix_time.

bool zipios::FileEntry::hasCrc ( ) const
inherited

This function returns true if the setCrc() function was called earlier with a valid CRC32 and the FileEntry implementation supports a CRC (i.e. a DirectoryEntry does not have a CRC).

Returns
true if a CRC32 is defined in this class.

Definition at line 388 of file fileentry.cpp.

References zipios::FileEntry::m_has_crc_32.

bool zipios::ZipLocalEntry::hasTrailingDataDescriptor ( ) const
inherited

This function checks the bit in the General Purpose Flags to know whether the local entry header includes the compressed and uncompressed sizes or whether these are defined after the compressed data.

The trailing data buffer looks like this:

signature (PK 8.7) -- OPTIONAL -- 32 bit
CRC 32 -- 32 bit
compressed size -- 32 or 64 bit
uncompressed size -- 32 or 64 bit

When a trailing data buffer is defined, the header has the compressed and uncompressed sizes set to zero.

Note
Zipios++ does not support such a scheme.
Returns
true if this file makes use of a trailing data buffer.

Definition at line 312 of file ziplocalentry.cpp.

References zipios::anonymous_namespace{ziplocalentry.cpp}::g_trailing_data_descriptor, and zipios::ZipLocalEntry::m_general_purpose_bitfield.

Referenced by zipios::ZipInputStreambuf::ZipInputStreambuf().

bool zipios::ZipLocalEntry::isDirectory ( ) const
overridevirtualinherited

This function checks the last character of the filename, if it is a separator ('/') then the function returns true meaning that the file represents a directory.

Returns
true if the entry represents a directory.

Reimplemented from zipios::FileEntry.

Definition at line 185 of file ziplocalentry.cpp.

References zipios::ZipLocalEntry::m_is_directory.

bool zipios::ZipLocalEntry::isEqual ( FileEntry const &  file_entry) const
overridevirtualinherited

This function compares most of the fields between two file entries to see whether they are equal or not.

Note
This function calls the base class isEqual() and also verifies that the ZipLocalEntry fields are equal.
This function is also used to compare ZipCDirEntry since none of the additional field participate in the comparison.
Parameters
[in]file_entryThe file entry to compare this against.
Returns
true if both FileEntry objects are considered equal.

Reimplemented from zipios::FileEntry.

Definition at line 208 of file ziplocalentry.cpp.

References zipios::FileEntry::isEqual(), zipios::ZipLocalEntry::m_extract_version, zipios::ZipLocalEntry::m_general_purpose_bitfield, and zipios::ZipLocalEntry::m_is_directory.

Referenced by zipios::ZipFile::ZipFile().

bool zipios::FileEntry::isValid ( ) const
virtualinherited

Any method or operator that initializes a FileEntry may set a flag that specifies whether the file entry is valid or not. If it is not this method returns false.

Returns
true if the FileEntry has been parsed succesfully.

Definition at line 447 of file fileentry.cpp.

References zipios::FileEntry::m_valid.

Referenced by zipios::ZipInputStreambuf::ZipInputStreambuf().

void zipios::ZipCentralDirectoryEntry::read ( std::istream &  is)
overridevirtual

This function reads one Central Directory entry from the specified input stream. If anything goes wrong with the input stream, the read function will throw an error.

Note
While reading the entry is marked as invalid. If the read fails, the entry will remain invalid. On success, the function restores the status back to valid.
If the signature or some other parameter is found to be invalid, then the input stream is marked as failed and an exception is thrown.
Exceptions
IOExceptionThis exception is thrown if the signature read does not match the signature of a Central Directory entry. This can only mean a bug in a Zip writer or an invalid/corrupt file altogether.
Parameters
[in]isThe input stream to read from.
See Also
write()
Todo:
check whether this was a 64 bit header and make sure to read the 64 bit header too if so

Reimplemented from zipios::ZipLocalEntry.

Definition at line 235 of file zipcentraldirectoryentry.cpp.

References dos2unixtime(), dostime(), zipios::g_separator, zipios::anonymous_namespace{zipcentraldirectoryentry.cpp}::g_signature, zipios::FileEntry::m_comment, zipios::FileEntry::m_compress_method, zipios::ZipLocalEntry::m_compressed_size, zipios::FileEntry::m_crc_32, zipios::FileEntry::m_entry_offset, zipios::FileEntry::m_extra_field, zipios::ZipLocalEntry::m_extract_version, zipios::FileEntry::m_filename, zipios::ZipLocalEntry::m_general_purpose_bitfield, zipios::ZipLocalEntry::m_is_directory, zipios::FileEntry::m_uncompressed_size, zipios::FileEntry::m_unix_time, zipios::FileEntry::m_valid, and zipios::zipRead().

void zipios::FileEntry::setComment ( std::string const &  comment)
virtualinherited

This function sets the comment of this FileEntry. Note that all implementations of the FileEntry may not include support for a comment. In that case this function does nothing.

Parameters
[in]commentA string with the new comment.

Definition at line 461 of file fileentry.cpp.

References zipios::FileEntry::m_comment.

void zipios::ZipLocalEntry::setCompressedSize ( size_t  size)
overridevirtualinherited

This function saves the compressed size of the entry in this object.

By default the compressed size is viewed as the same as the uncompressed size (i.e. as if STORED was used for the compression method.)

Parameters
[in]sizeValue to set the compressed size field of the entry to.

Reimplemented from zipios::FileEntry.

Definition at line 267 of file ziplocalentry.cpp.

References zipios::ZipLocalEntry::m_compressed_size.

void zipios::ZipLocalEntry::setCrc ( crc32_t  crc)
overridevirtualinherited

This funciton savees the CRC field in this FileEntry field.

This function has the side of setting the m_has_crc_32 flag to true meaning that the CRC was defined as expected.

Parameters
[in]crcValue to set the CRC field to.

Reimplemented from zipios::FileEntry.

Definition at line 282 of file ziplocalentry.cpp.

References zipios::FileEntry::m_crc_32, and zipios::FileEntry::m_has_crc_32.

void zipios::FileEntry::setEntryOffset ( std::streampos  offset)
inherited

This function defines the position of the FileEntry in a Zip archive. By default the position is set to zero.

The offset is generally read from a Zip directory entry.

When used to seek in a file, the FileCollection will add the start offset defined in the VirtualSeeker. In other words this is the position in the Zip archive itself, not the final position in the file you are reading the archive from.

Parameters
[in]offsetThe new archive entry offset.

Definition at line 512 of file fileentry.cpp.

References zipios::FileEntry::m_entry_offset.

void zipios::FileEntry::setExtra ( buffer_t const &  extra)
virtualinherited

This function is used to set the extra field.

Only one type of file entry supports an extra field buffer. The others do nothing when this function is called.

Parameters
[in]extraThe extra field is set to this value.

Definition at line 527 of file fileentry.cpp.

References zipios::FileEntry::m_extra_field.

void zipios::FileEntry::setLevel ( CompressionLevel  level)
virtualinherited

This function saves the level of compression the library should use to compress the file before saving it in the output file.

Note
If the StorageMethod is set to STORED, then the compression level is ignored, but it is left unchanged.
Exceptions
InvalidStateExceptionThis function raises this exception if the specified level is out of the allowed range.
Parameters
[in]levelThe compression level to use to compress the file data.

Definition at line 548 of file fileentry.cpp.

References zipios::FileEntry::COMPRESSION_LEVEL_MAXIMUM, zipios::FileEntry::COMPRESSION_LEVEL_MINIMUM, zipios::FileEntry::COMPRESSION_LEVEL_NONE, zipios::FileEntry::isDirectory(), and zipios::FileEntry::m_compression_level.

void zipios::FileEntry::setMethod ( StorageMethod  method)
virtualinherited

This function sets the method with which the file data is to be compressed.

The method is ignored in a file entry which cannot be compressed. (or more precisly, the method is forced as STORED.)

Exceptions
InvalidStateExceptionThis exception is raised if the method parameter does not represent a supported method. At this time the library only supports STORED and DEFLATED. The getMethod() may return more types as read from a Zip archive, but it is not possible to set such types using this function.
Parameters
[in]methodThe method field is set to the specified value.

Definition at line 585 of file fileentry.cpp.

References zipios::DEFLATED, zipios::FileEntry::isDirectory(), zipios::FileEntry::m_compress_method, and zipios::STORED.

void zipios::FileEntry::setSize ( size_t  size)
virtualinherited

This function is used to save the size of this file on disk when uncompressed.

Parameters
[in]sizeThe size field is set to this value.

Definition at line 637 of file fileentry.cpp.

References zipios::FileEntry::m_uncompressed_size.

void zipios::FileEntry::setTime ( dostime_t  dostime)
virtualinherited

This function saves the specified dostime value as the last modification date and time of this entry. This is generally used when reading that information from a Zip archive. Otherwise you probably want to use the setUnixTime() instead since it is one to one compatible with the value handle by time(), stat(), and other OS functions.

Parameters
[in]dostimeSet time field as is using this MSDOS date/time value.

Definition at line 653 of file fileentry.cpp.

References dos2unixtime(), and zipios::FileEntry::setUnixTime().

void zipios::FileEntry::setUnixTime ( std::time_t  time)
virtualinherited

This function is used to set the last modification time of this entry. In most cases this comes from the stat structure field named st_mtime. If you are creating a file directly in memory, you may use the return value of time(nullptr);.

Parameters
[in]timeThe time field is set to the specified value.

Definition at line 668 of file fileentry.cpp.

References zipios::FileEntry::m_unix_time.

Referenced by zipios::FileEntry::setTime().

std::string zipios::FileEntry::toString ( ) const
virtualinherited

This function transforms the basic information of the entry in a string. Note that most of the information is lost as the function is likely to only display the filename and the size of the file, nothing more.

Returns
A human-readable string representation of the entry.

Definition at line 683 of file fileentry.cpp.

References zipios::FileEntry::getCompressedSize(), zipios::FileEntry::isDirectory(), zipios::FileEntry::m_filename, and zipios::FileEntry::m_uncompressed_size.

Referenced by zipios::operator<<().

void zipios::ZipCentralDirectoryEntry::write ( std::ostream &  os)
overridevirtual

This function verifies that the data of the Central Directory entry can be written to disk. If so, then it writes a block. The size of the blocks varies depending on the filename, file comment, and extra data. The current size can be determined using the getHeaderSize() function.

Warning
The function saves the filename with an ending separator in case the entry is marked as a directory entry. Note that Zip only really knows about the trailing slash as a way to detect a file as a directory.
Exceptions
InvalidStateExceptionThe function verifies whether the filename, extra field, file comment, file data, or data offset are not too large. If any one of these parameters is too large, then this exception is raised.
Parameters
[in]osThe output stream where the data is written.
See Also
getHeaderSize()
read()
Todo:
add support for 64 bit entries (zip64 is available, just need to add a 64 bit header...)
Todo:
The external_file_attr supports the standard Unix permissions in the higher 16 bits defined as:

<type> <rwx> <rwx> <rwx>

The <type> is the top 4 bits and is set to either 8 or 4:

  • 8 for regular files
  • 4 for directories

The <rwx> are the standard permission flags representing the owner, group, and other read/write/execute permissions.

The value also includes the special flags SUID, SGID and VTX.

So to have a fix here we need to have a way to read those flags from the file entry.

Reimplemented from zipios::ZipLocalEntry.

Definition at line 326 of file zipcentraldirectoryentry.cpp.

References zipios::FileEntry::COMPRESSION_LEVEL_NONE, dostime(), zipios::anonymous_namespace{zipcentraldirectoryentry.cpp}::g_osx, zipios::g_separator, zipios::anonymous_namespace{zipcentraldirectoryentry.cpp}::g_signature, zipios::anonymous_namespace{zipcentraldirectoryentry.cpp}::g_unix, zipios::anonymous_namespace{zipcentraldirectoryentry.cpp}::g_windows, zipios::ZipLocalEntry::g_zip_format_version, zipios::FilePath::length(), zipios::FileEntry::m_comment, zipios::FileEntry::m_compress_method, zipios::ZipLocalEntry::m_compressed_size, zipios::FileEntry::m_compression_level, zipios::FileEntry::m_crc_32, zipios::FileEntry::m_entry_offset, zipios::FileEntry::m_extra_field, zipios::ZipLocalEntry::m_extract_version, zipios::FileEntry::m_filename, zipios::ZipLocalEntry::m_general_purpose_bitfield, zipios::ZipLocalEntry::m_is_directory, zipios::FileEntry::m_uncompressed_size, zipios::FileEntry::m_unix_time, zipios::STORED, unix2dostime(), and zipios::zipWrite().

Member Data Documentation

CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_DEFAULT = -3
staticinherited

Definition at line 87 of file fileentry.hpp.

Referenced by zipios::DeflateOutputStreambuf::init().

CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_FASTEST = -1
staticinherited

Definition at line 89 of file fileentry.hpp.

Referenced by zipios::DeflateOutputStreambuf::init().

CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_MAXIMUM = 100
staticinherited
CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_MINIMUM = 1
staticinherited
CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_NONE = 0
staticinherited
CompressionLevel const zipios::FileEntry::COMPRESSION_LEVEL_SMALLEST = -2
staticinherited

Definition at line 88 of file fileentry.hpp.

Referenced by zipios::DeflateOutputStreambuf::init().

uint16_t const zipios::ZipLocalEntry::g_zip_format_version = 20
staticinherited

Definition at line 46 of file ziplocalentry.hpp.

Referenced by write().

std::string zipios::FileEntry::m_comment
protectedinherited
StorageMethod zipios::FileEntry::m_compress_method = StorageMethod::STORED
protectedinherited
size_t zipios::ZipLocalEntry::m_compressed_size = 0
protectedinherited
CompressionLevel zipios::FileEntry::m_compression_level = COMPRESSION_LEVEL_DEFAULT
protectedinherited
uint32_t zipios::FileEntry::m_crc_32 = 0
protectedinherited
std::streampos zipios::FileEntry::m_entry_offset = 0
protectedinherited
buffer_t zipios::FileEntry::m_extra_field
protectedinherited
uint16_t zipios::ZipLocalEntry::m_extract_version = g_zip_format_version
protectedinherited
FilePath zipios::FileEntry::m_filename
protectedinherited
uint16_t zipios::ZipLocalEntry::m_general_purpose_bitfield = 0
protectedinherited
bool zipios::FileEntry::m_has_crc_32 = false
protectedinherited
bool zipios::ZipLocalEntry::m_is_directory = false
protectedinherited
size_t zipios::FileEntry::m_uncompressed_size = 0
protectedinherited
time_t zipios::FileEntry::m_unix_time = 0
protectedinherited
bool zipios::FileEntry::m_valid = false
protectedinherited

The documentation for this class was generated from the following files: