|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #if !defined(__STOREWRITESTREAM_H__) |
|
18 #define __STOREWRITESTREAM_H__ |
|
19 |
|
20 #include <pcstore/pcstoredef.h> |
|
21 #include <pcstore/streamid.h> |
|
22 |
|
23 namespace PCStore |
|
24 { |
|
25 class CDes8; |
|
26 class CDes16; |
|
27 class CFileStreamBuf; |
|
28 class TStreamId; |
|
29 class TUid; |
|
30 |
|
31 /** |
|
32 @internalAll |
|
33 |
|
34 A write stream class to externalize data to a Store file. |
|
35 |
|
36 By eventually calling CFileStreamBuf's write function, it implements the externalization of |
|
37 the following data types: |
|
38 TInt8 |
|
39 TUint8 |
|
40 TInt16 |
|
41 TUint16 |
|
42 TInt32 |
|
43 TUint32 |
|
44 TInt64 |
|
45 TUint64 |
|
46 TReal32 |
|
47 TReal64 |
|
48 TUint8* |
|
49 TUint16* |
|
50 CDes8 |
|
51 CDes16 |
|
52 |
|
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. |
|
55 |
|
56 @see CDirectFileStore |
|
57 @see CStoreReadStream |
|
58 */ |
|
59 class CStoreWriteStream |
|
60 { |
|
61 public: |
|
62 CStoreWriteStream(CFileStreamBuf& aStreamBuf, TStreamId aId); |
|
63 ~CStoreWriteStream(); |
|
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); |
|
80 |
|
81 private: |
|
82 CStoreWriteStream(const CStoreWriteStream& aStream); |
|
83 CStoreWriteStream& operator=(const CStoreWriteStream& aStream); |
|
84 |
|
85 private: |
|
86 CFileStreamBuf& iSnk; |
|
87 }; |
|
88 |
|
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); |
|
104 } |
|
105 #endif // !defined(__STOREWRITESTREAM_H__) |