KVIrc  4.9.2
DeveloperAPIs
Public Types | Public Member Functions | Private Member Functions | List of all members
KviPackageReader Class Reference

This class is used to read KVIrc package files. More...

#include <KviPackageReader.h>

+ Inheritance diagram for KviPackageReader:

Public Types

enum  UnpackFlags { NoProgressDialog = 1 }
 

Public Member Functions

bool getStringInfoField (const QString &szName, QString &szBuffer)
 Get the string info field contained in the package. More...
 
 KviPackageReader ()
 Creates the package reader object. More...
 
bool readHeader (const QString &szLocalFileName)
 Read the header of the package. More...
 
bool unpack (const QString &szLocalFileName, const QString &szUnpackPath, kvi_u32_t uUnpackFlags=0)
 Unpack the KVIrc package file. More...
 
virtual ~KviPackageReader ()
 Destroys the object. More...
 
- Public Member Functions inherited from KviPackageIOEngine
KviPointerHashTable< QString,
QByteArray > * 
binaryInfoFields ()
 Returns the binary info fields. More...
 
 KviPackageIOEngine ()
 Creates the I/O engine object. More...
 
const QString & lastError ()
 Returns the last error. More...
 
KviPointerHashTable< QString,
QString > * 
stringInfoFields ()
 Returns the string info fields. More...
 
virtual ~KviPackageIOEngine ()
 Destroys the object. More...
 

Private Member Functions

bool readHeaderInternal (KviFile *pFile, const QString &szLocalFileName)
 Read the header of the package. More...
 
bool unpackFile (KviFile *pFile, const QString &szUnpackPath)
 Unpack the KVIrc package file. More...
 
bool unpackInternal (const QString &szLocalFileName, const QString &szUnpackPath, kvi_u32_t uUnpackFlags=0)
 Unpack the KVIrc package file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from KviPackageIOEngine
void hideProgressDialog ()
 Hides the progress dialog. More...
 
bool readError ()
 Sets the last error as read error. More...
 
void setLastError (const QString &szLastError)
 Sets the last error. More...
 
void showProgressDialog (const QString &szCaption, int iTotalSteps)
 Shows the progress dialog. More...
 
bool updateProgress (int iProgress, const QString &szLabel)
 Updates the progress dialog. More...
 
bool writeError ()
 Sets the last error as write error. More...
 

Detailed Description

This class is used to read KVIrc package files.

You simply instantiate it and then call unpack().

Member Enumeration Documentation

Enumerator
NoProgressDialog 

If you want to avoid the progress dialog

Constructor & Destructor Documentation

KviPackageReader::KviPackageReader ( )

Creates the package reader object.

Returns
KviPackageReader
KviPackageReader::~KviPackageReader ( )
virtualdefault

Destroys the object.

Member Function Documentation

bool KviPackageReader::getStringInfoField ( const QString &  szName,
QString &  szBuffer 
)

Get the string info field contained in the package.

Parameters
szNameThe name of the info field
szBufferThe buffer where to store data
Returns
bool

References KviPointerHashTable< Key, T >::find(), and KviPackageIOEngine::stringInfoFields().

Referenced by AddonFunctions::installAddonPackage(), and ThemeFunctions::installThemePackage().

bool KviPackageReader::readHeader ( const QString &  szLocalFileName)

Read the header of the package.

This is a shortcut to readHeaderInternal()

Parameters
szLocalFileNameThe source package
Returns
bool

References __tr2qs, f, readHeaderInternal(), and KviPackageIOEngine::setLastError().

Referenced by AddonFunctions::installAddonPackage(), ThemeFunctions::installThemePackage(), and package_kvs_cmd_extractField().

bool KviPackageReader::readHeaderInternal ( KviFile pFile,
const QString &  szLocalFileName 
)
private
bool KviPackageReader::unpack ( const QString &  szLocalFileName,
const QString &  szUnpackPath,
kvi_u32_t  uUnpackFlags = 0 
)

Unpack the KVIrc package file.

This is a shortcut to unpackInternal() hiding the progress dialog

Parameters
szLocalFileNameThe source package
szUnpackPathThe path where to unpack the package
uUnpackFlagsThe flags to unpack
Returns
bool

References KviPackageIOEngine::hideProgressDialog(), and unpackInternal().

Referenced by AddonFunctions::installAddonPackage(), ThemeFunctions::installThemePackage(), and package_kvs_fnc_info().

bool KviPackageReader::unpackFile ( KviFile pFile,
const QString &  szUnpackPath 
)
private
bool KviPackageReader::unpackInternal ( const QString &  szLocalFileName,
const QString &  szUnpackPath,
kvi_u32_t  uUnpackFlags = 0 
)
private

Unpack the KVIrc package file.

This is a shortcut to unpackFile() performing some checks

Parameters
szLocalFileNameThe source package
szUnpackPathThe path where to unpack the package
uUnpackFlagsThe flags to unpack
Returns
bool

References __tr2qs, f, kvi_file_offset_t, KVI_PACKAGE_DATAFIELD_TYPE_FILE, KviFile::load(), NoProgressDialog, KviPackageIOEngine::readError(), readHeaderInternal(), KviPackageIOEngine::setLastError(), KviPackageIOEngine::showProgressDialog(), unpackFile(), and KviPackageIOEngine::updateProgress().

Referenced by unpack().


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