![]() |
KVIrc 5.2.4
Developer APIs
|
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. | |
KviPackageReader () | |
Creates the package reader object. | |
bool | readHeader (const QString &szLocalFileName) |
Read the header of the package. | |
bool | unpack (const QString &szLocalFileName, const QString &szUnpackPath, kvi_u32_t uUnpackFlags=0) |
Unpack the KVIrc package file. | |
virtual | ~KviPackageReader () |
Destroys the object. | |
![]() | |
KviPointerHashTable< QString, QByteArray > * | binaryInfoFields () |
Returns the binary info fields. | |
KviPackageIOEngine () | |
Creates the I/O engine object. | |
const QString & | lastError () |
Returns the last error. | |
KviPointerHashTable< QString, QString > * | stringInfoFields () |
Returns the string info fields. | |
virtual | ~KviPackageIOEngine () |
Destroys the object. | |
Private Member Functions | |
bool | readHeaderInternal (KviFile *pFile, const QString &szLocalFileName) |
Read the header of the package. | |
bool | unpackFile (KviFile *pFile, const QString &szUnpackPath) |
Unpack the KVIrc package file. | |
bool | unpackInternal (const QString &szLocalFileName, const QString &szUnpackPath, kvi_u32_t uUnpackFlags=0) |
Unpack the KVIrc package file. | |
Additional Inherited Members | |
![]() | |
void | hideProgressDialog () |
Hides the progress dialog. | |
bool | readError () |
Sets the last error as read error. | |
void | setLastError (const QString &szLastError) |
Sets the last error. | |
void | showProgressDialog (const QString &szCaption, int iTotalSteps) |
Shows the progress dialog. | |
bool | updateProgress (int iProgress, const QString &szLabel) |
Updates the progress dialog. | |
bool | writeError () |
Sets the last error as write error. | |
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(), KviPackageIOEngine::stringInfoFields(), and szBuffer.
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().
|
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().
|
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, NoProgressDialog, KviPackageIOEngine::readError(), readHeaderInternal(), KviPackageIOEngine::setLastError(), KviPackageIOEngine::showProgressDialog(), unpackFile(), and KviPackageIOEngine::updateProgress().
Referenced by unpack().