#include <S32FILE.H>
Link against:
estor.lib
class CFileStore : public CPersistentStore;
Description
File based persistent store abstract base class.
The class encapsulates the basic behaviour of file based stores. File based stores are persistent stores, i.e. they have the
ability to keep the external representation of objects for longer than the lifetime of the applications which created those
objects.
The class forms the base for the direct file store, CDirectFileStore
, and the permanent file store, CPermanentFileStore
. In general, it is sufficient for pointers to file based store objects to be of type CFileStore, rather than of the concrete
file store type.
Existing file stores can be opened using the member functions CFileStore::OpenL(RFs &,const TDesC &,TUint)
, CFileStore::OpenLC(RFs &,const TDesC &,TUint)
, CFileStore::FromL(RFile &)
and CFileStore::FromLC(RFile &)
. New file stores, however, must be created using the appropriate member function of the concrete type.
Derivation
CBase
-
Base class for all classes to be instantiated on the heap.
CFileStore
-
File based persistent store abstract base class.
Members
Defined in CFileStore
:
CFileStore(RFile &)
CFileStore(RFileBuf &,const TUidType &)
ChangedL()
CreateL(RFs &,const TDesC &,TUint,TNewFunction)
CreateLC(RFs &,const TDesC &,TUint,TNewFunction)
Destruct()
Detach()
Detaches the file store from its associated file.
DoCommitL()
Commits any changes to the store. For a store that provides atomic updates, this...
DoRevertL()
Discards any pending changes to the store. This includes all changes which have ...
ExternalizeL(RWriteStream &)const
File()const
Gets a reference to the file associated with this file store.
FromL(RFile &)
Constructs a file store object from an opened file.
FromL(RFile &,TFileStoreFactoryFunction)
FromL(RFile &,const TFileStoreFactoryFunction)
FromLC(RFile &)
Constructs a file store object from an opened file, and places the pointer onto ...
FromLC(RFile &,TFileStoreFactoryFunction)
FromLC(RFile &,const TFileStoreFactoryFunction)
Host()const
InternalizeL(RReadStream &)
IsHost(const MStreamBuf *)const
Layout()const
Gets the UID that uniquely identifies the specific type of this file store.
MarshalL()
NewL(RFile &,TNewFunction)
NewLC(RFile &,TNewFunction)
OpenL(RFs &,const TDesC &,TUint)
Opens a file containing a store and constructs an appropriate file store object.
OpenL(RFs &,const TDesC &,TUint,TFileStoreFactoryFunction)
OpenL(RFs &,const TDesC &,TUint,const TFileStoreFactoryFunction)
OpenLC(RFs &,const TDesC &,TUint)
Opens a file containing a store, constructs an appropriate file store object and...
OpenLC(RFs &,const TDesC &,TUint,TFileStoreFactoryFunction)
OpenLC(RFs &,const TDesC &,TUint,const TFileStoreFactoryFunction)
Reattach(RFile &)
Reattaches a file to the file store. The file should be the one that was detache...
RefreshL()
ReplaceL(RFs &,const TDesC &,TUint,TNewFunction)
ReplaceLC(RFs &,const TDesC &,TUint,TNewFunction)
Reset()
Frees the file store’s buffer space.
Reset(TInt)
Frees the file store’s buffer space and changes the size of future buffer s...
SetSizeL(TInt)
SetTypeL(const TUidType &)
Sets the UID type of the file store.
SynchL()
TNewFunction
TempL(RFs &,const TDesC &,TFileName &,TUint,TNewFunction)
TempLC(RFs &,const TDesC &,TFileName &,TUint,TNewFunction)
Type()const
Gets the UID type of the file store.
~CFileStore()
Frees resources owned by the object, prior to its destruction. In particular, it...
Inherited from CBase
:
Inherited from CPersistentStore
:
Inherited from CStreamStore
:
Commit()
Commits changes.
CommitL()
Commit changes and leaves if unsuccessful.
CompactL()
Compacts the store. This returns free space to the appropriate system pool, for ...
Delete(TStreamId)
Deletes the specified stream from this store.
DeleteL(TStreamId)
Deletes the specified stream from this store, leaving if unsuccessful.
ExtendL()
Generates a new stream within this store, and returns its id. This function can ...
ReclaimL()
Reclaims space within a store, returning the total amount of free space availabl...
Revert()
Rolls back the store to its state at the last commit point.
RevertL()
Rolls back the store to its state at the last commit point and leaves if unsucce...
Construction and destruction
IMPORT_C ~CFileStore();
Description
Frees resources owned by the object, prior to its destruction. In particular, it closes the associated file.
NewL(RFile &,TNewFunction)
protected: IMPORT_C static CFileStore* NewL(RFile &aFile, TNewFunction aFunction);
Description
Parameters
Return value
NewLC(RFile &,TNewFunction)
protected: IMPORT_C static CFileStore* NewLC(RFile &aFile, TNewFunction aFunction);
Description
Parameters
Return value
protected: IMPORT_C CFileStore(RFile &aFile);
Description
Parameters
CFileStore(RFileBuf &,const TUidType &)
protected: IMPORT_C CFileStore(RFileBuf &aBuf, const TUidType &aType);
Description
Parameters
OpenL(RFs &,const TDesC &,TUint)
IMPORT_C static CFileStore* OpenL(RFs &aFs, const TDesC &aName, TUint aFileMode);
Description
Opens a file containing a store and constructs an appropriate file store object.
The resulting file store object is of concrete type, i.e. either CDirectFileStore
or CPermanentFileStore
. The specific type is determined from the layout information held in the file store.
Parameters
RFs &aFs |
Handle to a file server session.
|
const TDesC16 &aName |
The full path name of the file containing the store.
|
TUint aFileMode |
The mode in which the file is to be accessed. The mode is defined by the TFileMode type.
|
|
Return value
CFileStore *
|
A pointer to the new file store object.
|
|
See also:
OpenLC(RFs &,const TDesC &,TUint)
IMPORT_C static CFileStore* OpenLC(RFs &aFs, const TDesC &aName, TUint aFileMode);
Description
Opens a file containing a store, constructs an appropriate file store object and places the pointer onto the cleanup stack.
The resulting file store object is of concrete type, i.e. either CDirectFileStore
or CPermanentFileStore
. The specific type is determined from the layout information held in the file store.
Parameters
RFs &aFs |
Handle to a file server session.
|
const TDesC16 &aName |
The full path name of the file containing the store.
|
TUint aFileMode |
The mode in which the file is to be accessed. The mode is defined by the TFileMode type.
|
|
Return value
CFileStore *
|
A pointer to the new file store object.
|
|
See also:
IMPORT_C static CFileStore* FromL(RFile &aFile);
Description
Constructs a file store object from an opened file.
The file must already be open before calling this function.
The resulting file store object is of concrete type, i.e. either CDirectFileStore
or CPermanentFileStore
. The specific type is determined from the layout information held in the file store.
Note that ownership of the file passes to the store. The referenced RFile
is cleared and is no longer valid:
Parameters
RFile &aFile |
A reference to the opened file.
|
|
Return value
CFileStore *
|
A pointer to the new file store object.
|
|
See also:
IMPORT_C static CFileStore* FromLC(RFile &aFile);
Description
Constructs a file store object from an opened file, and places the pointer onto the cleanup stack.
The file must already be open before calling this function.
The resulting file store object is of concrete type, i.e. either CDirectFileStore
or CPermanentFileStore
. The specific type is determined from the layout information held in the file store.
Note that ownership of the file passes to the store. The referenced RFile
is cleared and is no longer valid:
Parameters
RFile &aFile |
A reference to the opened file.
|
|
Return value
CFileStore *
|
A pointer to the new file store object.
|
|
See also:
OpenL(RFs &,const TDesC &,TUint,const TFileStoreFactoryFunction)
IMPORT_C static CFileStore* OpenL(RFs &aFs, const TDesC &aName, TUint aFileMode, const TFileStoreFactoryFunction aFactory[]);
Description
Parameters
RFs &aFs |
|
const TDesC16 &aName |
|
TUint aFileMode |
|
const TFileStoreFactoryFunction aFactory |
|
|
Return value
OpenLC(RFs &,const TDesC &,TUint,const TFileStoreFactoryFunction)
IMPORT_C static CFileStore* OpenLC(RFs &aFs, const TDesC &aName, TUint aFileMode, const TFileStoreFactoryFunction aFactory[]);
Description
Parameters
RFs &aFs |
|
const TDesC16 &aName |
|
TUint aFileMode |
|
const TFileStoreFactoryFunction aFactory |
|
|
Return value
FromL(RFile &,const TFileStoreFactoryFunction)
IMPORT_C static CFileStore* FromL(RFile &aFile, const TFileStoreFactoryFunction aFactory[]);
Description
Parameters
RFile &aFile |
|
const TFileStoreFactoryFunction aFactory |
|
|
Return value
FromLC(RFile &,const TFileStoreFactoryFunction)
IMPORT_C static CFileStore* FromLC(RFile &aFile, const TFileStoreFactoryFunction aFactory[]);
Description
Parameters
RFile &aFile |
|
const TFileStoreFactoryFunction aFactory |
|
|
Return value
inline const TUidType& Type() const;
Description
Gets the UID type of the file store.
Return value
const TUidType & |
The UID type object containing the file store type.
|
|
See also:
TUid
A globally unique 32-bit number.
SetTypeL(const TUidType &)
IMPORT_C void SetTypeL(const TUidType &aType);
Description
Sets the UID type of the file store.
The first UID, i.e. the first TUid
component, of the TUidType
must be the file store type as returned by CFileStore::Layout()const
, otherwise the function raises a STORE-File 9 panic.
Parameters
const TUidType &aType |
The UID type object containing the file store type.
|
|
See also:
TUid
A globally unique 32-bit number.
virtual TUid Layout() const=0;
Description
Gets the UID that uniquely identifies the specific type of this file store.
This function must be defined and implemented by classes derived from CFileStore. The direct file store, CDirectFileStore
and the permanent file store, CPermanentFileStore
both implement suitable functions.
Return value
TUid
|
The UID that uniquely identifies the specific type of file store.
|
|
inline void Reset();
Description
Frees the file store’s buffer space.
The buffer space is automatically re-allocated when needed.
This function should only be used immediately after a successful call to CStreamStore::CommitL()
or CStreamStore::RevertL()
.
See also:
inline void Reset(TInt aSize);
Description
Frees the file store’s buffer space and changes the size of future buffer space allocations.
The buffer space is automatically re-allocated when needed, using the new size value.
This function should only be used immediately after a successful call to CStreamStore::CommitL()
or CStreamStore::RevertL()
.
Parameters
TInt aSize |
The size of future buffer space allocations.
|
|
See also:
inline void Detach();
Description
Detaches the file store from its associated file.
In effect, the file store gives up ownership of the file.
Detaching is useful in cases where a file needs to be closed and later re-opened; for example, to give up a write lock for
backup purposes.
It is very important that the contents of the file should not change while it is detached.
See also:
inline void Reattach(RFile &aFile);
Description
Reattaches a file to the file store. The file should be the one that was detached using the CFileStore::Detach()
function.
Parameters
RFile &aFile |
The file to be associated with this file store.
|
|
See also:
inline RFile& File() const;
Description
Gets a reference to the file associated with this file store.
This function is called prior to detaching the file store.
Return value
RFile & |
A reference to the associated file.
|
|
See also:
IMPORT_C void MarshalL();
Description
OpenL(RFs &,const TDesC &,TUint,TFileStoreFactoryFunction)
protected: IMPORT_C static CFileStore* OpenL(RFs &aFs, const TDesC &aName, TUint aFileMode, TFileStoreFactoryFunction aFunction);
Description
Parameters
RFs &aFs |
|
const TDesC16 &aName |
|
TUint aFileMode |
|
TFileStoreFactoryFunction aFunction |
|
|
Return value
OpenLC(RFs &,const TDesC &,TUint,TFileStoreFactoryFunction)
protected: IMPORT_C static CFileStore* OpenLC(RFs &aFs, const TDesC &aName, TUint aFileMode, TFileStoreFactoryFunction aFunction);
Description
Parameters
RFs &aFs |
|
const TDesC16 &aName |
|
TUint aFileMode |
|
TFileStoreFactoryFunction aFunction |
|
|
Return value
CreateL(RFs &,const TDesC &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* CreateL(RFs &aFs, const TDesC &aName, TUint aFileMode, TNewFunction aFunction);
Description
Parameters
Return value
CreateLC(RFs &,const TDesC &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* CreateLC(RFs &aFs, const TDesC &aName, TUint aFileMode, TNewFunction aFunction);
Description
Parameters
Return value
ReplaceL(RFs &,const TDesC &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* ReplaceL(RFs &aFs, const TDesC &aName, TUint aFileMode, TNewFunction aFunction);
Description
Parameters
Return value
ReplaceLC(RFs &,const TDesC &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* ReplaceLC(RFs &aFs, const TDesC &aName, TUint aFileMode, TNewFunction aFunction);
Description
Parameters
Return value
TempL(RFs &,const TDesC &,TFileName &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* TempL(RFs &aFs, const TDesC &aPath, TFileName &aName, TUint aFileMode, TNewFunction
aFunction);
Description
Parameters
Return value
TempLC(RFs &,const TDesC &,TFileName &,TUint,TNewFunction)
protected: IMPORT_C static CFileStore* TempLC(RFs &aFs, const TDesC &aPath, TFileName &aName, TUint aFileMode, TNewFunction
aFunction);
Description
Parameters
Return value
FromL(RFile &,TFileStoreFactoryFunction)
protected: IMPORT_C static CFileStore* FromL(RFile &aFile, TFileStoreFactoryFunction aFunction);
Description
Parameters
RFile &aFile |
|
TFileStoreFactoryFunction aFunction |
|
|
Return value
FromLC(RFile &,TFileStoreFactoryFunction)
protected: IMPORT_C static CFileStore* FromLC(RFile &aFile, TFileStoreFactoryFunction aFunction);
Description
Parameters
RFile &aFile |
|
TFileStoreFactoryFunction aFunction |
|
|
Return value
protected: IMPORT_C void Destruct();
Description
protected: inline TStreamExchange& Host() const;
Description
Return value
IsHost(const MStreamBuf *)const
protected: inline TBool IsHost(const MStreamBuf *aBuf) const;
Description
Parameters
Return value
protected: IMPORT_C void SynchL();
Description
protected: inline void SetSizeL(TInt aSize);
Description
Parameters
protected: IMPORT_C void ChangedL();
Description
protected: IMPORT_C void RefreshL();
Description
protected: IMPORT_C virtual void DoCommitL();
Description
Commits any changes to the store. For a store that provides atomic updates, this writes all of the pending updates to the
to the permanent storage medium. After committing the store contains all or none of the updates since the last commit/revert.
This function provides the implementation for the public CStreamStore::CommitL()
function.
protected: IMPORT_C virtual void DoRevertL();
Description
Discards any pending changes to the store. This includes all changes which have not been committed to a permanent storage
medium.
This function provides the implementation for the public CStreamStore::Revert()
function.
Note:
The function need only be implemented by stores that provide atomic updates, as revert has no meaning for other implementations.
ExternalizeL(RWriteStream &)const
private: virtual void ExternalizeL(RWriteStream &aStream) const=0;
Description
Parameters
InternalizeL(RReadStream &)
private: virtual void InternalizeL(RReadStream &aStream)=0;
Description
Parameters
protected: typedef CFileStore*(* CFileStore::TNewFunction)(RFile& aFile);
Description