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