1 /* |
|
2 * Copyright (c) 2005 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: Class which contains localized voice command strings. Read |
|
15 * from a resource file. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef VCRESOURCE_H |
|
21 #define VCRESOURCE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * Class which contains localized voice command strings. Read |
|
31 * from a resource file. |
|
32 * |
|
33 */ |
|
34 NONSHARABLE_CLASS( CVcResource ) : public CBase |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. Leaves if resource file cannot be found. |
|
40 * |
|
41 * @param aRFs File system handle |
|
42 * @param aFileName Resource file name without any path info |
|
43 * and without any filename extension. |
|
44 */ |
|
45 static CVcResource* NewL( RFs& aRFs, const TDesC& aFileName ); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CVcResource(); |
|
51 |
|
52 public: // New functions |
|
53 |
|
54 /** |
|
55 * Gets the localized string based on an integer key value. |
|
56 * Ownership of the returned string is not transferred |
|
57 * |
|
58 * @param aKey Key integer |
|
59 * @return Reference to localized voice command string |
|
60 */ |
|
61 HBufC& GetCommandL( TInt aKey ); |
|
62 |
|
63 /** |
|
64 * Gets the localized string based on a descriptor key value. |
|
65 * Descriptor needs to contain numerical information. |
|
66 * Ownership of the returned string is not transferred |
|
67 * |
|
68 * @param aKey Key containing numerical information |
|
69 * @return Reference to localized voice command string |
|
70 */ |
|
71 HBufC& GetCommandL( const TDesC& aKey ); |
|
72 |
|
73 /** |
|
74 * Gets integer value based on descriptor key. |
|
75 * |
|
76 * @param aKey Key containing numerical information |
|
77 * @return Value for the key |
|
78 */ |
|
79 TInt GetValueL( const TDesC& aKey ); |
|
80 |
|
81 /** |
|
82 * Gets integer value based on integer key. |
|
83 * |
|
84 * @param aKey Key integer |
|
85 * @return Value for the key |
|
86 */ |
|
87 TInt GetValueL( TInt aKey ); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * C++ default constructor. |
|
93 * |
|
94 * @param aRFs File system handle |
|
95 */ |
|
96 CVcResource( RFs& aRFs ); |
|
97 |
|
98 /** |
|
99 * By default Symbian 2nd phase constructor is private. |
|
100 * |
|
101 * @param aFileName Resource file name |
|
102 */ |
|
103 void ConstructL( const TDesC& aFileName ); |
|
104 |
|
105 /** |
|
106 * Resolves the correct localized resource file name. |
|
107 * |
|
108 * @param aFileName Resource file name |
|
109 */ |
|
110 void ResolveResourceFileL( const TDesC& aFileName ); |
|
111 |
|
112 /** |
|
113 * Loads the resource file content |
|
114 * |
|
115 * @param aRfs File system handle |
|
116 * @param aFileName Resource file name |
|
117 */ |
|
118 void ReadResourceFileL( RFs& aRfs, const TDesC& aFileName ); |
|
119 |
|
120 private: // Data |
|
121 |
|
122 // List of keys |
|
123 RArray<TInt> iKeys; |
|
124 |
|
125 // List of localized strings |
|
126 RPointerArray<HBufC> iCommands; |
|
127 |
|
128 // List of keys to the integer array |
|
129 RArray<TInt> iIntegerKeys; |
|
130 |
|
131 // List of integer values |
|
132 RArray<TInt> iIntegerValues; |
|
133 |
|
134 // File system handle |
|
135 RFs& iRFs; |
|
136 }; |
|
137 |
|
138 #endif // VCRESOURCE_H |
|
139 |
|
140 // End of File |
|