#include <s32file.h>
class CFileStore : public CPersistentStore |
Protected Member Type Definitions | |
---|---|
typedef | CFileStore *(* TNewFunction |
Public Member Functions | |
---|---|
~CFileStore() | |
void | Detach() |
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) |
pure virtual TUid | Layout() |
IMPORT_C void | MarshalL() |
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) |
void | Reattach(RFile &) |
void | Reset() |
void | Reset(TInt) |
IMPORT_C void | SetTypeL(const TUidType &) |
const TUidType & | Type() |
Inherited Attributes | |
---|---|
CPersistentStore::iRoot |
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.
IMPORT_C | ~CFileStore | ( | ) |
Frees resources owned by the object, prior to its destruction. In particular, it closes the associated file.
IMPORT_C CFileStore * | CreateL | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | CreateLC | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |
void | Detach | ( | ) | [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.
See also: File() Reattach()
IMPORT_C void | DoCommitL | ( | ) | [protected, virtual] |
Reimplemented from CStreamStore::DoCommitL()
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 CommitL() function.
IMPORT_C void | DoRevertL | ( | ) | [protected, virtual] |
Reimplemented from CStreamStore::DoRevertL()
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 Revert() function.
Note:
The function need only be implemented by stores that provide atomic updates, as revert has no meaning for other implementations.
IMPORT_C CFileStore * | FromL | ( | RFile & | aFile | ) | [static] |
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:
See also: CFileStore::Layout()
Parameter | Description |
---|---|
aFile | A reference to the opened file. |
Returns: A pointer to the new file store object.
IMPORT_C CFileStore * | FromL | ( | RFile & | aFile, |
const TFileStoreFactoryFunction | aFactory | |||
) | [static] |
IMPORT_C CFileStore * | FromL | ( | RFile & | aFile, |
TFileStoreFactoryFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | FromLC | ( | RFile & | aFile | ) | [static] |
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:
See also: CFileStore::Layout()
Parameter | Description |
---|---|
aFile | A reference to the opened file. |
Returns: A pointer to the new file store object.
IMPORT_C CFileStore * | FromLC | ( | RFile & | aFile, |
const TFileStoreFactoryFunction | aFactory | |||
) | [static] |
IMPORT_C CFileStore * | FromLC | ( | RFile & | aFile, |
TFileStoreFactoryFunction | aFunction | |||
) | [protected, static] |
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.
See also: KDirectFileStoreLayoutUid KPermanentFileStoreLayoutUid
Returns: The UID that uniquely identifies the specific type of file store.
IMPORT_C CFileStore * | NewL | ( | RFile & | aFile, |
TNewFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | NewLC | ( | RFile & | aFile, |
TNewFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | OpenL | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode | |||
) | [static] |
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.
See also: TFileMode CFileStore::Layout()
Parameter | Description |
---|---|
aFs | Handle to a file server session. |
aName | The full path name of the file containing the store. |
aFileMode | The mode in which the file is to be accessed. The mode is defined by the TFileMode type. |
Returns: A pointer to the new file store object.
IMPORT_C CFileStore * | OpenL | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
const TFileStoreFactoryFunction | aFactory | |||
) | [static] |
IMPORT_C CFileStore * | OpenL | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TFileStoreFactoryFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | OpenLC | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode | |||
) | [static] |
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.
See also: TFileMode CFileStore::Layout()
Parameter | Description |
---|---|
aFs | Handle to a file server session. |
aName | The full path name of the file containing the store. |
aFileMode | The mode in which the file is to be accessed. The mode is defined by the TFileMode type. |
Returns: A pointer to the new file store object.
IMPORT_C CFileStore * | OpenLC | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
const TFileStoreFactoryFunction | aFactory | |||
) | [static] |
IMPORT_C CFileStore * | OpenLC | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TFileStoreFactoryFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | ReplaceL | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | ReplaceLC | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |
void | Reset | ( | TInt | aSize | ) | [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().
Parameter | Description |
---|---|
aSize | The size of future buffer space allocations. |
IMPORT_C 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.
See also: TUid
Parameter | Description |
---|---|
aType | The UID type object containing the file store type. |
IMPORT_C CFileStore * | TempL | ( | RFs & | aFs, |
const TDesC & | aPath, | |||
TFileName & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |
IMPORT_C CFileStore * | TempLC | ( | RFs & | aFs, |
const TDesC & | aPath, | |||
TFileName & | aName, | |||
TUint | aFileMode, | |||
TNewFunction | aFunction | |||
) | [protected, static] |