1 /* |
|
2 * Copyright (c) 2007 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: Provides means to read strings from resource files. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MUSRESOURCEUTIL_H |
|
21 #define MUSRESOURCEUTIL_H |
|
22 |
|
23 |
|
24 #include "musunittesting.h" |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 /** Resource filename for musindicator.dll */ |
|
29 _LIT( KMusIndicatorResource, "musindicator.rsc" ); |
|
30 |
|
31 |
|
32 /** |
|
33 * MusResourceUtil retrieves strings from resourcefiles. |
|
34 * |
|
35 * @code |
|
36 * HBufC* text = ReadResourceString16L( R_SOME_STRING_ID, KResourceFileName ); |
|
37 * @endcode |
|
38 * |
|
39 * @lib musindicator.lib |
|
40 */ |
|
41 class MusResourceUtil |
|
42 { |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Reads resource string. |
|
48 * |
|
49 * @param aId Identifier of the resource to be read. |
|
50 * @param aFilename Name of used resource file. |
|
51 * @return Text containing resource string. Ownership is transferred. |
|
52 */ |
|
53 static HBufC16* ReadResourceString16LC( TUint aId, const TDesC& aFilename ); |
|
54 |
|
55 /** |
|
56 * Reads resource string. |
|
57 * |
|
58 * @param aId Identifier of the resource to be read. |
|
59 * @param aFilename Name of used resource file. |
|
60 * @return Text containing resource string. Ownership is transferred. |
|
61 */ |
|
62 static HBufC16* ReadResourceString16L( TUint aId, const TDesC& aFilename ); |
|
63 |
|
64 /** |
|
65 * Reads resource string. |
|
66 * |
|
67 * @param aId Identifier of the resource to be read. |
|
68 * @param aFilename Name of used resource file. |
|
69 * @return Text containing resource string. Ownership is transferred. |
|
70 */ |
|
71 static HBufC8* ReadResourceString8LC( TUint aId, const TDesC& aFilename ); |
|
72 |
|
73 /** |
|
74 * Reads resource string. |
|
75 * |
|
76 * @param aId Identifier of the resource to be read. |
|
77 * @param aFilename Name of used resource file. |
|
78 * @return Text containing resource string. Ownership is transferred. |
|
79 */ |
|
80 static HBufC8* ReadResourceString8L( TUint aId, const TDesC& aFilename ); |
|
81 |
|
82 /** |
|
83 * Converts HBufC8 to HBufC. |
|
84 * |
|
85 * @param aText Text to be converted. |
|
86 * @return Text converted text. Ownership is transferred. |
|
87 */ |
|
88 static HBufC* ConvertResourceStringLC( const TDesC8& aText ); |
|
89 |
|
90 /** |
|
91 * Constructs name of resource file. |
|
92 * |
|
93 * @param aFilename Name of resource file (eg. file.rsc). |
|
94 * @return Text containing resource filename. Ownership is transferred. |
|
95 */ |
|
96 static HBufC* ResourceFilenameLC( const TDesC& aFilename ); |
|
97 |
|
98 }; |
|
99 |
|
100 #endif // MUSRESOURCEUTIL_H |
|