epoc32/include/pcstore/storereadstream.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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 #if !defined(__STOREREADSTREAM_H__)
       
    17 #define __STOREREADSTREAM_H__
       
    18 
       
    19 #include <pcstore/pcstoredef.h>
       
    20 #include <pcstore/streamid.h>
       
    21 
       
    22 namespace PCStore
       
    23 {
       
    24 class CDes8;
       
    25 class CDes16;
       
    26 class CFileStreamBuf;
       
    27 class TStreamId;
       
    28 class TUid;
       
    29 
       
    30 /**
       
    31 @internalAll
       
    32 
       
    33 A read stream class to internalize data from a Store file.
       
    34 
       
    35 By eventually calling  CFileStreamBuf's read function, it implements the internalization of 
       
    36 the following data types:
       
    37 	TInt8 
       
    38 	TUint8 
       
    39 	TInt16 
       
    40 	TUint16
       
    41 	TInt32 
       
    42 	TUint32
       
    43 	TInt64
       
    44 	TUint64
       
    45 	TReal32
       
    46 	TReal64
       
    47 	TUint8*
       
    48 	TUint16*
       
    49 	CDes8
       
    50 	CDes16
       
    51 
       
    52 After instantiated, it must be opened on a read-moded CDirectFileStore object to internalize data.
       
    53 It must be closed or destroyed before another stream is opened on the same CDirectFileStore object.
       
    54 
       
    55 @see CDirectFileStore 
       
    56 @see CStoreWriteStream
       
    57 */
       
    58 class CStoreReadStream
       
    59 	{
       
    60 public:
       
    61 	CStoreReadStream(CFileStreamBuf& aStreamBuf, TStreamId aId);
       
    62 	~CStoreReadStream();
       
    63 	void Read(TUint8* aPtr, TInt aLength);
       
    64 	void Read(TUint16* aPtr, TInt aLength);
       
    65 	TInt8 ReadInt8();
       
    66 	TUint8 ReadUint8();
       
    67 	TInt16 ReadInt16();
       
    68 	TUint16 ReadUint16();
       
    69 	TInt32 ReadInt32();
       
    70 	TUint32 ReadUint32();
       
    71 	TInt64 ReadInt64();
       
    72 	TUint64 ReadUint64();
       
    73 	TReal32 ReadReal32();
       
    74 	TReal64 ReadReal64();
       
    75 	void Read(CDes8& aDes);
       
    76 	void Read(CDes8& aDes, TInt aLength);
       
    77 	void Read(CDes16& aDes);
       
    78 	void Read(CDes16& aDes, TInt aLength);
       
    79 
       
    80 private:
       
    81 	CStoreReadStream(const CStoreReadStream& aStream);
       
    82 	CStoreReadStream& operator=(const CStoreReadStream& aStream);
       
    83 
       
    84 private:
       
    85 	CFileStreamBuf& iSrc;
       
    86 	};
       
    87 
       
    88 
       
    89 // Operators on the read stream and data types
       
    90 CStoreReadStream& operator>>(CStoreReadStream& aStream, TStreamId& aId);
       
    91 CStoreReadStream& operator>>(CStoreReadStream& aStream, TInt8& aVal);
       
    92 CStoreReadStream& operator>>(CStoreReadStream& aStream, TUint8& aVal);
       
    93 CStoreReadStream& operator>>(CStoreReadStream& aStream, TInt16& aVal);
       
    94 CStoreReadStream& operator>>(CStoreReadStream& aStream, TUint16& aVal);
       
    95 CStoreReadStream& operator>>(CStoreReadStream& aStream, TInt32& aVal);
       
    96 CStoreReadStream& operator>>(CStoreReadStream& aStream, TUint32& aVal);
       
    97 CStoreReadStream& operator>>(CStoreReadStream& aStream, TInt64& aVal);
       
    98 CStoreReadStream& operator>>(CStoreReadStream& aStream, TUint64& aVal);
       
    99 CStoreReadStream& operator>>(CStoreReadStream& aStream, TReal32& aVal);
       
   100 CStoreReadStream& operator>>(CStoreReadStream& aStream, TReal64& aVal);
       
   101 CStoreReadStream& operator>>(CStoreReadStream& aStream, CDes8& aDes);
       
   102 CStoreReadStream& operator>>(CStoreReadStream& aStream, CDes16& aDes);
       
   103 CStoreReadStream& operator>>(CStoreReadStream& aStream, TUid& aUid);
       
   104 }
       
   105 #endif // !defined(__STOREREADSTREAM_H__)