KoStore Class Reference
Saves and loads KOffice documents using various backends. More...
#include <koStore.h>
Public Types | |
enum | Mode { Read, Write } |
enum | Backend { Auto, Tar, Zip, Directory } |
Public Member Functions | |
virtual | ~KoStore () |
bool | open (const QString &name) |
bool | isOpen () const |
bool | close () |
QIODevice * | device () const |
QByteArray | read (long unsigned int max) |
Q_LONG | write (const QByteArray &_data) |
Q_LONG | read (char *_buffer, Q_ULONG _len) |
virtual Q_LONG | write (const char *_data, Q_ULONG _len) |
QIODevice::Offset | size () const |
bool | bad () const |
Mode | mode () const |
bool | enterDirectory (const QString &directory) |
bool | leaveDirectory () |
QString | currentPath () const |
void | pushDirectory () |
void | popDirectory () |
bool | addLocalFile (const QString &fileName, const QString &destName) |
QStringList | addLocalDirectory (const QString &dirPath, const QString &dest) |
bool | extractFile (const QString &srcName, const QString &fileName) |
bool | at (QIODevice::Offset pos) |
QIODevice::Offset | at () const |
bool | atEnd () const |
Static Public Member Functions | |
KoStore * | createStore (const QString &fileName, Mode mode, const QCString &appIdentification="", Backend backend=Auto) |
KoStore * | createStore (QIODevice *device, Mode mode, const QCString &appIdentification="", Backend backend=Auto) |
Protected Member Functions | |
virtual bool | init (Mode mode) |
virtual bool | openWrite (const QString &name)=0 |
virtual bool | openRead (const QString &name)=0 |
virtual bool | closeRead ()=0 |
virtual bool | closeWrite ()=0 |
virtual bool | enterRelativeDirectory (const QString &dirName)=0 |
virtual bool | enterAbsoluteDirectory (const QString &path)=0 |
virtual bool | fileExists (const QString &absPath)=0 |
Protected Attributes | |
Mode | m_mode |
QStringList | m_strFiles |
QStringList | m_currentPath |
QValueStack< QString > | m_directoryStack |
QString | m_sName |
QIODevice::Offset | m_iSize |
QIODevice * | m_stream |
bool | m_bIsOpen |
bool | m_bGood |
Static Protected Attributes | |
const int | s_area = 30002 |
Detailed Description
Saves and loads KOffice documents using various backends.Currently supported backends are ZIP, tar and directory. We call a "store" the file on the hard disk (the one the users sees) and call a "file" a file inside the store.
Definition at line 35 of file koStore.h.
Constructor & Destructor Documentation
|
Destroys the store (i.e. closes the file on the hard disk) Definition at line 133 of file koStore.cc. References m_stream. |
Member Function Documentation
|
Open a store (i.e. the representation on disk of a KOffice document).
Definition at line 54 of file koStore.cc. Referenced by KoDocument::loadNativeFormat(), and KoDocument::saveNativeFormat(). |
|
Create a store for any kind of iodevice: file, memory buffer... This method doesn't support the Directory store! Definition at line 88 of file koStore.cc. |
|
Open a new file inside the store.
Definition at line 138 of file koStore.cc. References m_iSize, m_sName, m_strFiles, openRead(), and openWrite(). Referenced by addLocalFile(), extractFile(), KoDocument::loadFromStore(), KoDocument::loadNativeFormat(), KoPictureCollection::readFromStore(), KoDocument::saveNativeFormat(), and KoDocument::saveToStore(). |
|
Allows to check for an open storage.
Definition at line 187 of file koStore.cc. |
|
Close the file inside the store.
Definition at line 192 of file koStore.cc. References closeRead(), closeWrite(), and m_stream. Referenced by addLocalFile(), extractFile(), KoDocument::loadFromStore(), KoDocument::loadNativeFormat(), KoPictureCollection::readFromStore(), KoDocument::saveNativeFormat(), and KoDocument::saveToStore(). |
|
Get a device for reading a file from the store directly (slightly faster than read() calls) You need to call open first, and close afterwards.
Definition at line 211 of file koStore.cc. References m_stream. Referenced by KoDocument::loadFromStore(), and KoDocument::loadNativeFormat(). |
|
Read data from the currently opened file. You can also use the streams for this. Referenced by extractFile(). |
|
Write data into the currently opened file. You can also use the streams for this. Definition at line 258 of file koStore.cc. Referenced by addLocalFile(). |
|
Read data from the currently opened file. You can also use the streams for this.
Definition at line 263 of file koStore.cc. |
|
Write data into the currently opened file. You can also use the streams for this. Definition at line 287 of file koStore.cc. |
|
Definition at line 309 of file koStore.cc. References m_iSize. Referenced by addLocalFile(), and extractFile(). |
|
Definition at line 129 of file koStore.h. References m_bGood. Referenced by KoDocument::loadNativeFormat(), and KoDocument::saveNativeFormat(). |
|
Definition at line 134 of file koStore.h. Referenced by KoFilterChain::storageFile(). |
|
Enters one or multiple directories. In Read mode this actually checks whether the specified directories exist and returns false if they don't. In Write mode we don't create the directory, we just use the "current directory" to generate the absolute path if you pass a relative path (one not starting with tar:/) when opening a stream. Note: Operates on internal names Definition at line 324 of file koStore.cc. Referenced by KoDocument::loadFromStore(), popDirectory(), and KoDocument::saveToStore(). |
|
Leaves a directory. Equivalent to "cd .."
Definition at line 340 of file koStore.cc. References currentPath(), enterAbsoluteDirectory(), and m_currentPath. |
|
Returns the current path including a trailing slash. Note: Returns a path in "internal name" style Definition at line 350 of file koStore.cc. References m_currentPath. Referenced by leaveDirectory(), and pushDirectory(). |
|
Stacks the current directory. Restore the current path using popDirectory . Definition at line 362 of file koStore.cc. References currentPath(), and m_directoryStack. Referenced by KoDocument::loadFromStore(), and KoDocument::saveToStore(). |
|
Restores the previously pushed directory. No-op if the stack is empty. Definition at line 367 of file koStore.cc. References enterAbsoluteDirectory(), enterDirectory(), m_currentPath, and m_directoryStack. Referenced by KoDocument::loadFromStore(), and KoDocument::saveToStore(). |
|
Imports a local file into a store.
Definition at line 374 of file koStore.cc. References close(), open(), size(), and write(). Referenced by addLocalDirectory(). |
|
Imports a local directory.
Definition at line 436 of file koStore.cc. References addLocalFile(). |
|
Extracts a file out of the store.
Definition at line 407 of file koStore.cc. |
|
See QIODevice.
Definition at line 471 of file koStore.cc. References m_stream. |
|
See QIODevice.
Definition at line 476 of file koStore.cc. References m_stream. |
|
See QIODevice.
Definition at line 481 of file koStore.cc. References m_stream. |
|
Init store - called by constructor.
Definition at line 121 of file koStore.cc. References m_stream. |
|
Open the file
Referenced by open(). |
|
Open the file On success, this method must set m_stream to a stream from which we can read, as well as setting m_iSize to the size of the file.
Referenced by open(). |
|
Referenced by close(). |
|
Referenced by close(). |
|
Enter a subdirectory of the current directory. The directory might not exist yet in Write mode. |
|
Enter a directory where we've been before. It is guaranteed to always exist. Referenced by leaveDirectory(), and popDirectory(). |
Member Data Documentation
|
Store the filenames (with full path inside the archive) when writing, to avoid duplicates.
Definition at line 296 of file koStore.h. Referenced by open(). |
|
The "current directory" (path).
Definition at line 299 of file koStore.h. Referenced by currentPath(), leaveDirectory(), and popDirectory(). |
|
Used to push/pop directories to make it easy to save/restore the state.
Definition at line 302 of file koStore.h. Referenced by popDirectory(), and pushDirectory(). |
|
Current filename (between an open() and a close()).
Definition at line 305 of file koStore.h. Referenced by open(). |
|
Current size of the file named m_sName.
|
|
The stream for the current read or write operation.
Definition at line 310 of file koStore.h. Referenced by at(), atEnd(), close(), device(), init(), read(), write(), and ~KoStore(). |
|
Must be set by the constructor.
Definition at line 314 of file koStore.h. Referenced by bad(). |
The documentation for this class was generated from the following files: