williamr@4
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
2 |
// All rights reserved.
|
williamr@4
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
7 |
//
|
williamr@4
|
8 |
// Initial Contributors:
|
williamr@4
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@4
|
10 |
//
|
williamr@4
|
11 |
// Contributors:
|
williamr@4
|
12 |
//
|
williamr@4
|
13 |
// Description:
|
williamr@4
|
14 |
//
|
williamr@4
|
15 |
|
williamr@4
|
16 |
|
williamr@4
|
17 |
#if !defined(__STOREWRITESTREAM_H__)
|
williamr@4
|
18 |
#define __STOREWRITESTREAM_H__
|
williamr@4
|
19 |
|
williamr@4
|
20 |
#include <pcstore/pcstoredef.h>
|
williamr@4
|
21 |
#include <pcstore/streamid.h>
|
williamr@4
|
22 |
|
williamr@4
|
23 |
namespace PCStore
|
williamr@4
|
24 |
{
|
williamr@4
|
25 |
class CDes8;
|
williamr@4
|
26 |
class CDes16;
|
williamr@4
|
27 |
class CFileStreamBuf;
|
williamr@4
|
28 |
class TStreamId;
|
williamr@4
|
29 |
class TUid;
|
williamr@4
|
30 |
|
williamr@4
|
31 |
/**
|
williamr@4
|
32 |
@internalAll
|
williamr@4
|
33 |
|
williamr@4
|
34 |
A write stream class to externalize data to a Store file.
|
williamr@4
|
35 |
|
williamr@4
|
36 |
By eventually calling CFileStreamBuf's write function, it implements the externalization of
|
williamr@4
|
37 |
the following data types:
|
williamr@4
|
38 |
TInt8
|
williamr@4
|
39 |
TUint8
|
williamr@4
|
40 |
TInt16
|
williamr@4
|
41 |
TUint16
|
williamr@4
|
42 |
TInt32
|
williamr@4
|
43 |
TUint32
|
williamr@4
|
44 |
TInt64
|
williamr@4
|
45 |
TUint64
|
williamr@4
|
46 |
TReal32
|
williamr@4
|
47 |
TReal64
|
williamr@4
|
48 |
TUint8*
|
williamr@4
|
49 |
TUint16*
|
williamr@4
|
50 |
CDes8
|
williamr@4
|
51 |
CDes16
|
williamr@4
|
52 |
|
williamr@4
|
53 |
After instantiated, it must be opened on a write-moded CDirectFileStore object to externalize data.
|
williamr@4
|
54 |
It must be closed or destroyed before another stream is opened on the same CDirectFileStore object.
|
williamr@4
|
55 |
|
williamr@4
|
56 |
@see CDirectFileStore
|
williamr@4
|
57 |
@see CStoreReadStream
|
williamr@4
|
58 |
*/
|
williamr@4
|
59 |
class CStoreWriteStream
|
williamr@4
|
60 |
{
|
williamr@4
|
61 |
public:
|
williamr@4
|
62 |
CStoreWriteStream(CFileStreamBuf& aStreamBuf, TStreamId aId);
|
williamr@4
|
63 |
~CStoreWriteStream();
|
williamr@4
|
64 |
void Write(const TUint8* aPtr, TInt aLength);
|
williamr@4
|
65 |
void Write(const TUint16* aPtr, TInt aLength);
|
williamr@4
|
66 |
void WriteInt8(TInt8 aValue);
|
williamr@4
|
67 |
void WriteUint8(TUint8 aValue);
|
williamr@4
|
68 |
void WriteInt16(TInt16 aValue);
|
williamr@4
|
69 |
void WriteUint16(TUint16 aValue);
|
williamr@4
|
70 |
void WriteInt32(TInt32 aValue);
|
williamr@4
|
71 |
void WriteUint32(TUint32 aValue);
|
williamr@4
|
72 |
void WriteInt64(TInt64 aValue);
|
williamr@4
|
73 |
void WriteUint64(TUint64 aValue);
|
williamr@4
|
74 |
void WriteReal32(TReal32 aValue);
|
williamr@4
|
75 |
void WriteReal64(TReal64 aValue);
|
williamr@4
|
76 |
void Write(const CDes8& aDes);
|
williamr@4
|
77 |
void Write(const CDes8& aDes, TInt aLength);
|
williamr@4
|
78 |
void Write(const CDes16& aDes);
|
williamr@4
|
79 |
void Write(const CDes16& aDes, TInt aLength);
|
williamr@4
|
80 |
|
williamr@4
|
81 |
private:
|
williamr@4
|
82 |
CStoreWriteStream(const CStoreWriteStream& aStream);
|
williamr@4
|
83 |
CStoreWriteStream& operator=(const CStoreWriteStream& aStream);
|
williamr@4
|
84 |
|
williamr@4
|
85 |
private:
|
williamr@4
|
86 |
CFileStreamBuf& iSnk;
|
williamr@4
|
87 |
};
|
williamr@4
|
88 |
|
williamr@4
|
89 |
// Operators on the write stream and data types
|
williamr@4
|
90 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TStreamId& aId);
|
williamr@4
|
91 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt8 aVal);
|
williamr@4
|
92 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint8 aVal);
|
williamr@4
|
93 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt16 aVal);
|
williamr@4
|
94 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint16 aVal);
|
williamr@4
|
95 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt32 aVal);
|
williamr@4
|
96 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint32 aVal);
|
williamr@4
|
97 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt64 aVal);
|
williamr@4
|
98 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint64 aVal);
|
williamr@4
|
99 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal32 aVal);
|
williamr@4
|
100 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal64 aVal);
|
williamr@4
|
101 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes8& aDes);
|
williamr@4
|
102 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes16& aDes);
|
williamr@4
|
103 |
CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUid& aUid);
|
williamr@4
|
104 |
}
|
williamr@4
|
105 |
#endif // !defined(__STOREWRITESTREAM_H__)
|