williamr@2: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __BARSREAD2_H__ williamr@2: #define __BARSREAD2_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: //Forward declarations williamr@2: class TResourceReaderImpl; williamr@2: class CResourceFile; williamr@2: williamr@2: /** Interprets resource data read from a resource file. williamr@2: williamr@2: To use an instance of this class, pass the CResourceFile object containing the resource williamr@2: data with aResourceId ID to it, by calling OpenL() or OpenLC(). Close the reader williamr@2: calling Close() after finishing with the resource. williamr@2: williamr@2: The current position within the buffer is always maintained and any request williamr@2: for data is always supplied from the current position. The current position williamr@2: is always updated . williamr@2: williamr@2: Expected behaviour when assignment operator or copy constructor is called: williamr@2: The class doesn't have assignment operator and copy constructor, so the compiler generated williamr@2: ones will be used. The buffer used by the source class instance will be shared with the williamr@2: destination class instance. However source and destination instances will have their own williamr@2: current position pointers, both pointed initially to the same buffer position. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see CResourceFile */ williamr@2: class RResourceReader williamr@2: { williamr@2: public: williamr@2: IMPORT_C RResourceReader(); williamr@2: IMPORT_C ~RResourceReader(); williamr@2: IMPORT_C void OpenL(const CResourceFile* aRscFile, TInt aResourceId); williamr@2: IMPORT_C void OpenLC(const CResourceFile* aRscFile, TInt aResourceId); williamr@2: IMPORT_C void OpenL(const TDesC8& aRscData); williamr@2: IMPORT_C void OpenLC(const TDesC8& aRscData); williamr@2: IMPORT_C void Close(); williamr@2: williamr@2: // Read counted strings into allocated buffer williamr@2: IMPORT_C HBufC* ReadHBufCL(); williamr@2: IMPORT_C HBufC8* ReadHBufC8L(); williamr@2: IMPORT_C HBufC16* ReadHBufC16L(); williamr@2: williamr@2: // Build pointer from a counted string williamr@2: IMPORT_C TPtrC ReadTPtrCL(); williamr@2: IMPORT_C TPtrC8 ReadTPtrC8L(); williamr@2: IMPORT_C TPtrC16 ReadTPtrC16L(); williamr@2: williamr@2: // Build an array of strings from a resource array williamr@2: IMPORT_C CDesCArrayFlat* ReadDesCArrayL(); williamr@2: IMPORT_C CDesC8ArrayFlat* ReadDesC8ArrayL(); williamr@2: IMPORT_C CDesC16ArrayFlat* ReadDesC16ArrayL(); williamr@2: williamr@2: IMPORT_C TInt ReadInt8L(); williamr@2: IMPORT_C TUint ReadUint8L(); williamr@2: IMPORT_C TInt ReadInt16L(); williamr@2: IMPORT_C TUint ReadUint16L(); williamr@2: IMPORT_C TInt ReadInt32L(); williamr@2: IMPORT_C TUint ReadUint32L(); williamr@2: IMPORT_C TReal64 ReadReal64L() __SOFTFP; williamr@2: williamr@2: IMPORT_C void ReadL(TAny* aPtr,TInt aLength); williamr@2: IMPORT_C void RewindL(TInt aLength); williamr@2: IMPORT_C void AdvanceL(TInt aLength); williamr@2: private: williamr@2: TResourceReaderImpl* Impl(); williamr@2: const TResourceReaderImpl* Impl() const; williamr@2: private: williamr@2: //Size of the RResourceReader implementation. williamr@2: //It should be 12 because of the BC reasons. williamr@2: //That's the size of the implementation class, williamr@2: //which implements TResourceReader functionality too. williamr@2: enum williamr@2: { williamr@2: KRsReaderSize = 12 williamr@2: }; williamr@2: TUint8 iImpl[KRsReaderSize]; williamr@2: HBufC8* iRscBuffer; williamr@2: }; williamr@2: williamr@2: #endif//__BARSREAD2_H__