KoStore Class Reference
Saves and loads KOffice documents using various backends. More...
#include <koStore.h>
Inheritance diagram for KoStore:


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 (unsigned long 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 |
QString | currentDirectory () const |
void | pushDirectory () |
void | popDirectory () |
bool | hasFile (const QString &fileName) const |
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 |
void | disallowNameExpansion (void) |
Static Public Member Functions | |
static KoStore * | createStore (const QString &fileName, Mode mode, const QCString &appIdentification="", Backend backend=Auto) |
static KoStore * | createStore (QIODevice *device, Mode mode, const QCString &appIdentification="", Backend backend=Auto) |
static KoStore * | createStore (QWidget *window, const KURL &url, 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) const =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 | |
static 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 40 of file koStore.h.
Constructor & Destructor Documentation
|
Destroys the store (i.e. closes the file on the hard disk) Definition at line 184 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 59 of file koStore.cc. Referenced by createStore(), and KoDocument::saveNativeFormat(). |
|
Create a store for any kind of QIODevice: file, memory buffer. .. KoStore will take care of opening the QIODevice. This method doesn't support the Directory store! Definition at line 93 of file koStore.cc. |
|
Open a store (i.e. the representation on disk of a KOffice document).
Definition at line 121 of file koStore.cc. References createStore(). |
|
Open a new file inside the store.
Definition at line 189 of file koStore.cc. References m_iSize, m_sName, m_strFiles, openRead(), and openWrite(). Referenced by addLocalFile(), KoOasisStore::closeManifestWriter(), KoOasisStore::contentWriter(), extractFile(), KoOasisStore::loadAndParse(), KoDocument::loadFromStore(), KoPictureCollection::readFromStore(), KoDocument::saveNativeFormat(), and KoDocument::saveToStore(). |
|
Check whether a file inside the store is currently opened with open(), ready to be read or written.
Definition at line 238 of file koStore.cc. |
|
Close the file inside the store.
Definition at line 243 of file koStore.cc. References closeRead(), closeWrite(), and m_stream. Referenced by addLocalFile(), KoOasisStore::closeContentWriter(), KoOasisStore::closeManifestWriter(), extractFile(), KoOasisStore::loadAndParse(), KoDocument::loadFromStore(), KoPictureCollection::readFromStore(), and KoDocument::saveNativeFormat(). |
|
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 262 of file koStore.cc. References m_stream. Referenced by KoOasisStore::loadAndParse(), and KoDocument::loadFromStore(). |
|
Read data from the currently opened file. You can also use the streams for this. Definition at line 271 of file koStore.cc. References m_iSize, and m_stream. Referenced by extractFile(). |
|
Write data into the currently opened file. You can also use the streams for this. Definition at line 309 of file koStore.cc. Referenced by addLocalFile(), and KoOasisStore::closeManifestWriter(). |
|
Read data from the currently opened file. You can also use the streams for this.
Definition at line 314 of file koStore.cc. |
|
Write data into the currently opened file. You can also use the streams for this. Definition at line 338 of file koStore.cc. |
|
Definition at line 360 of file koStore.cc. References m_iSize. Referenced by addLocalFile(), and extractFile(). |
|
Definition at line 159 of file koStore.h. Referenced by KoDocument::saveNativeFormat(). |
|
Definition at line 164 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 375 of file koStore.cc. Referenced by KoDocument::loadFromStore(), popDirectory(), and KoDocument::saveToStore(). |
|
Leaves a directory. Equivalent to "cd .."
Definition at line 391 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 406 of file koStore.cc. References m_currentPath. Referenced by currentDirectory(), hasFile(), leaveDirectory(), and pushDirectory(). |
|
Returns the current directory. Note: Returns a path in "internal name" style Definition at line 401 of file koStore.cc. References currentPath(). Referenced by KoDocumentChild::loadOasisDocument(). |
|
Stacks the current directory. Restore the current path using popDirectory . Definition at line 418 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 423 of file koStore.cc. References enterAbsoluteDirectory(), enterDirectory(), m_currentPath, and m_directoryStack. Referenced by KoDocument::loadFromStore(), and KoDocument::saveToStore(). |
|
Definition at line 626 of file koStore.cc. References currentPath(), and fileExists(). Referenced by KoDocument::loadOasisFromStore(). |
|
Imports a local file into a store.
Definition at line 430 of file koStore.cc. References close(), open(), size(), and write(). Referenced by addLocalDirectory(). |
|
Imports a local directory.
Definition at line 492 of file koStore.cc. References addLocalFile(). |
|
Extracts a file out of the store.
Definition at line 463 of file koStore.cc. |
|
See QIODevice.
Definition at line 527 of file koStore.cc. References at(), and m_stream. Referenced by at(). |
|
Do not expand file and directory names Useful when using KoStore on non-KOffice files. (This method should be called just after the constructor) Definition at line 621 of file koStore.cc. Referenced by KoDocument::saveNativeFormat(). |
|
Init store - called by constructor.
Definition at line 172 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(). |
|
Check if a file exists inside the store.
Referenced by hasFile(). |
Member Data Documentation
|
Store the filenames (with full path inside the archive) when writing, to avoid duplicates.
Definition at line 350 of file koStore.h. Referenced by open(). |
|
The "current directory" (path).
Definition at line 353 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 356 of file koStore.h. Referenced by popDirectory(), and pushDirectory(). |
|
Current filename (between an open() and a close()).
Definition at line 359 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 364 of file koStore.h. Referenced by at(), close(), device(), init(), read(), write(), and ~KoStore(). |
|
Must be set by the constructor.
|
The documentation for this class was generated from the following files: