epoc32/include/barsc.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __BARSC_H__
williamr@2
    17
#define __BARSC_H__
williamr@2
    18
williamr@2
    19
#include <f32file.h>
williamr@2
    20
williamr@2
    21
//Forward declarations
williamr@2
    22
class RResourceFileImpl;
williamr@2
    23
williamr@2
    24
/** Accesses a resource file and reads the resource data into a buffer. 
williamr@2
    25
williamr@2
    26
Interpretation of the data is achieved using the TResourceReader class.
williamr@2
    27
williamr@2
    28
RResourceFile instance behaviour when some problem occurs - it panics. Or asserts,
williamr@2
    29
if the used method is not "L" method.
williamr@2
    30
williamr@2
    31
Expected behaviour when assignment operator or copy constructor is called:
williamr@2
    32
The class doesn't have assignment operator and copy constructor, so the compiler generated
williamr@2
    33
ones will be used. The heap buffers used by the source class instance will be shared with the 
williamr@2
    34
destination class instance.
williamr@2
    35
williamr@2
    36
Expected behaviour when the RResourceFile instance is about to be destroyed:
williamr@2
    37
The class doesn't have destructor so compiler generated one will be used.
williamr@2
    38
Always call Close() to free allocated by the instance resources.
williamr@2
    39
williamr@2
    40
@see TResourceReader 
williamr@2
    41
@publishedAll
williamr@2
    42
@released
williamr@2
    43
*/
williamr@2
    44
class RResourceFile
williamr@2
    45
	{
williamr@2
    46
public:
williamr@2
    47
	IMPORT_C RResourceFile();
williamr@2
    48
	IMPORT_C void Close();
williamr@2
    49
	IMPORT_C void OpenL(RFs &aFs,const TDesC &aName);
williamr@2
    50
	IMPORT_C TUidType UidType() const;
williamr@2
    51
	IMPORT_C void ReadL(TDes8 &aDes,TInt aResourceId) const;
williamr@2
    52
	IMPORT_C HBufC8 *AllocReadL(TInt aResourceId) const;
williamr@2
    53
	IMPORT_C HBufC8 *AllocReadLC(TInt aResourceId) const;
williamr@2
    54
	IMPORT_C void ConfirmSignatureL(TInt aSignature);
williamr@2
    55
	IMPORT_C void ConfirmSignatureL();
williamr@2
    56
	IMPORT_C TInt SignatureL() const; // not available before Release 005
williamr@2
    57
	IMPORT_C TBool OwnsResourceId(TInt aResourceId) const;
williamr@2
    58
	IMPORT_C TBool OwnsResourceIdL(TInt aResourceId) const;
williamr@2
    59
	IMPORT_C void OpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize);
williamr@2
    60
	inline TInt Offset() const;
williamr@2
    61
private:
williamr@2
    62
	void DoOpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize);
williamr@2
    63
	IMPORT_C TInt Offset2() const;
williamr@2
    64
	RResourceFileImpl* Impl();
williamr@2
    65
	const RResourceFileImpl* Impl() const;
williamr@2
    66
private:
williamr@2
    67
	enum
williamr@2
    68
		{
williamr@2
    69
		KRscFileSize = 24
williamr@2
    70
		};
williamr@2
    71
	TUint8 iImpl[KRscFileSize];
williamr@2
    72
	};
williamr@2
    73
williamr@2
    74
/** Returns the offset value defined for this resource file. 
williamr@2
    75
   	
williamr@2
    76
This function must not be called until a call to ConfirmSignatureL() has 
williamr@2
    77
completed successfully, otherwise the value returned by this function may 
williamr@2
    78
be meaningless.
williamr@2
    79
williamr@2
    80
@return The offset value defined for this resource file.
williamr@2
    81
@see RResourceFile::ConfirmSignatureL() */
williamr@2
    82
inline TInt RResourceFile::Offset() const 
williamr@2
    83
	{ 
williamr@2
    84
	return Offset2(); 
williamr@2
    85
	}
williamr@2
    86
williamr@2
    87
#endif//__BARSC_H__