CFileStore Class Reference

class CFileStore : public CPersistentStore

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.

Inherits from

Public Member Functions
~CFileStore()
voidDetach()
RFile &File()
IMPORT_C CFileStore *FromL(RFile &)
IMPORT_C CFileStore *FromL(RFile &, const TFileStoreFactoryFunction)
IMPORT_C CFileStore *FromLC(RFile &)
IMPORT_C CFileStore *FromLC(RFile &, const TFileStoreFactoryFunction)
TUid Layout()
IMPORT_C voidMarshalL()
IMPORT_C CFileStore *OpenL(RFs &, const TDesC &, TUint)
IMPORT_C CFileStore *OpenL(RFs &, const TDesC &, TUint, const TFileStoreFactoryFunction)
IMPORT_C CFileStore *OpenLC(RFs &, const TDesC &, TUint)
IMPORT_C CFileStore *OpenLC(RFs &, const TDesC &, TUint, const TFileStoreFactoryFunction)
voidReattach(RFile &)
voidReset()
voidReset(TInt)
IMPORT_C voidSetTypeL(const TUidType &)
const TUidType &Type()
Protected Member Functions
CFileStore(RFile &)
CFileStore(RFileBuf &, const TUidType &)
IMPORT_C voidChangedL()
IMPORT_C CFileStore *CreateL(RFs &, const TDesC &, TUint, TNewFunction)
IMPORT_C CFileStore *CreateLC(RFs &, const TDesC &, TUint, TNewFunction)
IMPORT_C voidDestruct()
IMPORT_C voidDoCommitL()
IMPORT_C voidDoRevertL()
IMPORT_C CFileStore *FromL(RFile &, TFileStoreFactoryFunction)
IMPORT_C CFileStore *FromLC(RFile &, TFileStoreFactoryFunction)
TStreamExchange &Host()
TBool IsHost(const MStreamBuf *)
IMPORT_C CFileStore *NewL(RFile &, TNewFunction)
IMPORT_C CFileStore *NewLC(RFile &, TNewFunction)
IMPORT_C CFileStore *OpenL(RFs &, const TDesC &, TUint, TFileStoreFactoryFunction)
IMPORT_C CFileStore *OpenLC(RFs &, const TDesC &, TUint, TFileStoreFactoryFunction)
IMPORT_C voidRefreshL()
IMPORT_C CFileStore *ReplaceL(RFs &, const TDesC &, TUint, TNewFunction)
IMPORT_C CFileStore *ReplaceLC(RFs &, const TDesC &, TUint, TNewFunction)
voidSetSizeL(TInt)
IMPORT_C voidSynchL()
IMPORT_C CFileStore *TempL(RFs &, const TDesC &, TFileName &, TUint, TNewFunction)
IMPORT_C CFileStore *TempLC(RFs &, const TDesC &, TFileName &, TUint, TNewFunction)
Private Member Functions
CFileStore *DoNewL(RFile &, TNewFunction)
voidExternalizeL(RWriteStream &)
voidInternalizeL(RReadStream &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CPersistentStore::CPersistentStore()
CPersistentStore::Root()const
CPersistentStore::SetRootL(TStreamId)
CStreamStore::Commit()
CStreamStore::CommitL()
CStreamStore::CompactL()
CStreamStore::Delete(TStreamId)
CStreamStore::DeleteL(TStreamId)
CStreamStore::ExtendL()
CStreamStore::ReclaimL()
CStreamStore::Revert()
CStreamStore::RevertL()
Protected Member Type Definitions
typedef CFileStore *(* TNewFunction
Private Attributes
RFileBuf iBuf
__MUTABLE TStreamExchangeiHost
TUidType iType
Inherited Attributes
CPersistentStore::iRoot

Constructor & Destructor Documentation

CFileStore(RFile &)

IMPORT_CCFileStore(RFile &aFile)[protected]

Parameters

RFile & aFile

CFileStore(RFileBuf &, const TUidType &)

IMPORT_CCFileStore(RFileBuf &aBuf,
const TUidType &aType
)[protected]

Parameters

RFileBuf & aBuf
const TUidType & aType

~CFileStore()

IMPORT_C~CFileStore()

Member Functions Documentation

ChangedL()

IMPORT_C voidChangedL()[protected]

CreateL(RFs &, const TDesC &, TUint, TNewFunction)

IMPORT_C CFileStore *CreateL(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TNewFunction aFunction

CreateLC(RFs &, const TDesC &, TUint, TNewFunction)

IMPORT_C CFileStore *CreateLC(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TNewFunction aFunction

Destruct()

IMPORT_C voidDestruct()[protected]

Detach()

voidDetach()[inline]

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.

File()

Reattach()

DoCommitL()

IMPORT_C voidDoCommitL()[protected, virtual]

DoNewL(RFile &, TNewFunction)

CFileStore *DoNewL(RFile &aFile,
TNewFunctionaFunction
)[private, static]

Parameters

RFile & aFile
TNewFunction aFunction

DoRevertL()

IMPORT_C voidDoRevertL()[protected, virtual]

ExternalizeL(RWriteStream &)

voidExternalizeL(RWriteStream &aStream)const [private, pure virtual]

Parameters

RWriteStream & aStream

File()

RFile &File()const [inline]

Gets a reference to the file associated with this file store.

This function is called prior to detaching the file store.

A reference to the associated file.

Detach()

FromL(RFile &)

IMPORT_C CFileStore *FromL(RFile &aFile)[static]

Parameters

RFile & aFile

FromL(RFile &, const TFileStoreFactoryFunction)

IMPORT_C CFileStore *FromL(RFile &aFile,
const TFileStoreFactoryFunctionaFactory
)[static]

Parameters

RFile & aFile
const TFileStoreFactoryFunction aFactory

FromL(RFile &, TFileStoreFactoryFunction)

IMPORT_C CFileStore *FromL(RFile &aFile,
TFileStoreFactoryFunctionaFunction
)[protected, static]

Parameters

RFile & aFile
TFileStoreFactoryFunction aFunction

FromLC(RFile &)

IMPORT_C CFileStore *FromLC(RFile &aFile)[static]

Parameters

RFile & aFile

FromLC(RFile &, const TFileStoreFactoryFunction)

IMPORT_C CFileStore *FromLC(RFile &aFile,
const TFileStoreFactoryFunctionaFactory
)[static]

Parameters

RFile & aFile
const TFileStoreFactoryFunction aFactory

FromLC(RFile &, TFileStoreFactoryFunction)

IMPORT_C CFileStore *FromLC(RFile &aFile,
TFileStoreFactoryFunctionaFunction
)[protected, static]

Parameters

RFile & aFile
TFileStoreFactoryFunction aFunction

Host()

TStreamExchange &Host()const [protected, inline]

InternalizeL(RReadStream &)

voidInternalizeL(RReadStream &aStream)[private, pure virtual]

Parameters

RReadStream & aStream

IsHost(const MStreamBuf *)

TBool IsHost(const MStreamBuf *aBuf)const [protected, inline]

Parameters

const MStreamBuf * aBuf

Layout()

TUid Layout()const [pure virtual]

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.

The UID that uniquely identifies the specific type of file store.

KDirectFileStoreLayoutUid

KPermanentFileStoreLayoutUid

MarshalL()

IMPORT_C voidMarshalL()

NewL(RFile &, TNewFunction)

IMPORT_C CFileStore *NewL(RFile &aFile,
TNewFunctionaFunction
)[protected, static]

Parameters

RFile & aFile
TNewFunction aFunction

NewLC(RFile &, TNewFunction)

IMPORT_C CFileStore *NewLC(RFile &aFile,
TNewFunctionaFunction
)[protected, static]

Parameters

RFile & aFile
TNewFunction aFunction

OpenL(RFs &, const TDesC &, TUint)

IMPORT_C CFileStore *OpenL(RFs &aFs,
const TDesC &aName,
TUintaFileMode
)[static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode

OpenL(RFs &, const TDesC &, TUint, const TFileStoreFactoryFunction)

IMPORT_C CFileStore *OpenL(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
const TFileStoreFactoryFunctionaFactory
)[static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
const TFileStoreFactoryFunction aFactory

OpenL(RFs &, const TDesC &, TUint, TFileStoreFactoryFunction)

IMPORT_C CFileStore *OpenL(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TFileStoreFactoryFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TFileStoreFactoryFunction aFunction

OpenLC(RFs &, const TDesC &, TUint)

IMPORT_C CFileStore *OpenLC(RFs &aFs,
const TDesC &aName,
TUintaFileMode
)[static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode

OpenLC(RFs &, const TDesC &, TUint, const TFileStoreFactoryFunction)

IMPORT_C CFileStore *OpenLC(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
const TFileStoreFactoryFunctionaFactory
)[static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
const TFileStoreFactoryFunction aFactory

OpenLC(RFs &, const TDesC &, TUint, TFileStoreFactoryFunction)

IMPORT_C CFileStore *OpenLC(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TFileStoreFactoryFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TFileStoreFactoryFunction aFunction

Reattach(RFile &)

voidReattach(RFile &aFile)[inline]

Reattaches a file to the file store. The file should be the one that was detached using the Detach() function.

File()

Parameters

RFile & aFileThe file to be associated with this file store.

RefreshL()

IMPORT_C voidRefreshL()[protected]

ReplaceL(RFs &, const TDesC &, TUint, TNewFunction)

IMPORT_C CFileStore *ReplaceL(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TNewFunction aFunction

ReplaceLC(RFs &, const TDesC &, TUint, TNewFunction)

IMPORT_C CFileStore *ReplaceLC(RFs &aFs,
const TDesC &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aName
TUint aFileMode
TNewFunction aFunction

Reset()

voidReset()[inline]

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().

CStreamStore::CommitL()

CStreamStore::RevertL()

Reset(TInt)

voidReset(TIntaSize)[inline]

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().

CStreamStore::CommitL()

CStreamStore::RevertL()

Parameters

TInt aSizeThe size of future buffer space allocations.

SetSizeL(TInt)

voidSetSizeL(TIntaSize)[protected, inline]

Parameters

TInt aSize

SetTypeL(const TUidType &)

IMPORT_C voidSetTypeL(const TUidType &aType)

Parameters

const TUidType & aType

SynchL()

IMPORT_C voidSynchL()[protected]

TempL(RFs &, const TDesC &, TFileName &, TUint, TNewFunction)

IMPORT_C CFileStore *TempL(RFs &aFs,
const TDesC &aPath,
TFileName &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aPath
TFileName & aName
TUint aFileMode
TNewFunction aFunction

TempLC(RFs &, const TDesC &, TFileName &, TUint, TNewFunction)

IMPORT_C CFileStore *TempLC(RFs &aFs,
const TDesC &aPath,
TFileName &aName,
TUintaFileMode,
TNewFunctionaFunction
)[protected, static]

Parameters

RFs & aFs
const TDesC & aPath
TFileName & aName
TUint aFileMode
TNewFunction aFunction

Type()

const TUidType &Type()const [inline]

Gets the UID type of the file store.

The UID type object containing the file store type.

TUid

Member Type Definitions Documentation

Typedef TNewFunction

typedef CFileStore *(*TNewFunction[protected]

Member Data Documentation

RFileBuf iBuf

RFileBuf iBuf[private]

__MUTABLE TStreamExchange iHost

__MUTABLE TStreamExchangeiHost[private]

TUidType iType

TUidType iType[private]