lib
KoStore Class Reference
#include <KoStore.h>
Inheritance diagram for KoStore:

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.
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) |
void | disallowNameExpansion (void) |
bool | at (QIODevice::Offset pos) |
QIODevice::Offset | at () const |
bool | atEnd () const |
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 | |
KoStore () | |
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 |
Constructor & Destructor Documentation
|
Destroys the store (i.e. closes the file on the hard disk) Definition at line 184 of file KoStore.cpp. |
Member Function Documentation
|
Imports a local directory.
Definition at line 492 of file KoStore.cpp. |
|
Imports a local file into a store.
Definition at line 430 of file KoStore.cpp. |
|
See QIODevice.
Definition at line 527 of file KoStore.cpp. |
|
|
|
Close the file inside the store.
Definition at line 243 of file KoStore.cpp. |
|
Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Open a store (i.e. the representation on disk of a KOffice document).
Definition at line 121 of file KoStore.cpp. |
|
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.cpp. |
|
Open a store (i.e. the representation on disk of a KOffice document).
Definition at line 59 of file KoStore.cpp. |
|
Returns the current directory. Note: Returns a path in "internal name" style Definition at line 401 of file KoStore.cpp. |
|
Returns the current path including a trailing slash. Note: Returns a path in "internal name" style Definition at line 406 of file KoStore.cpp. |
|
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.cpp. |
|
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.cpp. |
|
Enter a directory where we've been before. It is guaranteed to always exist. Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
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.cpp. |
|
Enter a subdirectory of the current directory. The directory might not exist yet in Write mode. Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Extracts a file out of the store.
Definition at line 463 of file KoStore.cpp. |
|
Check if a file exists inside the store.
Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Definition at line 626 of file KoStore.cpp. |
|
Init store - called by constructor.
Reimplemented in KoDirectoryStore, and KoTarStore. Definition at line 172 of file KoStore.cpp. |
|
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.cpp. |
|
Leaves a directory. Equivalent to "cd .."
Definition at line 391 of file KoStore.cpp. |
|
|
|
Open a new file inside the store.
Definition at line 189 of file KoStore.cpp. |
|
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.
Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Open the file
Implemented in KoDirectoryStore, KoTarStore, and KoZipStore. |
|
Restores the previously pushed directory. No-op if the stack is empty. Definition at line 423 of file KoStore.cpp. |
|
Stacks the current directory. Restore the current path using popDirectory . Definition at line 418 of file KoStore.cpp. |
|
Read data from the currently opened file. You can also use the streams for this.
Definition at line 314 of file KoStore.cpp. |
|
Read data from the currently opened file. You can also use the streams for this. Definition at line 271 of file KoStore.cpp. |
|
Definition at line 360 of file KoStore.cpp. |
|
Write data into the currently opened file. You can also use the streams for this. Reimplemented in KoZipStore. Definition at line 338 of file KoStore.cpp. |
|
Write data into the currently opened file. You can also use the streams for this. Definition at line 309 of file KoStore.cpp. |
Member Data Documentation
|
Must be set by the constructor.
|
|
The "current directory" (path).
|
|
Used to push/pop directories to make it easy to save/restore the state.
|
|
Current size of the file named m_sName.
|
|
Current filename (between an open() and a close()).
|
|
The stream for the current read or write operation.
|
|
Store the filenames (with full path inside the archive) when writing, to avoid duplicates.
|
The documentation for this class was generated from the following files: