Ananas Library
0.9.5
|
#include <acontainer.h>
Public Member Functions | |
aContainer () | |
aContainer (const QString &name) | |
virtual | ~aContainer () |
virtual bool | open () |
virtual bool | open (const QString &name) |
virtual void | create () |
virtual void | close () |
virtual bool | save () |
virtual bool | save (const QString &name) |
virtual bool | addFile (const QString &filename, const QString &newname, int type) |
virtual QString | realPath (const QString &fname) const |
virtual QString | lastError () const |
void | setLastError (const QString &errorText) |
QString | getFileContent (const QString &fileName) const |
Protected Member Functions | |
void | generateName4TmpDir () |
bool | createTmpDir () |
bool | extractManifest (const QString &archName, aCManifest *mf) |
bool | extractData (const QString &archName) |
bool | compressFile (const QString &fileName) |
void | cleanupTmpFiles () |
Class for work with data container
aContainer::aContainer | ( | ) |
Constructor
aContainer::aContainer | ( | const QString & | name | ) |
Constructor with name
|
virtual |
Destructor
|
virtual |
Add specified file to container.
filename | - fully specified file name |
newname | - relative file name in container. Should be relative at container root. e.g. "forms/form111.ui" |
type | - type of file. See aCManifest class description for details. |
References aCManifest::addEntry(), and aLog::print().
|
protected |
Clean templorary files.
References aCManifest::first(), aCManifest::next(), and aLog::print().
|
virtual |
|
protected |
Zip one file to container. THE FUNCTION DOSEN'T WORK!
fileName | - container relative file name to zip. |
References aLog::print(), and setLastError().
Referenced by save().
|
virtual |
Create new empty container.
References aCManifest::create(), createTmpDir(), and generateName4TmpDir().
|
protected |
Creates new temporary directory.
References aLog::print(), and setLastError().
|
protected |
Extracts all files to temporary directory.
archName | - container name |
References aLog::print(), and setLastError().
Referenced by open().
|
protected |
Extracts manifest file. This file always named META-INF/manifest.xml
archName | - container name |
mf | (out) - pointer to manifest. |
References aLog::print(), aCManifest::read(), and setLastError().
Referenced by open().
|
protected |
|
virtual |
Get last error text.
|
virtual |
Opens file. You should set name before (in constructor) or use aContainer::open(const QString& name)
|
virtual |
Opens file. You should set name before (in constructor) or use aContainer::open(const QString& name)
name | - file name |
References cleanupTmpFiles(), close(), createTmpDir(), extractData(), extractManifest(), generateName4TmpDir(), and aLog::print().
|
virtual |
Return real path to specified file.
fname | - container relative filename. |
|
virtual |
Function for save container. File name to save should be setted before call this function in constructor or aContainer::open(const QString& name)
|
virtual |
Saves container. Only files described in manifest will be saved.
name | - File name |
References compressFile(), aCManifest::first(), aCManifest::next(), aLog::print(), and setLastError().
void aContainer::setLastError | ( | const QString & | errorText | ) |
Set last error text.
errorText | - error text. |
Referenced by compressFile(), createTmpDir(), extractData(), extractManifest(), and save().