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.
17 #if !defined(__STOREWRITESTREAM_H__)
18 #define __STOREWRITESTREAM_H__
20 #include <pcstore/pcstoredef.h>
21 #include <pcstore/streamid.h>
34 A write stream class to externalize data to a Store file.
36 By eventually calling CFileStreamBuf's write function, it implements the externalization of
37 the following data types:
53 After instantiated, it must be opened on a write-moded CDirectFileStore object to externalize data.
54 It must be closed or destroyed before another stream is opened on the same CDirectFileStore object.
59 class CStoreWriteStream
62 CStoreWriteStream(CFileStreamBuf& aStreamBuf, TStreamId aId);
64 void Write(const TUint8* aPtr, TInt aLength);
65 void Write(const TUint16* aPtr, TInt aLength);
66 void WriteInt8(TInt8 aValue);
67 void WriteUint8(TUint8 aValue);
68 void WriteInt16(TInt16 aValue);
69 void WriteUint16(TUint16 aValue);
70 void WriteInt32(TInt32 aValue);
71 void WriteUint32(TUint32 aValue);
72 void WriteInt64(TInt64 aValue);
73 void WriteUint64(TUint64 aValue);
74 void WriteReal32(TReal32 aValue);
75 void WriteReal64(TReal64 aValue);
76 void Write(const CDes8& aDes);
77 void Write(const CDes8& aDes, TInt aLength);
78 void Write(const CDes16& aDes);
79 void Write(const CDes16& aDes, TInt aLength);
82 CStoreWriteStream(const CStoreWriteStream& aStream);
83 CStoreWriteStream& operator=(const CStoreWriteStream& aStream);
89 // Operators on the write stream and data types
90 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TStreamId& aId);
91 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt8 aVal);
92 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint8 aVal);
93 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt16 aVal);
94 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint16 aVal);
95 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt32 aVal);
96 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint32 aVal);
97 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt64 aVal);
98 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint64 aVal);
99 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal32 aVal);
100 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal64 aVal);
101 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes8& aDes);
102 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes16& aDes);
103 CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUid& aUid);
105 #endif // !defined(__STOREWRITESTREAM_H__)