KVIrc
4.9.2
DeveloperAPIs
|
This class is used to read KVIrc package files. More...
#include <KviPackageReader.h>
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... | |
This class is used to read KVIrc package files.
You simply instantiate it and then call unpack().
KviPackageReader::KviPackageReader | ( | ) |
Creates the package reader object.
|
virtualdefault |
Destroys the object.
bool KviPackageReader::getStringInfoField | ( | const QString & | szName, |
QString & | szBuffer | ||
) |
Get the string info field contained in the package.
szName | The name of the info field |
szBuffer | The buffer where to store data |
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()
szLocalFileName | The source package |
References __tr2qs, f, readHeaderInternal(), and KviPackageIOEngine::setLastError().
Referenced by AddonFunctions::installAddonPackage(), ThemeFunctions::installThemePackage(), and package_kvs_cmd_extractField().
|
private |
Read the header of the package.
This is the real readHeader() function
pFile | The pointer to the real file |
szLocalFileName | The source package |
References __tr2qs, KviPackageIOEngine::binaryInfoFields(), KviPointerHashTable< Key, T >::clear(), KVI_PACKAGE_INFOFIELD_TYPE_BINARYBUFFER, KVI_PACKAGE_INFOFIELD_TYPE_STRING, KviFile::load(), KviPackageIOEngine::readError(), KviPointerHashTable< Key, T >::replace(), KviPackageIOEngine::setLastError(), KviPackageIOEngine::stringInfoFields(), and KviPackageIOEngine::writeError().
Referenced by readHeader(), and unpackInternal().
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
szLocalFileName | The source package |
szUnpackPath | The path where to unpack the package |
uUnpackFlags | The flags to unpack |
References KviPackageIOEngine::hideProgressDialog(), and unpackInternal().
Referenced by AddonFunctions::installAddonPackage(), ThemeFunctions::installThemePackage(), and package_kvs_fnc_info().
|
private |
Unpack the KVIrc package file.
This is the real unpack() function.
pFile | The source file package |
szUnpackPath | The path where to unpack the package |
References __tr2qs, KviFileUtils::adjustFilePath(), BUFFER_SIZE, KviQString::ensureLastCharIs(), KVI_PACKAGE_DATAFIELD_FLAG_FILE_DEFLATE, KVI_PATH_SEPARATOR_CHAR, KviFile::load(), KviFileUtils::makeDir(), KviPackageIOEngine::readError(), KviPackageIOEngine::setLastError(), KviPackageIOEngine::updateProgress(), and KviPackageIOEngine::writeError().
Referenced by unpackInternal().
|
private |
Unpack the KVIrc package file.
This is a shortcut to unpackFile() performing some checks
szLocalFileName | The source package |
szUnpackPath | The path where to unpack the package |
uUnpackFlags | The flags to unpack |
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().