LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::zipfile Class Reference

An interface class to represent a zip file. More...

#include <zipfile.h>

Classes

class  extra_info
 A base class to represent an extra information record from a zip file. More...
 
class  file_info
 A class to represent a file information record from a zip file. More...
 
class  not_found
 An exception class for reporting not found errors. More...
 
class  riscos_info
 A class to represent a RISC OS extra information record from a zip file. More...
 
class  unsupported_compression_method
 An exception class for reporting unsupported compression method errors. More...
 
class  zlib_error
 An exception class for reporting errors in zlib. More...
 

Public Types

typedef unsigned short uint16
 A type to represent an unsigned 16-bit integer. More...
 
typedef unsigned long uint32
 A type to represent an unsigned 32-bit integer. More...
 

Public Member Functions

 zipfile (const string &pathname)
 Construct zip file object. More...
 
 ~zipfile ()
 Destroy zip file object. More...
 
unsigned int size () const
 Get number of file information records. More...
 
const file_infooperator[] (unsigned int index) const
 Get const file information record at index. More...
 
const file_infofind (const string &pathname) const
 Find const file information record for pathname. More...
 
void extract (const string &src_pathname, const string &dst_pathname) const
 Extract file from zip file. More...
 

Detailed Description

An interface class to represent a zip file.

Member Typedef Documentation

◆ uint16

typedef unsigned short pkg::zipfile::uint16

A type to represent an unsigned 16-bit integer.

◆ uint32

typedef unsigned long pkg::zipfile::uint32

A type to represent an unsigned 32-bit integer.

Constructor & Destructor Documentation

◆ zipfile()

pkg::zipfile::zipfile ( const string &  pathname)

Construct zip file object.

Parameters
pathnamethe pathname of the zip file.

◆ ~zipfile()

pkg::zipfile::~zipfile ( )

Destroy zip file object.

Member Function Documentation

◆ size()

unsigned int pkg::zipfile::size ( ) const

Get number of file information records.

Returns
the number of file information records

Referenced by pkg::unpack::poll().

◆ operator[]()

const zipfile::file_info & pkg::zipfile::operator[] ( unsigned int  index) const

Get const file information record at index.

Parameters
indexthe index
Returns
a const reference to the file information record

◆ find()

const zipfile::file_info * pkg::zipfile::find ( const string &  pathname) const

Find const file information record for pathname.

Parameters
pathnamethe pathname
Returns
a const pointer to the file information record, or 0 if not found

Referenced by extract(), and pkg::unpack::poll().

◆ extract()

void pkg::zipfile::extract ( const string &  src_pathname,
const string &  dst_pathname 
) const

Extract file from zip file.

Parameters
src_pathnamethe source pathname, with respect to the root of the zip file
dst_pathnamethe destination pathname

References pkg::zipfile::file_info::csize(), find(), pkg::zipfile::file_info::method(), pkg::zipfile::file_info::offset(), pkg::soft_delete(), and UNZIP_BUFFER_SIZE.

Referenced by pkg::unpack::poll().


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

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)