lowlevellibsandfws/apputils/inc/BaRsRead2.H
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2003-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 #ifndef __BARSREAD2_H__
       
    17 #define __BARSREAD2_H__
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <badesca.h>
       
    21 
       
    22 //Forward declarations
       
    23 class TResourceReaderImpl;
       
    24 class CResourceFile;
       
    25 
       
    26 /** Interprets resource data read from a resource file.
       
    27 
       
    28 To use an instance of this class, pass the CResourceFile object containing the resource 
       
    29 data with aResourceId ID to it, by calling OpenL() or OpenLC(). Close the reader
       
    30 calling Close() after finishing with the resource.
       
    31 
       
    32 The current position within the buffer is always maintained and any request 
       
    33 for data is always supplied from the current position. The current position 
       
    34 is always updated .
       
    35 
       
    36 Expected behaviour when assignment operator or copy constructor is called:
       
    37 The class doesn't have assignment operator and copy constructor, so the compiler generated
       
    38 ones will be used. The buffer used by the source class instance will be shared with the 
       
    39 destination class instance. However source and destination instances will have their own 
       
    40 current position pointers, both pointed initially to the same buffer position.
       
    41 
       
    42 @publishedAll
       
    43 @released
       
    44 @see CResourceFile */
       
    45 class RResourceReader
       
    46 	{
       
    47 public:
       
    48 	IMPORT_C RResourceReader();
       
    49 	IMPORT_C ~RResourceReader();
       
    50 	IMPORT_C void OpenL(const CResourceFile* aRscFile, TInt aResourceId);
       
    51 	IMPORT_C void OpenLC(const CResourceFile* aRscFile, TInt aResourceId);
       
    52 	IMPORT_C void OpenL(const TDesC8& aRscData);
       
    53 	IMPORT_C void OpenLC(const TDesC8& aRscData);
       
    54 	IMPORT_C void Close();
       
    55 
       
    56     // Read counted strings into allocated buffer
       
    57     IMPORT_C HBufC*   ReadHBufCL();
       
    58     IMPORT_C HBufC8*  ReadHBufC8L();
       
    59     IMPORT_C HBufC16* ReadHBufC16L();
       
    60 
       
    61     // Build pointer from a counted string
       
    62     IMPORT_C TPtrC   ReadTPtrCL();
       
    63     IMPORT_C TPtrC8  ReadTPtrC8L();
       
    64     IMPORT_C TPtrC16 ReadTPtrC16L();
       
    65 
       
    66     // Build an array of strings from a resource array
       
    67     IMPORT_C CDesCArrayFlat*   ReadDesCArrayL();
       
    68     IMPORT_C CDesC8ArrayFlat*  ReadDesC8ArrayL();
       
    69     IMPORT_C CDesC16ArrayFlat* ReadDesC16ArrayL();
       
    70 
       
    71     IMPORT_C TInt ReadInt8L();
       
    72     IMPORT_C TUint ReadUint8L();
       
    73     IMPORT_C TInt ReadInt16L();
       
    74     IMPORT_C TUint ReadUint16L();
       
    75     IMPORT_C TInt ReadInt32L();
       
    76     IMPORT_C TUint ReadUint32L();
       
    77     IMPORT_C TReal64 ReadReal64L() __SOFTFP;
       
    78 
       
    79     IMPORT_C void ReadL(TAny* aPtr,TInt aLength);
       
    80     IMPORT_C void RewindL(TInt aLength);
       
    81     IMPORT_C void AdvanceL(TInt aLength);
       
    82 private:
       
    83 	TResourceReaderImpl* Impl();
       
    84 	const TResourceReaderImpl* Impl() const;
       
    85 private:
       
    86 	//Size of the RResourceReader implementation.
       
    87 	//It should be 12 because of the BC reasons.
       
    88 	//That's the size of the implementation class,
       
    89 	//which implements TResourceReader functionality too.
       
    90 	enum
       
    91 		{
       
    92 		KRsReaderSize = 12
       
    93 		};
       
    94 	TUint8 iImpl[KRsReaderSize];
       
    95 	HBufC8* iRscBuffer;
       
    96 	};
       
    97 
       
    98 #endif//__BARSREAD2_H__