williamr@2: // Copyright (c) 1997-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@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.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 __BARSC_H__ williamr@2: #define __BARSC_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: //Forward declarations williamr@2: class RResourceFileImpl; williamr@2: williamr@2: /** Accesses a resource file and reads the resource data into a buffer. williamr@2: williamr@2: Interpretation of the data is achieved using the TResourceReader class. williamr@2: williamr@2: RResourceFile instance behaviour when some problem occurs - it panics. Or asserts, williamr@2: if the used method is not "L" method. 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 heap buffers used by the source class instance will be shared with the williamr@2: destination class instance. williamr@2: williamr@2: Expected behaviour when the RResourceFile instance is about to be destroyed: williamr@2: The class doesn't have destructor so compiler generated one will be used. williamr@2: Always call Close() to free allocated by the instance resources. williamr@2: williamr@2: @see TResourceReader williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class RResourceFile williamr@2: { williamr@2: public: williamr@2: IMPORT_C RResourceFile(); williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C void OpenL(RFs &aFs,const TDesC &aName); williamr@2: IMPORT_C TUidType UidType() const; williamr@2: IMPORT_C void ReadL(TDes8 &aDes,TInt aResourceId) const; williamr@2: IMPORT_C HBufC8 *AllocReadL(TInt aResourceId) const; williamr@2: IMPORT_C HBufC8 *AllocReadLC(TInt aResourceId) const; williamr@2: IMPORT_C void ConfirmSignatureL(TInt aSignature); williamr@2: IMPORT_C void ConfirmSignatureL(); williamr@2: IMPORT_C TInt SignatureL() const; // not available before Release 005 williamr@2: IMPORT_C TBool OwnsResourceId(TInt aResourceId) const; williamr@2: IMPORT_C TBool OwnsResourceIdL(TInt aResourceId) const; williamr@2: IMPORT_C void OpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize); williamr@2: inline TInt Offset() const; williamr@2: private: williamr@2: void DoOpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize); williamr@2: IMPORT_C TInt Offset2() const; williamr@2: RResourceFileImpl* Impl(); williamr@2: const RResourceFileImpl* Impl() const; williamr@2: private: williamr@2: enum williamr@2: { williamr@2: KRscFileSize = 24 williamr@2: }; williamr@2: TUint8 iImpl[KRscFileSize]; williamr@2: }; williamr@2: williamr@2: /** Returns the offset value defined for this resource file. williamr@2: williamr@2: This function must not be called until a call to ConfirmSignatureL() has williamr@2: completed successfully, otherwise the value returned by this function may williamr@2: be meaningless. williamr@2: williamr@2: @return The offset value defined for this resource file. williamr@2: @see RResourceFile::ConfirmSignatureL() */ williamr@2: inline TInt RResourceFile::Offset() const williamr@2: { williamr@2: return Offset2(); williamr@2: } williamr@2: williamr@2: #endif//__BARSC_H__