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