Location:
s32file.h
Link against: estor.lib
CFileStore
Supported from 5.0
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
OpenL()
, OpenLC()
, FromL()
and
FromLC()
. New file stores, however, must be created using the
appropriate member function of the concrete type.
|
Defined in CFileStore
:
Detach()
, File()
, FromL()
, FromLC()
, Layout()
, OpenL()
, OpenLC()
, Reattach()
, Reset()
, SetTypeL()
, Type()
, ~CFileStore()
Inherited from CBase
:
operator new()
Inherited from CPersistentStore
:
Root()
,
SetRootL()
Inherited from CStreamStore
:
Commit()
,
CommitL()
,
CompactL()
,
Delete()
,
DeleteL()
,
DoCommitL()
,
DoCompactL()
,
DoCreateL()
,
DoDeleteL()
,
DoReadL()
,
DoReclaimL()
,
DoReplaceL()
,
DoRevertL()
,
DoWriteL()
,
ExtendL()
,
ReclaimL()
,
Revert()
,
RevertL()
static CFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode);
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.
|
|
|
static CFileStore* OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]);
Opens a file containing a store, using the specified set of factory functions and constructs a file store object.
The function invokes each factory function, in turn, until an attempt to construct a file store object is successful. The file store type is determined by the layout information held in the file store and assumes that one of the supplied factory functions is capable of opening that type.
|
|
|
static CFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode);
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.
|
|
|
static CFileStore* OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[]);
Opens a file containing a store, using the specified set of factory functions, and constructs a file store object placing a pointer onto the cleanup stack.
The function invokes each factory function, in turn, until an attempt to construct a file store object is successful. The file store type is determined by the layout information held in the file store and assumes that one of the supplied factory functions is capable of opening that type.
|
|
|
static CFileStore* FromL(RFile& aFile);
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:
|
|
|
static CFileStore* FromL(RFile& aFile,const TFileStoreFactoryFunction aFactory[]);
Constructs a file store object from an opened file, using the specified set of factory functions.
The file must already be open before calling this function.
The function invokes each factory function, in turn, until an attempt to construct a file store object is successful. The file store type is determined by the layout information held in the file store and assumes that one of the supplied factory functions is capable of opening that type.
Note that ownership of the file passes to the store. The
referenced RFile
is cleared and is no longer
valid:
|
|
|
static CFileStore* FromLC(RFile& aFile);
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:
|
|
|
static CFileStore* FromLC(RFile& aFile,const TFileStoreFactoryFunction aFactory[]);
Constructs a file store object from an opened file, using the specified set of factory functions, and places the pointer onto the cleanup stack.
The file must already be open before calling this function.
The function invokes each factory function, in turn, until an attempt to construct a file store object is successful. The file store type is determined by the layout information held in the file store and assumes that one of the supplied factory functions is capable of opening that type.
Note that ownership of the file passes to the store. The
referenced RFile
is cleared and is no longer
valid:
|
|
|
~CFileStore();
Frees resources owned by the object, prior to its destruction. In particular, it closes the associated file.
void SetTypeL(const TUidType& aType);
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()
, otherwise the function raises a STORE-File 9
panic.
|
const TUidType& Type() const;
Gets the UID type of the file store.
|
virtual TUid Layout() const=0;
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.
|
RFile& File() const;
Gets a reference to the file associated with this file store.
This function is called prior to detaching the file store.
|
void Detach();
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.
void Reattach(RFile& aFile);
Reattaches a file to the file store. The file should be the one
that was detached using the Detach()
function.
|
void Reset();
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 CommitL()
or RevertL()
.
void Reset(TInt aSize);
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 CommitL()
or RevertL()
.
|