Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
ZipFile Class Reference

This class sits over the zlib and gzip code to implement a PKWare or Info-Zip .zip file reader and writer. More...

#include <ziptool.h>

Public Member Functions

 ZipFile ()
 Constructor.
 
virtual ~ZipFile ()
 Destructor.
 
virtual void setComment (const std::string &val)
 
virtual std::string getComment ()
 
std::vector< ZipEntry * > & getEntries ()
 Return the list of entries currently in this file.
 
virtual ZipEntryaddFile (const std::string &fileNameArg, const std::string &commentArg)
 
virtual ZipEntrynewEntry (const std::string &fileNameArg, const std::string &commentArg)
 
virtual bool write ()
 
virtual bool writeBuffer (std::vector< unsigned char > &outbuf)
 
virtual bool writeFile (const std::string &fileName)
 
virtual bool read ()
 
virtual bool readBuffer (const std::vector< unsigned char > &inbuf)
 
virtual bool readFile (const std::string &fileName)
 

Private Member Functions

void error (char const *fmt,...) G_GNUC_PRINTF(2
 
void void trace (char const *fmt,...) G_GNUC_PRINTF(2
 
void void bool putLong (unsigned long val)
 
bool putInt (unsigned int val)
 
bool putByte (unsigned char val)
 
bool writeFileData ()
 
bool writeCentralDirectory ()
 
bool getLong (unsigned long *val)
 
bool getInt (unsigned int *val)
 
bool getByte (unsigned char *val)
 
bool readFileData ()
 
bool readCentralDirectory ()
 

Private Attributes

std::vector< ZipEntry * > entries
 
std::vector< unsigned char > fileBuf
 
unsigned long fileBufPos
 
std::string comment
 

Detailed Description

This class sits over the zlib and gzip code to implement a PKWare or Info-Zip .zip file reader and writer.

Definition at line 394 of file ziptool.h.

Constructor & Destructor Documentation

◆ ZipFile()

ZipFile::ZipFile ( )

Constructor.

Definition at line 2163 of file ziptool.cpp.

◆ ~ZipFile()

ZipFile::~ZipFile ( )
virtual

Destructor.

Definition at line 2174 of file ziptool.cpp.

References entries.

Member Function Documentation

◆ addFile()

ZipEntry * ZipFile::addFile ( const std::string &  fileNameArg,
const std::string &  commentArg 
)
virtual

Definition at line 2243 of file ziptool.cpp.

References comment, entries, and ZipEntry::readFile().

◆ error()

void ZipFile::error ( char const *  fmt,
  ... 
)
private

Definition at line 2216 of file ziptool.cpp.

References fmt, va_end(), and va_start().

Referenced by readCentralDirectory(), and readFileData().

◆ getByte()

bool ZipFile::getByte ( unsigned char *  val)
private

Definition at line 2494 of file ziptool.cpp.

References fileBuf, and fileBufPos.

Referenced by readCentralDirectory(), and readFileData().

◆ getComment()

std::string ZipFile::getComment ( )
virtual

Definition at line 2196 of file ziptool.cpp.

References comment.

◆ getEntries()

std::vector< ZipEntry * > & ZipFile::getEntries ( )

Return the list of entries currently in this file.

Definition at line 2205 of file ziptool.cpp.

References entries.

◆ getInt()

bool ZipFile::getInt ( unsigned int *  val)
private

Definition at line 2479 of file ziptool.cpp.

References fileBuf, and fileBufPos.

Referenced by readCentralDirectory(), and readFileData().

◆ getLong()

bool ZipFile::getLong ( unsigned long *  val)
private

Definition at line 2461 of file ziptool.cpp.

References fileBuf, and fileBufPos.

Referenced by readCentralDirectory(), and readFileData().

◆ newEntry()

ZipEntry * ZipFile::newEntry ( const std::string &  fileNameArg,
const std::string &  commentArg 
)
virtual

◆ putByte()

bool ZipFile::putByte ( unsigned char  val)
private

Definition at line 2299 of file ziptool.cpp.

References fileBuf.

Referenced by writeCentralDirectory(), and writeFileData().

◆ putInt()

bool ZipFile::putInt ( unsigned int  val)
private

Definition at line 2289 of file ziptool.cpp.

References fileBuf.

Referenced by writeCentralDirectory(), and writeFileData().

◆ putLong()

bool ZipFile::putLong ( unsigned long  val)
private

Definition at line 2276 of file ziptool.cpp.

References fileBuf.

Referenced by writeCentralDirectory(), and writeFileData().

◆ read()

bool ZipFile::read ( )
virtual

Definition at line 2983 of file ziptool.cpp.

References fileBufPos, readCentralDirectory(), and readFileData().

Referenced by readBuffer(), and readFile().

◆ readBuffer()

bool ZipFile::readBuffer ( const std::vector< unsigned char > &  inbuf)
virtual

Definition at line 3000 of file ziptool.cpp.

References fileBuf, and read().

◆ readCentralDirectory()

bool ZipFile::readCentralDirectory ( )
private

Definition at line 2743 of file ziptool.cpp.

References comment, error(), getByte(), getInt(), getLong(), and trace().

Referenced by read().

◆ readFile()

bool ZipFile::readFile ( const std::string &  fileName)
virtual

Definition at line 3012 of file ziptool.cpp.

References fileBuf, and read().

◆ readFileData()

◆ setComment()

void ZipFile::setComment ( const std::string &  val)
virtual

Definition at line 2188 of file ziptool.cpp.

References comment.

◆ trace()

void ZipFile::trace ( char const *  fmt,
  ... 
)
private

Definition at line 2226 of file ziptool.cpp.

References fmt, va_end(), and va_start().

Referenced by readCentralDirectory(), and readFileData().

◆ write()

bool ZipFile::write ( )
virtual

Definition at line 2410 of file ziptool.cpp.

References fileBuf, writeCentralDirectory(), and writeFileData().

Referenced by writeBuffer(), and writeFile().

◆ writeBuffer()

bool ZipFile::writeBuffer ( std::vector< unsigned char > &  outbuf)
virtual

Definition at line 2424 of file ziptool.cpp.

References fileBuf, and write().

◆ writeCentralDirectory()

◆ writeFile()

bool ZipFile::writeFile ( const std::string &  fileName)
virtual

Definition at line 2437 of file ziptool.cpp.

References fileBuf, and write().

Referenced by Inkscape::Extension::Internal::OdfOutput::save().

◆ writeFileData()

Member Data Documentation

◆ comment

std::string ZipFile::comment
private

◆ entries

std::vector<ZipEntry *> ZipFile::entries
private

◆ fileBuf

std::vector<unsigned char> ZipFile::fileBuf
private

◆ fileBufPos

unsigned long ZipFile::fileBufPos
private

Definition at line 559 of file ziptool.h.

Referenced by getByte(), getInt(), getLong(), and read().


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