sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __BARSREADIMPL_H__ sl@0: #define __BARSREADIMPL_H__ sl@0: sl@0: #include <e32std.h> sl@0: #include <badesca.h> sl@0: #include "BaAssert.h" sl@0: sl@0: /** Interprets resource data read from a resource file. sl@0: sl@0: To use an instance of this class, pass the buffer containing the resource sl@0: data to it by calling SetBuffer(). sl@0: sl@0: The buffer containing the resource data is created by RResourceFile::AllocReadLC()/CResourceFile::AllocReadLC() sl@0: or RResourceFile::AllocReadL()/CResourceFile::AllocReadL() which reads the specified resource into it. sl@0: sl@0: The current position within the buffer is always maintained and any request sl@0: for data is always supplied from the current position. The current position sl@0: is always updated . sl@0: sl@0: Expected behaviour when assignment operator or copy constructor is called: sl@0: The class doesn't have assignment operator and copy constructor, so the compiler generated sl@0: ones will be used. The buffer used by the source class instance will be shared with the sl@0: destination class instance. However source and destination instances will have their own sl@0: current position pointers, both pointed initially to the same buffer position. sl@0: sl@0: Methods panic/leave behaviour: "L" methods panics/leave behaviour depends on iAssertObj sl@0: member which could be initialized calling SetAssertObj. If iAssertObj internal state is sl@0: TBaAssert::EPanic - "L" methods will panic, otherwise they will leave if something goes wrong. sl@0: By default "L" methods will panic. sl@0: sl@0: @internalComponent sl@0: @see TResourceReaderImpl::SetBuffer() sl@0: @see RResourceFile::AllocReadL() sl@0: @see RResourceFile::AllocReadLC() sl@0: @see CResourceFile::AllocReadL() sl@0: @see CResourceFile::AllocReadLC() */ sl@0: class TResourceReaderImpl sl@0: { sl@0: public: sl@0: TResourceReaderImpl(); sl@0: sl@0: void SetBuffer(const TDesC8* aBuffer); sl@0: void ResetBuffer(); sl@0: const TAny* Ptr(); sl@0: sl@0: // Read counted strings into allocated buffer sl@0: HBufC8* ReadHBufC8L(); sl@0: HBufC16* ReadHBufC16L(); sl@0: sl@0: // Build pointer from a counted string sl@0: TPtrC8 ReadTPtrC8L(); sl@0: TPtrC16 ReadTPtrC16L(); sl@0: sl@0: // Build pointer from a counted string in an array of counted strings, sl@0: // also setting the buffer to be used. sl@0: TPtrC8 ReadTPtrC8L(TInt aIndex,const TDesC8* aBuffer); sl@0: TPtrC16 ReadTPtrC16L(TInt aIndex,const TDesC8* aBuffer); sl@0: sl@0: // Build an array of strings from a resource array sl@0: CDesC8ArrayFlat* ReadDesC8ArrayL(); sl@0: CDesC16ArrayFlat* ReadDesC16ArrayL(); sl@0: sl@0: TInt ReadInt8L(); sl@0: TUint ReadUint8L(); sl@0: TInt ReadInt16L(); sl@0: TUint ReadUint16L(); sl@0: TInt ReadInt32L(); sl@0: TUint ReadUint32L(); sl@0: TReal64 ReadReal64L() __SOFTFP; sl@0: sl@0: void ReadL(TAny* aPtr,TInt aLength); sl@0: void RewindL(TInt aLength); sl@0: void AdvanceL(TInt aLength); sl@0: sl@0: void SetAssertObj(const TBaAssert& iAssertObj); sl@0: private: sl@0: void MovePtrL(const TUint8* aPtr); sl@0: private: sl@0: const TDesC8* iBuffer; sl@0: const TUint8* iCurrentPtr; sl@0: TBaAssert iAssertObj; sl@0: }; sl@0: sl@0: #endif//__BARSREADIMPL_H__