1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/pcstore/storewritestream.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,105 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +#if !defined(__STOREWRITESTREAM_H__)
1.21 +#define __STOREWRITESTREAM_H__
1.22 +
1.23 +#include <pcstore/pcstoredef.h>
1.24 +#include <pcstore/streamid.h>
1.25 +
1.26 +namespace PCStore
1.27 +{
1.28 +class CDes8;
1.29 +class CDes16;
1.30 +class CFileStreamBuf;
1.31 +class TStreamId;
1.32 +class TUid;
1.33 +
1.34 +/**
1.35 +@internalAll
1.36 +
1.37 +A write stream class to externalize data to a Store file.
1.38 +
1.39 +By eventually calling CFileStreamBuf's write function, it implements the externalization of
1.40 +the following data types:
1.41 + TInt8
1.42 + TUint8
1.43 + TInt16
1.44 + TUint16
1.45 + TInt32
1.46 + TUint32
1.47 + TInt64
1.48 + TUint64
1.49 + TReal32
1.50 + TReal64
1.51 + TUint8*
1.52 + TUint16*
1.53 + CDes8
1.54 + CDes16
1.55 +
1.56 +After instantiated, it must be opened on a write-moded CDirectFileStore object to externalize data.
1.57 +It must be closed or destroyed before another stream is opened on the same CDirectFileStore object.
1.58 +
1.59 +@see CDirectFileStore
1.60 +@see CStoreReadStream
1.61 +*/
1.62 +class CStoreWriteStream
1.63 + {
1.64 +public:
1.65 + CStoreWriteStream(CFileStreamBuf& aStreamBuf, TStreamId aId);
1.66 + ~CStoreWriteStream();
1.67 + void Write(const TUint8* aPtr, TInt aLength);
1.68 + void Write(const TUint16* aPtr, TInt aLength);
1.69 + void WriteInt8(TInt8 aValue);
1.70 + void WriteUint8(TUint8 aValue);
1.71 + void WriteInt16(TInt16 aValue);
1.72 + void WriteUint16(TUint16 aValue);
1.73 + void WriteInt32(TInt32 aValue);
1.74 + void WriteUint32(TUint32 aValue);
1.75 + void WriteInt64(TInt64 aValue);
1.76 + void WriteUint64(TUint64 aValue);
1.77 + void WriteReal32(TReal32 aValue);
1.78 + void WriteReal64(TReal64 aValue);
1.79 + void Write(const CDes8& aDes);
1.80 + void Write(const CDes8& aDes, TInt aLength);
1.81 + void Write(const CDes16& aDes);
1.82 + void Write(const CDes16& aDes, TInt aLength);
1.83 +
1.84 +private:
1.85 + CStoreWriteStream(const CStoreWriteStream& aStream);
1.86 + CStoreWriteStream& operator=(const CStoreWriteStream& aStream);
1.87 +
1.88 +private:
1.89 + CFileStreamBuf& iSnk;
1.90 + };
1.91 +
1.92 +// Operators on the write stream and data types
1.93 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TStreamId& aId);
1.94 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt8 aVal);
1.95 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint8 aVal);
1.96 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt16 aVal);
1.97 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint16 aVal);
1.98 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt32 aVal);
1.99 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint32 aVal);
1.100 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TInt64 aVal);
1.101 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUint64 aVal);
1.102 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal32 aVal);
1.103 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TReal64 aVal);
1.104 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes8& aDes);
1.105 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const CDes16& aDes);
1.106 +CStoreWriteStream& operator<<(CStoreWriteStream& aStream,const TUid& aUid);
1.107 +}
1.108 +#endif // !defined(__STOREWRITESTREAM_H__)