|
1 // Copyright (c) 1997-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 __BARSC_H__ |
|
17 #define __BARSC_H__ |
|
18 |
|
19 #include <f32file.h> |
|
20 |
|
21 //Forward declarations |
|
22 class RResourceFileImpl; |
|
23 |
|
24 /** Accesses a resource file and reads the resource data into a buffer. |
|
25 |
|
26 Interpretation of the data is achieved using the TResourceReader class. |
|
27 |
|
28 RResourceFile instance behaviour when some problem occurs - it panics. Or asserts, |
|
29 if the used method is not "L" method. |
|
30 |
|
31 Expected behaviour when assignment operator or copy constructor is called: |
|
32 The class doesn't have assignment operator and copy constructor, so the compiler generated |
|
33 ones will be used. The heap buffers used by the source class instance will be shared with the |
|
34 destination class instance. |
|
35 |
|
36 Expected behaviour when the RResourceFile instance is about to be destroyed: |
|
37 The class doesn't have destructor so compiler generated one will be used. |
|
38 Always call Close() to free allocated by the instance resources. |
|
39 |
|
40 @see TResourceReader |
|
41 @publishedAll |
|
42 @released |
|
43 */ |
|
44 class RResourceFile |
|
45 { |
|
46 public: |
|
47 IMPORT_C RResourceFile(); |
|
48 IMPORT_C void Close(); |
|
49 IMPORT_C void OpenL(RFs &aFs,const TDesC &aName); |
|
50 IMPORT_C TUidType UidType() const; |
|
51 IMPORT_C void ReadL(TDes8 &aDes,TInt aResourceId) const; |
|
52 IMPORT_C HBufC8 *AllocReadL(TInt aResourceId) const; |
|
53 IMPORT_C HBufC8 *AllocReadLC(TInt aResourceId) const; |
|
54 IMPORT_C void ConfirmSignatureL(TInt aSignature); |
|
55 IMPORT_C void ConfirmSignatureL(); |
|
56 IMPORT_C TInt SignatureL() const; // not available before Release 005 |
|
57 IMPORT_C TBool OwnsResourceId(TInt aResourceId) const; |
|
58 IMPORT_C TBool OwnsResourceIdL(TInt aResourceId) const; |
|
59 IMPORT_C void OpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize); |
|
60 inline TInt Offset() const; |
|
61 private: |
|
62 void DoOpenL(RFs& aFs, const TDesC& aName, TUint aFileOffset, TInt aFileSize); |
|
63 IMPORT_C TInt Offset2() const; |
|
64 RResourceFileImpl* Impl(); |
|
65 const RResourceFileImpl* Impl() const; |
|
66 private: |
|
67 enum |
|
68 { |
|
69 KRscFileSize = 24 |
|
70 }; |
|
71 TUint8 iImpl[KRscFileSize]; |
|
72 }; |
|
73 |
|
74 /** Returns the offset value defined for this resource file. |
|
75 |
|
76 This function must not be called until a call to ConfirmSignatureL() has |
|
77 completed successfully, otherwise the value returned by this function may |
|
78 be meaningless. |
|
79 |
|
80 @return The offset value defined for this resource file. |
|
81 @see RResourceFile::ConfirmSignatureL() */ |
|
82 inline TInt RResourceFile::Offset() const |
|
83 { |
|
84 return Offset2(); |
|
85 } |
|
86 |
|
87 #endif//__BARSC_H__ |