zipios++  2.0.2
Zipios++ – a small C++ library that provides easy access to .zip files.
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
zipios Namespace Reference

The zipios namespace includes the Zipios++ library definitions. More...

Namespaces

 anonymous_namespace{collectioncollection.cpp}
 
 anonymous_namespace{filecollection.cpp}
 
 anonymous_namespace{filepath.cpp}
 
 anonymous_namespace{zipcentraldirectoryentry.cpp}
 
 anonymous_namespace{zipendofcentraldirectory.cpp}
 Private definitions of the ZipEndOfCentralDirectory class.
 
 anonymous_namespace{ziplocalentry.cpp}
 Various definitions for local blocks.
 
 anonymous_namespace{zipoutputstreambuf.cpp}
 

Classes

class  BackBuffer
 To read a file by chunk from the end. More...
 
class  CollectionCollection
 A collection of collections. More...
 
class  DeflateOutputStreambuf
 A class to handle stream deflate on the fly. More...
 
class  DirectoryCollection
 A collection generated from reading a directory. More...
 
class  DirectoryEntry
 A file entry that does not use compression. More...
 
class  Exception
 Base exception of the zipios environement. More...
 
class  FileCollection
 Base class for various file collections. More...
 
class  FileCollectionException
 FileCollectionException is used to signal a FileCollection problem. More...
 
class  FileEntry
 A FileEntry represents an entry in a FileCollection. More...
 
class  FilePath
 Handle a file path and name and its statistics. More...
 
class  FilterInputStreambuf
 A base class to develop input stream filters. More...
 
class  FilterOutputStreambuf
 A base class to develop output stream filters. More...
 
class  GZIPOutputStream
 A stream implementation that outputs data to a ZIP file. More...
 
class  GZIPOutputStreambuf
 Save the output stream buffer. More...
 
class  InflateInputStreambuf
 A stream buffer to inflate data previous compressed with zlib. More...
 
class  InvalidException
 An InvalidException is used when invalid data is provided. More...
 
class  InvalidStateException
 Exception used when it is not possible to move forward. More...
 
class  IOException
 An IOException is used to signal an I/O error. More...
 
class  VirtualSeeker
 A virtual class used to see in a file embedded in another. More...
 
class  ZipCentralDirectoryEntry
 A specialization of ZipLocalEntry for. More...
 
class  ZipEndOfCentralDirectory
 Marker at the end of a Zip archive file. More...
 
class  ZipFile
 The ZipFile class represents a collection of files. More...
 
class  ZipInputStream
 The ZipInputStream to read data from a Zip archive. More...
 
class  ZipInputStreambuf
 An input stream buffer for Zip data. More...
 
class  ZipLocalEntry
 An implementation of the FileEntry for Zip archives. More...
 
class  ZipOutputStream
 A ZipOutputStream to allow for data to be compressed zlib. More...
 
class  ZipOutputStreambuf
 Handle the output buffer of a zip archive. More...
 

Typedefs

typedef std::vector< unsigned
char > 
buffer_t
 A buffer of characters. More...
 
typedef std::streamoff offset_t
 
typedef std::ostringstream OutputStringStream
 An output stream using strings. More...
 

Enumerations

enum  StorageMethod : uint8_t {
  StorageMethod::STORED = 0,
  StorageMethod::SHRUNK = 1,
  StorageMethod::REDUCED1 = 2,
  StorageMethod::REDUCED2 = 3,
  StorageMethod::REDUCED3 = 4,
  StorageMethod::REDUCED4 = 5,
  StorageMethod::IMPLODED = 6,
  StorageMethod::TOKENIZED = 7,
  StorageMethod::DEFLATED = 8,
  StorageMethod::DEFLATED64 = 9,
  StorageMethod::OLD_TERSE = 10,
  StorageMethod::RESERVED11 = 11,
  StorageMethod::BZIP2 = 12,
  StorageMethod::REVERVED13 = 13,
  StorageMethod::LZMA = 14,
  StorageMethod::RESERVED15 = 15,
  StorageMethod::RESERVED16 = 16,
  StorageMethod::RESERVED17 = 17,
  StorageMethod::NEW_TERSE = 18,
  StorageMethod::LZ77 = 19,
  StorageMethod::WAVPACK = 97,
  StorageMethod::PPMD_I_1 = 98
}
 The types used with FileEntry::setMethod and FileEntry::getMethod. More...
 

Functions

size_t getBufferSize ()
 
char const * getVersion ()
 
std::ostream & operator<< (std::ostream &os, FilePath const &path)
 Print out a FilePath. More...
 
std::ostream & operator<< (std::ostream &os, FileCollection const &collection)
 Write a FileCollection to the output stream. More...
 
std::ostream & operator<< (std::ostream &os, FileEntry const &entry)
 Output an entry as a string to a stream. More...
 
bool operator== (char const *lhs, FilePath const &rhs)
 Check whether two FilePath represent the same file. More...
 
bool operator== (std::string const &lhs, FilePath const &rhs)
 Check whether two FilePath represent the same file. More...
 
void zipRead (std::istream &is, uint32_t &value)
 
void zipRead (std::istream &is, uint16_t &value)
 
void zipRead (std::istream &is, uint8_t &value)
 
void zipRead (std::istream &is, buffer_t &buffer, ssize_t const count)
 
void zipRead (std::istream &is, std::string &str, ssize_t const count)
 
void zipRead (buffer_t const &is, size_t &pos, uint32_t &value)
 
void zipRead (buffer_t const &is, size_t &pos, uint16_t &value)
 
void zipRead (buffer_t const &is, size_t &pos, uint8_t &value)
 
void zipRead (buffer_t const &is, size_t &pos, buffer_t &buffer, ssize_t const count)
 
void zipRead (buffer_t const &is, size_t &pos, std::string &str, ssize_t const count)
 
void zipWrite (std::ostream &os, uint32_t const &value)
 
void zipWrite (std::ostream &os, uint16_t const &value)
 
void zipWrite (std::ostream &os, uint8_t const &value)
 
void zipWrite (std::ostream &os, buffer_t const &buffer)
 
void zipWrite (std::ostream &os, std::string const &str)
 

Variables

char const g_separator = '/'
 The character used as the filename separator. More...
 

Detailed Description

This namespace is used to clearly separate all the Zipios++ definitions. Note that a very few definitions are found outside of the namespace. Some of those are hidden in the source of the library, a very few appear in the zipios-config.hpp file as they are used to support zipios++ on any platform.

Note that to ensure secure development, we do not make use of the C++ "using ..." keyword. That way we can guarantee what's what.

Typedef Documentation

std::vector< unsigned char > zipios::buffer_t

This type is used to declare a buffer of characters. It is used in many places.

Todo:
Move to the zipios-config.hpp file so we can also use it in our public definitions?

Definition at line 93 of file zipios_common.hpp.

typedef std::streamoff zipios::offset_t

Definition at line 57 of file zipios-config.hpp.in.

std::ostringstream zipios::OutputStringStream

This object is used whenever we want to output a buffer from a string and convert that to a string.

Definition at line 90 of file zipios_common.hpp.

Enumeration Type Documentation

enum zipios::StorageMethod : uint8_t
strong

The current entries are the types supported by the zip format. The numbering matches one to one the numbering used in the zip file format, i.e. STORED is indicated by a 0 in the method field in a zip file and so on.

The zipios library only support STORED and DEFLATED at this time.

Enumerator
STORED 
SHRUNK 
REDUCED1 
REDUCED2 
REDUCED3 
REDUCED4 
IMPLODED 
TOKENIZED 
DEFLATED 
DEFLATED64 
OLD_TERSE 
RESERVED11 
BZIP2 
REVERVED13 
LZMA 
RESERVED15 
RESERVED16 
RESERVED17 
NEW_TERSE 
LZ77 
WAVPACK 
PPMD_I_1 

Definition at line 47 of file fileentry.hpp.

Function Documentation

size_t zipios::getBufferSize ( )
inline
char const * zipios::getVersion ( )
inline

Definition at line 51 of file zipios-config.hpp.in.

References ZIPIOS_VERSION_STRING.

Referenced by main().

std::ostream & zipios::operator<< ( std::ostream &  os,
FilePath const &  path 
)

This function prints out the name of the file that this FilePath represents.

Parameters
[in,out]osThe output stream.
[in]pathThe path to print out.
Returns
A copy of the os stream reference.

Definition at line 502 of file filepath.cpp.

std::ostream & zipios::operator<< ( std::ostream &  os,
FileCollection const &  collection 
)

This function writes a simple textual representation of this FileCollection to the output stream.

Parameters
[in,out]osThe output stream.
[in]collectionThe collection to print out.
Returns
A reference to the os output stream.

Definition at line 598 of file filecollection.cpp.

References zipios::FileCollection::entries(), and zipios::FileCollection::getName().

std::ostream & zipios::operator<< ( std::ostream &  os,
FileEntry const &  entry 
)

This function transforms the FileEntry into a string and prints the result to the specified output stream.

Parameters
[in,out]osThe output stream.
[in]entryThe entry to print out.
Returns
A reference to the output stream.

Definition at line 759 of file fileentry.cpp.

References zipios::FileEntry::toString().

bool zipios::operator== ( char const *  lhs,
FilePath const &  rhs 
)

This function compares a FilePath object (this) and a C-string to know whether the two are the same.

A null pointer as the C-string is viewed as an empty string.

Parameters
[in]lhsThe left hand side to compare with.
[in]rhsThe right hand side to compare with.
See Also
operator == (FilePath const& rhs);

Definition at line 235 of file filepath.cpp.

References zipios::FilePath::m_path.

bool zipios::operator== ( std::string const &  lhs,
FilePath const &  rhs 
)

This function compares a FilePath object (this) against a string representing a path to know whether the two are the equal.

Parameters
[in]lhsThe left hand side to compare with.
[in]rhsThe right hand side to compare with.
See Also
operator == (FilePath const& rhs);

Definition at line 268 of file filepath.cpp.

References zipios::FilePath::m_path.

void zipios::zipRead ( std::istream &  is,
uint32_t &  value 
)
void zipios::zipRead ( std::istream &  is,
uint16_t &  value 
)

Definition at line 95 of file zipios_common.cpp.

void zipios::zipRead ( std::istream &  is,
uint8_t &  value 
)

Definition at line 114 of file zipios_common.cpp.

void zipios::zipRead ( std::istream &  is,
buffer_t &  buffer,
ssize_t const  count 
)

Definition at line 132 of file zipios_common.cpp.

void zipios::zipRead ( std::istream &  is,
std::string &  str,
ssize_t const  count 
)

Definition at line 149 of file zipios_common.cpp.

void zipios::zipRead ( buffer_t const &  is,
size_t &  pos,
uint32_t &  value 
)

Definition at line 166 of file zipios_common.cpp.

void zipios::zipRead ( buffer_t const &  is,
size_t &  pos,
uint16_t &  value 
)

Definition at line 182 of file zipios_common.cpp.

void zipios::zipRead ( buffer_t const &  is,
size_t &  pos,
uint8_t &  value 
)

Definition at line 196 of file zipios_common.cpp.

void zipios::zipRead ( buffer_t const &  is,
size_t &  pos,
buffer_t &  buffer,
ssize_t const  count 
)

Definition at line 209 of file zipios_common.cpp.

void zipios::zipRead ( buffer_t const &  is,
size_t &  pos,
std::string &  str,
ssize_t const  count 
)

Definition at line 223 of file zipios_common.cpp.

void zipios::zipWrite ( std::ostream &  os,
uint32_t const &  value 
)
void zipios::zipWrite ( std::ostream &  os,
uint16_t const &  value 
)

Definition at line 253 of file zipios_common.cpp.

void zipios::zipWrite ( std::ostream &  os,
uint8_t const &  value 
)

Definition at line 267 of file zipios_common.cpp.

void zipios::zipWrite ( std::ostream &  os,
buffer_t const &  buffer 
)

Definition at line 280 of file zipios_common.cpp.

void zipios::zipWrite ( std::ostream &  os,
std::string const &  str 
)

Definition at line 289 of file zipios_common.cpp.

Variable Documentation

char const zipios::g_separator = '/'

This character is used to separate filename segments in a path in a Zip archive.

Todo:
It is "inadvertendly" also used as the separator between filename segments of the file system. We certainly want to support both "/" and "\\" to make sure MS-Windows is fully supported. The FilePath should take care of that work though.

Definition at line 51 of file zipios_common.cpp.

Referenced by zipios::FilePath::filename(), zipios::FilePath::operator+(), zipios::anonymous_namespace{filepath.cpp}::pruneTrailingSeparator(), zipios::ZipCentralDirectoryEntry::read(), zipios::ZipLocalEntry::read(), zipios::ZipCentralDirectoryEntry::write(), and zipios::ZipLocalEntry::write().