24#include <tqstringlist.h>
25#include <tqiodevice.h>
26#include <tqvaluestack.h>
27#include <koffice_export.h>
43 enum Mode { Read, Write };
44 enum Backend { Auto, Tar, Zip, Directory };
60 static KoStore* createStore( const TQString& fileName, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
67 static KoStore* createStore( TQIODevice *device, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
89 static KoStore* createStore( TQWidget* window, const KURL& url, Mode mode, const TQCString & appIdentification = "", Backend backend = Auto );
102 bool open( const TQString & name );
122 TQIODevice* device() const;
128 TQByteArray read( unsigned long int max );
134 TQ_LONG write( const TQByteArray& _data );
141 TQ_LONG read( char *_buffer, TQ_ULONG _len );
147 virtual TQ_LONG write( const char* _data, TQ_ULONG _len );
153 TQIODevice::Offset size() const;
158 bool bad() const { return !m_bGood; }
163 Mode mode() const { return m_mode; }
174 bool enterDirectory( const TQString& directory );
181 bool leaveDirectory();
187 TQString currentPath() const;
193 TQString currentDirectory() const;
200 void pushDirectory();
212 bool hasFile( const TQString& fileName ) const;
219 bool addLocalFile( const TQString &fileName, const TQString &destName );
227 TQStringList addLocalDirectory( const TQString &dirPath, const TQString &dest );
235 bool extractFile( const TQString &srcName, const TQString &fileName );
239 bool at( TQIODevice::Offset pos );
240 TQIODevice::Offset at() const;
249 void disallowNameExpansion( void );
259 virtual bool init( Mode mode );
300 virtual bool fileExists( const TQString& absPath ) const = 0;
303 static Backend determineBackend( TQIODevice* dev );
318 TQString toExternalNaming( const TQString & _internalNaming ) const;
323 TQString expandEncodedPath( TQString intern ) const;
329 TQString expandEncodedDirectory( TQString intern ) const;
342 bool enterDirectoryInternal( const TQString& directory );
369 static const int s_area;
Saves and loads KOffice documents using various backends.
virtual bool closeRead()=0
virtual bool openRead(const TQString &name)=0 Open the file name in the store, for reading.
virtual bool closeWrite()=0
virtual bool openWrite(const TQString &name)=0 Open the file name in the store, for writing On success, this method must set m_stream to a stream in...
TQStringList m_currentPath The "current directory" (path)
bool m_bGood Must be set by the constructor.
virtual bool fileExists(const TQString &absPath) const =0 Check if a file exists inside the store.
TQString m_sName Current filename (between an open() and a close())
TQIODevice::Offset m_iSize Current size of the file named m_sName.
virtual bool enterRelativeDirectory(const TQString &dirName)=0 Enter a subdirectory of the current directory.
virtual bool enterAbsoluteDirectory(const TQString &path)=0 Enter a directory where we've been before.
TQValueStack< TQString > m_directoryStack Used to push/pop directories to make it easy to save/restore the state.
TQIODevice * m_stream The stream for the current read or write operation.
TQStringList m_strFiles Store the filenames (with full path inside the archive) when writing, to avoid duplicates.
|