1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__DIRECTFILESTORE_H__)
17 #define __DIRECTFILESTORE_H__
19 #include <pcstore/pcstoredef.h>
20 #include <pcstore/streamid.h>
21 #include <pcstore/uid.h>
26 class CStoreWriteStream;
27 class CStoreReadStream;
30 const TInt KDirectFileStoreLayoutUidValue=0x10000037; //268435511;
31 const TUid KDirectFileStoreLayoutUid={KDirectFileStoreLayoutUidValue};
38 A direct file store implements a set of the operations to open store, create streams(CStoreWriteStream
39 and CStoreReadStream), set root stream id to the store.
41 Objects can be externalized to streams represented by class CStoreWriteStream. Once the streams
42 have been closed, they cannot subsequently be changed, i.e. streams cannot be replaced, deleted,
43 extended or changed in any way.
45 Existing direct file stores can be opened with this class. Objects can be restored with class
48 Before closing a new store, the root stream id must be set. After opening an existing store, the
49 first thing done is to look up the root stream id. The root stream can then be opened and data
52 @see CStoreWriteStream
55 class CDirectFileStore
58 //Enumerations for the store open mode
68 void SetRoot(TStreamId aId);
69 TStreamId Root() const;
70 static CDirectFileStore* Open(const char* aFileName);
71 static CDirectFileStore* Replace(const char* aFileName);
72 static CDirectFileStore* Replace(const char* aFileName, const TUidType& aType);
73 CStoreWriteStream* CreateWriteStream(TStreamId& aId);
74 CStoreReadStream* CreateReadStream(TStreamId aId);
77 CDirectFileStore(const char* aFileName, TStoreMode aMode);
78 CStoreWriteStream* CreateIdWriteStream(TStreamId aId);
80 void SetType(const TUidType& aType);
82 void Externalize(CStoreWriteStream& aWs) const;
83 void Internalize(CStoreReadStream& aRs);
88 CFileStreamBuf* iFileStreamBuf;
91 #endif // !defined(__DIRECTFILESTORE_H__)