1.1 --- a/epoc32/include/s32file.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/s32file.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,487 @@
1.4 -s32file.h
1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#if !defined(__S32FILE_H__)
1.21 +#define __S32FILE_H__
1.22 +#if !defined(__F32FILE_H__)
1.23 +#include <f32file.h>
1.24 +#endif
1.25 +#if !defined(__S32STOR_H__)
1.26 +#include <s32stor.h>
1.27 +#endif
1.28 +
1.29 +#ifndef DEFAULT_FILE_BUF_SIZE
1.30 + #define DEFAULT_FILE_BUF_SIZE 4096
1.31 +#else
1.32 + #if DEFAULT_FILE_BUF_SIZE < 1536
1.33 + #error "DEFAULT_FILE_BUF_SIZE macro value can't be less than 1536"
1.34 + #endif
1.35 +#endif
1.36 +/**
1.37 +The default size of the file buffer.
1.38 +@internalComponent
1.39 +*/
1.40 +const TInt KDefaultFileBufSize=DEFAULT_FILE_BUF_SIZE;
1.41 +
1.42 +template <class T>
1.43 +class TCapture;
1.44 +class RPermanentFileStoreIter;
1.45 +
1.46 +/** A stream buffer hosted by a file.
1.47 + * @publishedAll
1.48 + * @released
1.49 +
1.50 +Instances of this class are used by file based persistent stores, i.e. CFileStore
1.51 +type objects. An RFileBuf object is associated with a file and the file is
1.52 +said to be attached to the stream buffer.
1.53 +
1.54 +An RFileBuf object is also used by RFileReadStream and RFileWriteStream objects
1.55 +to provide buffered file I/O.
1.56 +
1.57 +The stream buffer has intermediate buffering capabilities.
1.58 +
1.59 +When used as the basis for a file store, it hosts multiple streams through
1.60 +the TStreamExchange and RShareBuf classes.
1.61 +
1.62 +Open(), Close(), Attach(), Detach(), File() and Reattach() usage patterns:
1.63 +
1.64 +Pattern 1: RFileBuf owns the file
1.65 +step 1a: Open()/Create()/Temp() is used to connect the buffer to a file
1.66 +step 1b: Use the file buffer
1.67 +step 1c: Close() releases this resource.
1.68 +
1.69 +Pattern 2: RFile is opened elsewhere and ownership is handed over to RFileBuf
1.70 +This may happen if the file is already opened by another API, or from another process for example
1.71 +step 2a: Attach() is used to hand ownership of the opened file to the buffer. After Attach() the supplied file handle is NULLed.
1.72 +step 2b: Use the file buffer
1.73 +step 2c: Close() releases the file resource.
1.74 +
1.75 +Pattern 3: RFileBuf is used transiently to manage an existing opened file:
1.76 +step 3a: Attach() is used to bind the buffer to the already open file. After Attach() the supplied file handle is NULLed.
1.77 +step 3b: Use the file buffer
1.78 +step 3c: RFileBuf::File() is used to retrieve the file handle again, then Detach() is called to disconnect the buffer from the file.
1.79 +At this point, the destruction of the file buffer will have no effect on the file. The retrieved file handle in step 3c must be used to close the file.
1.80 +
1.81 +Pattern 4: Transient direct file access to a buffered file
1.82 +step 4a: RFileBuf::File() is used to retrieve the file handle. [Optional: Detach() is used to disconnect the file buffer]
1.83 +step 4b: Use the file directly. Note that writing to the file may cause coherency problems with the RFileBuf buffer - in which case you need to Reset() the buffer as well.
1.84 +step 4c: [Optional: Reattach() is used to hand the file back to the buffer]. Use of the buffer is resumed
1.85 +
1.86 +@see CFileStore
1.87 +@see RFileReadStream
1.88 +@see RFileWriteStream */
1.89 +class RFileBuf : public TStreamBuf
1.90 + {
1.91 +public:
1.92 + IMPORT_C RFileBuf();
1.93 + IMPORT_C RFileBuf(TInt aSize);
1.94 + RFileBuf(TCapture<RFileBuf> aCapture);
1.95 + IMPORT_C void Reset();
1.96 + inline void Reset(TInt aSize);
1.97 +//
1.98 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.99 + IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.100 + IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.101 + IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.102 + IMPORT_C void Attach(RFile& aFile,TInt aPos=0);
1.103 + IMPORT_C void Close();
1.104 + inline void Detach();
1.105 + inline void Reattach(RFile& aFile);
1.106 +//
1.107 + IMPORT_C void SetSizeL(TInt aSize);
1.108 + inline RFile& File() const;
1.109 +protected:
1.110 + IMPORT_C TInt UnderflowL(TInt aMaxLength);
1.111 + IMPORT_C void OverflowL();
1.112 + IMPORT_C void DoRelease();
1.113 + IMPORT_C void DoSynchL();
1.114 + IMPORT_C TInt DoReadL(TAny* aPtr,TInt aMaxLength);
1.115 + IMPORT_C TInt DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
1.116 + IMPORT_C void DoWriteL(const TAny* aPtr,TInt aLength);
1.117 + IMPORT_C TInt DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus);
1.118 + IMPORT_C TStreamPos DoSeekL(TMark aMark,TStreamLocation aLocation,TInt anOffset);
1.119 +//
1.120 + inline void SetBuf(TRead,TUint8* aPtr,TUint8* anEnd);
1.121 + inline void SetBuf(TWrite,TUint8* aPtr,TUint8* anEnd);
1.122 + inline void SetBuf(TArea anArea,TUint8* aPtr,TUint8* anEnd);
1.123 +private:
1.124 + TUint8* AllocL();
1.125 + void Free();
1.126 +//
1.127 + void SetPos(TMark aMark,TInt aPos);
1.128 + inline void SetPos(TRead,TInt aPos);
1.129 + inline void SetPos(TWrite,TInt aPos);
1.130 + inline TInt Pos(TRead) const;
1.131 + inline TInt Pos(TWrite) const;
1.132 + inline TInt MovePos(TRead,TInt anOffset);
1.133 + inline TInt MovePos(TWrite,TInt anOffset);
1.134 + TInt FileReadL(TAny* aPtr,TInt aMaxLength);
1.135 + void FileWriteL(const TAny* aPtr,TInt aLength,TInt aSeek);
1.136 + void FileWriteL(const TAny* aPtr,TInt aLength);
1.137 + TInt EndL();
1.138 +//
1.139 + inline TInt Lag(TRead) const;
1.140 + inline TInt Lag(TWrite) const;
1.141 + TInt Mark(TMark aMark) const;
1.142 + inline TInt Mark(TRead) const;
1.143 + inline TInt Mark(TWrite) const;
1.144 + inline TUint8* Limit(TWrite) const;
1.145 + inline void SetLimit(TWrite,TUint8* aLimit);
1.146 + inline TInt Span(TWrite) const;
1.147 + inline TInt Reach(TWrite) const;
1.148 +private:
1.149 + TUint8* iBase;
1.150 + TInt iSize;
1.151 + __MUTABLE RFile iFile;
1.152 + TInt iRPos;
1.153 + TInt iWPos;
1.154 + TInt iExt;
1.155 + TUint8* iWLim;
1.156 + friend class CFileStore;
1.157 + };
1.158 +
1.159 +/**
1.160 + * @publishedAll
1.161 + * @released
1.162 + * Supports the reading of a stream from a file.
1.163 + */
1.164 +class RFileReadStream : public RReadStream
1.165 + {
1.166 +public:
1.167 + /** Constructs an empty read stream object. */
1.168 + RFileReadStream() {}
1.169 + IMPORT_C RFileReadStream(RFile& aFile,TInt aPos=0);
1.170 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.171 + IMPORT_C void Attach(RFile& aFile,TInt aPos=0);
1.172 +private:
1.173 + RFileBuf iSource;
1.174 + };
1.175 +
1.176 +/**
1.177 + * @publishedAll
1.178 + * @released
1.179 + * Supports the writing of a stream to a file.
1.180 + */
1.181 +class RFileWriteStream : public RWriteStream
1.182 + {
1.183 +public:
1.184 + /** Constructs an empty write stream object. */
1.185 + RFileWriteStream() {}
1.186 + inline RFileWriteStream(const MExternalizer<TStreamRef>& anExter);
1.187 + IMPORT_C RFileWriteStream(RFile& aFile,TInt aPos=0);
1.188 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.189 + IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.190 + IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.191 + IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.192 + IMPORT_C void Attach(RFile& aFile,TInt aPos=0);
1.193 +private:
1.194 + RFileBuf iSink;
1.195 + };
1.196 +//
1.197 +class CFileStore;
1.198 +
1.199 +/**
1.200 + * @publishedAll
1.201 + * @released
1.202 + * A class containing a set of factory functions for opening an existing direct
1.203 + file store and an existing permanent file store identified using a Uidtype.
1.204 + */
1.205 +class FileStoreFactory
1.206 + {
1.207 +public:
1.208 + IMPORT_C static CFileStore* DirectLC(RFileBuf& aBuf,const TUidType& aType);
1.209 + IMPORT_C static CFileStore* PermanentLC(RFileBuf& aBuf,const TUidType& aType);
1.210 + };
1.211 +//
1.212 +const TInt KDirectFileStoreLayoutUidValue=268435511;
1.213 +/** The value of the KPermanentFileStoreLayoutUidValue UID. */
1.214 +const TInt KPermanentFileStoreLayoutUidValue=268435536;
1.215 +/** The UID that identifies a file store as being a direct file store. */
1.216 +const TUid KDirectFileStoreLayoutUid={KDirectFileStoreLayoutUidValue};
1.217 +/** The UID that identifies a file store as being a permanent file store. */
1.218 +const TUid KPermanentFileStoreLayoutUid={KPermanentFileStoreLayoutUidValue};
1.219 +//
1.220 +typedef CFileStore* (*TFileStoreFactoryFunction)(RFileBuf& aBuf,const TUidType& aType);
1.221 +//
1.222 +#define KDirectFileStoreFactoryFunction (&FileStoreFactory::DirectLC)
1.223 +#define KPermanentFileStoreFactoryFunction (&FileStoreFactory::PermanentLC)
1.224 +
1.225 +/**
1.226 + * @publishedAll
1.227 + * @released
1.228 + * File based persistent store abstract base class.
1.229 +
1.230 +The class encapsulates the basic behaviour of file based stores. File based
1.231 +stores are persistent stores, i.e. they have the ability to keep the external
1.232 +representation of objects for longer than the lifetime of the applications
1.233 +which created those objects.
1.234 +
1.235 +The class forms the base for the direct file store, CDirectFileStore, and
1.236 +the permanent file store, CPermanentFileStore. In general, it is sufficient
1.237 +for pointers to file based store objects to be of type CFileStore, rather
1.238 +than of the concrete file store type.
1.239 +
1.240 +Existing file stores can be opened using the member functions OpenL(), OpenLC(),
1.241 +FromL() and FromLC(). New file stores, however, must be created using the
1.242 +appropriate member function of the concrete type.
1.243 +*/
1.244 +class CFileStore : public CPersistentStore
1.245 + {
1.246 +public:
1.247 + IMPORT_C static CFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.248 + IMPORT_C static CFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.249 + IMPORT_C static CFileStore* FromL(RFile& aFile);
1.250 + IMPORT_C static CFileStore* FromLC(RFile& aFile);
1.251 +//
1.252 + IMPORT_C static CFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]);
1.253 + IMPORT_C static CFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]);
1.254 + IMPORT_C static CFileStore* FromL(RFile& aFile,const TFileStoreFactoryFunction aFactory[]);
1.255 + IMPORT_C static CFileStore* FromLC(RFile& aFile,const TFileStoreFactoryFunction aFactory[]);
1.256 +//
1.257 + inline const TUidType& Type() const;
1.258 + IMPORT_C void SetTypeL(const TUidType& aType);
1.259 + /** Gets the UID that uniquely identifies the specific type of this file store.
1.260 +
1.261 + This function must be defined and implemented by classes derived from CFileStore.
1.262 + The direct file store, CDirectFileStore and the permanent file store, CPermanentFileStore
1.263 + both implement suitable functions.
1.264 +
1.265 + @return The UID that uniquely identifies the specific type of file store.
1.266 + @see KDirectFileStoreLayoutUid
1.267 + @see KPermanentFileStoreLayoutUid */
1.268 + virtual TUid Layout() const=0;
1.269 +//
1.270 + inline void Reset();
1.271 + inline void Reset(TInt aSize);
1.272 + inline void Detach();
1.273 + inline void Reattach(RFile& aFile);
1.274 + inline RFile& File() const;
1.275 +//
1.276 + IMPORT_C void MarshalL();
1.277 + IMPORT_C ~CFileStore();
1.278 +protected:
1.279 + typedef CFileStore* (*TNewFunction)(RFile& aFile);
1.280 +protected:
1.281 + IMPORT_C static CFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction);
1.282 + IMPORT_C static CFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction);
1.283 + IMPORT_C static CFileStore* CreateL(RFs& aFs,const TDesC& aName,TUint aFileMode,TNewFunction aFunction);
1.284 + IMPORT_C static CFileStore* CreateLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TNewFunction aFunction);
1.285 + IMPORT_C static CFileStore* ReplaceL(RFs& aFs,const TDesC& aName,TUint aFileMode,TNewFunction aFunction);
1.286 + IMPORT_C static CFileStore* ReplaceLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TNewFunction aFunction);
1.287 + IMPORT_C static CFileStore* TempL(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode,TNewFunction aFunction);
1.288 + IMPORT_C static CFileStore* TempLC(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode,TNewFunction aFunction);
1.289 +//
1.290 + IMPORT_C static CFileStore* FromL(RFile& aFile,TFileStoreFactoryFunction aFunction);
1.291 + IMPORT_C static CFileStore* FromLC(RFile& aFile,TFileStoreFactoryFunction aFunction);
1.292 + IMPORT_C static CFileStore* NewL(RFile& aFile,TNewFunction aFunction);
1.293 + IMPORT_C static CFileStore* NewLC(RFile& aFile,TNewFunction aFunction);
1.294 +//
1.295 + IMPORT_C CFileStore(RFile& aFile);
1.296 + IMPORT_C CFileStore(RFileBuf& aBuf,const TUidType& aType);
1.297 + IMPORT_C void Destruct();
1.298 +//
1.299 + inline TStreamExchange& Host() const;
1.300 + inline TBool IsHost(const MStreamBuf* aBuf) const;
1.301 + IMPORT_C void SynchL();
1.302 + inline void SetSizeL(TInt aSize);
1.303 + IMPORT_C void ChangedL();
1.304 + IMPORT_C void RefreshL();
1.305 +//
1.306 + IMPORT_C void DoCommitL();
1.307 + IMPORT_C void DoRevertL();
1.308 +private:
1.309 + virtual void ExternalizeL(RWriteStream& aStream) const=0;
1.310 + virtual void InternalizeL(RReadStream& aStream)=0;
1.311 +//
1.312 + static CFileStore* DoNewL(RFile& aFile,TNewFunction aFunction);
1.313 +private:
1.314 + RFileBuf iBuf;
1.315 + TUidType iType;
1.316 + __MUTABLE TStreamExchange iHost;
1.317 + };
1.318 +const TInt KFileStoreStartOffset=sizeof(TCheckedUid);
1.319 +#if defined(__NO_CLASS_CONSTS__)
1.320 +#define KFileStoreStart TStreamPos(KFileStoreStartOffset)
1.321 +#else
1.322 +const TStreamPos KFileStoreStart=TStreamPos(KFileStoreStartOffset);
1.323 +#endif
1.324 +
1.325 +/**
1.326 + * @publishedAll
1.327 + * @released
1.328 + * Direct file store.
1.329 +
1.330 +A direct file store implements a subset of the operations defined by the store
1.331 +abstract framework. Direct file stores allow streams to be created and objects
1.332 +externalised to them however once the streams have been committed and
1.333 +closed, they cannot subsequently be changed, i.e. streams cannot be replaced,
1.334 +deleted, extended or changed in any way.
1.335 +*/
1.336 +class CDirectFileStore : public CFileStore
1.337 + {
1.338 +public:
1.339 + inline static CDirectFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.340 + inline static CDirectFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.341 + inline static CDirectFileStore* CreateL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.342 + inline static CDirectFileStore* CreateLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.343 + inline static CDirectFileStore* ReplaceL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.344 + inline static CDirectFileStore* ReplaceLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.345 + inline static CDirectFileStore* TempL(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.346 + inline static CDirectFileStore* TempLC(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.347 +//
1.348 + inline static CDirectFileStore* FromL(RFile& aFile);
1.349 + inline static CDirectFileStore* FromLC(RFile& aFile);
1.350 + inline static CDirectFileStore* NewL(RFile& aFile);
1.351 + inline static CDirectFileStore* NewLC(RFile& aFile);
1.352 +//
1.353 + IMPORT_C TUid Layout() const;
1.354 +//
1.355 + IMPORT_C CDirectFileStore(RFile& aFile);
1.356 + IMPORT_C CDirectFileStore(RFileBuf& aBuf,const TUidType& aType);
1.357 +protected:
1.358 + IMPORT_C MStreamBuf* DoReadL(TStreamId anId) const;
1.359 + IMPORT_C MStreamBuf* DoCreateL(TStreamId& anId);
1.360 +private:
1.361 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.362 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.363 + IMPORT_C void DoSetRootL(TStreamId anId);
1.364 +//
1.365 + IMPORT_C static CFileStore* DoNewL(RFile& aFile);
1.366 + };
1.367 +//
1.368 +class CPermanentStoreCoord;
1.369 +
1.370 +/**
1.371 + * @publishedAll
1.372 + * @released
1.373 + * Permanent file store.
1.374 +
1.375 +This type of store supports full manipulation of store contents. Existing
1.376 +streams within this type of store can be changed.
1.377 + */
1.378 +class CPermanentFileStore : public CFileStore
1.379 + {
1.380 + friend class RPermanentFileStoreIter;
1.381 +public:
1.382 + inline static CPermanentFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.383 + inline static CPermanentFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.384 + inline static CPermanentFileStore* CreateL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.385 + inline static CPermanentFileStore* CreateLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.386 + inline static CPermanentFileStore* ReplaceL(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.387 + inline static CPermanentFileStore* ReplaceLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.388 + inline static CPermanentFileStore* TempL(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.389 + inline static CPermanentFileStore* TempLC(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.390 +//
1.391 + inline static CPermanentFileStore* FromL(RFile& aFile);
1.392 + inline static CPermanentFileStore* FromLC(RFile& aFile);
1.393 + inline static CPermanentFileStore* NewL(RFile& aFile);
1.394 + inline static CPermanentFileStore* NewLC(RFile& aFile);
1.395 +//
1.396 + IMPORT_C TUid Layout() const;
1.397 +//
1.398 + IMPORT_C CPermanentFileStore(RFile& aFile);
1.399 + IMPORT_C CPermanentFileStore(RFileBuf& aBuf,const TUidType& aType);
1.400 + IMPORT_C void MarshalL();
1.401 + IMPORT_C ~CPermanentFileStore();
1.402 +protected:
1.403 + IMPORT_C MStreamBuf* DoReadL(TStreamId anId) const;
1.404 + IMPORT_C MStreamBuf* DoCreateL(TStreamId& anId);
1.405 + IMPORT_C MStreamBuf* DoWriteL(TStreamId anId);
1.406 + IMPORT_C MStreamBuf* DoReplaceL(TStreamId anId);
1.407 +private:
1.408 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.409 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.410 + IMPORT_C void DoSetRootL(TStreamId anId);
1.411 + IMPORT_C TStreamId DoExtendL();
1.412 + IMPORT_C void DoDeleteL(TStreamId anId);
1.413 + IMPORT_C void DoCommitL();
1.414 + IMPORT_C void DoRevertL();
1.415 + IMPORT_C MIncrementalCollector* DoReclaimL();
1.416 + IMPORT_C MIncrementalCollector* DoCompactL();
1.417 +//
1.418 + inline CPermanentStoreCoord& Coord() const;
1.419 + CPermanentStoreCoord& CoordL() const;
1.420 + CPermanentStoreCoord& TrimL();
1.421 +//
1.422 + IMPORT_C static CFileStore* DoNewL(RFile& aFile);
1.423 +private:
1.424 + __MUTABLE CPermanentStoreCoord* iCoord;
1.425 + };
1.426 +
1.427 +/**
1.428 + * @publishedAll
1.429 + * @released
1.430 + * File based dictionary store.
1.431 +
1.432 +A dictionary store is a store where a stream is accessed by UID, rather than
1.433 +directly by stream ID. A dictionary store contains streams in the usual way
1.434 +but, in addition, the root stream is a stream dictionary, i.e. a CStreamDictionary
1.435 +type.
1.436 +*/
1.437 +class CDictionaryFileStore : public CDictionaryStore
1.438 + {
1.439 +public:
1.440 + IMPORT_C static CDictionaryFileStore* SystemL(RFs& aFs);
1.441 + IMPORT_C static CDictionaryFileStore* SystemLC(RFs& aFs);
1.442 + IMPORT_C static CDictionaryFileStore* OpenL(RFs& aFs,const TDesC& aName,TUid aUid3);
1.443 + IMPORT_C static CDictionaryFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUid aUid3);
1.444 +private:
1.445 + void ConstructL(RFs& aFs,const TDesC& aName,TUid aUid3);
1.446 + void CreateStoreL(RFile& aFile,const TUidType& aType);
1.447 + };
1.448 +
1.449 +/**
1.450 + * @publishedAll
1.451 + * @released
1.452 + * Uses a file directly to implement the page pool interface MPagePool.
1.453 +
1.454 +The pages are written sequentially through the file. You should call Close()
1.455 +to release the file resource after CreateL(), OpenL(), ReplaceL() or Temp().
1.456 +
1.457 +A file page pool uses a cache to store pages in-memory and to cache frequently
1.458 +accessed pages. You should provide a cache object (CPageCache) to the pool
1.459 +for this purpose.
1.460 +
1.461 +@see CPageCache
1.462 +@see RFile
1.463 +*/
1.464 +class RFilePagePool : public TCachePagePool
1.465 + {
1.466 +public:
1.467 + IMPORT_C RFilePagePool();
1.468 + IMPORT_C RFilePagePool(CPageCache& aCache);
1.469 +//
1.470 + inline TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.471 + inline TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.472 + inline TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.473 + inline TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.474 + inline void Attach(RFile& aFile);
1.475 + IMPORT_C void Close();
1.476 + IMPORT_C void Release();
1.477 + IMPORT_C TInt Flush();
1.478 + IMPORT_C void FlushL();
1.479 + inline void Detach();
1.480 +//
1.481 + inline RFile& File() const;
1.482 +protected:
1.483 + IMPORT_C TPageRef ExtendL(const TAny* aPage,TPageReclamation aReclamation);
1.484 + IMPORT_C void WriteL(TPageRef aRef,const TAny* aPage,TPageChange aChange);
1.485 + IMPORT_C void ReadL(TPageRef aRef,TAny* aPage);
1.486 +private:
1.487 + __MUTABLE RFile iFile;
1.488 + };
1.489 +
1.490 +#include <s32file.inl>
1.491 +#endif