|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Utility class for TTS Plugin Body to read TTP data from file. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TTSPLUGINDATALOADER_H |
|
20 #define TTSPLUGINDATALOADER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include "srsfbldvariant.hrh" |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * Class to load TTP Data |
|
32 * |
|
33 * @lib TTSAlgorithm.lib |
|
34 */ |
|
35 class CTTSDataLoader : public CBase |
|
36 { |
|
37 public: // Constructors and destructor |
|
38 |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 */ |
|
42 static CTTSDataLoader* NewL( RFs& iFs, |
|
43 TFileName& aGeneralFileName, |
|
44 TFileName& aPrefixOfTTPFileName, |
|
45 TFileName& aPostfixOfTTPFilename, |
|
46 TFileName& aTTSFilename, |
|
47 TFileName& aPostfixOfTTSFilename ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CTTSDataLoader(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Function to load general configuration data. |
|
58 * |
|
59 * @param "TInt aDataID" Identifier of data package. |
|
60 * @return Pointer to created buffer, NULL if not found. |
|
61 */ |
|
62 HBufC8* LoadGeneralData( const TInt aPackageType, |
|
63 const TInt aDataID, |
|
64 TUint32 aStartPosition, |
|
65 TUint32 aEndPosition ); |
|
66 |
|
67 /** |
|
68 * Function to load configuration data of TTP method . |
|
69 * |
|
70 * @param "TLanguage aLanguage" Language specifying which data will be loaded |
|
71 * @return Pointer to created buffer, NULL if not found. |
|
72 */ |
|
73 HBufC8* LoadLanguageData( const TInt aPackageType, |
|
74 TLanguage aLanguage, |
|
75 TUint32 aStartPosition, |
|
76 TUint32 aEndPosition ); |
|
77 |
|
78 /** |
|
79 * Function to load TTS configuration data |
|
80 */ |
|
81 HBufC8* LoadTtsData( const TInt aPackageType, |
|
82 const TInt aDataID, |
|
83 TUint32 aStartPosition, |
|
84 TUint32 aEndPosition ); |
|
85 |
|
86 /** |
|
87 * Function to add supported languages to aLanguages |
|
88 */ |
|
89 void GetSupportedLanguagesL( RArray<TLanguage>& aLanguages ); |
|
90 |
|
91 protected: |
|
92 |
|
93 /** |
|
94 * Accesses the file. |
|
95 */ |
|
96 HBufC8* DoLoadL( TFileName& iFile, |
|
97 TUint32 aStartPosition, |
|
98 TUint32 aEndPosition ); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * C++ default constructor. |
|
104 */ |
|
105 CTTSDataLoader( RFs& iFs, |
|
106 TFileName& aGeneralFileName, |
|
107 TFileName& aPrefixOfTTPFileName, |
|
108 TFileName& aPostfixOfTTPFilename, |
|
109 TFileName& aTTSFilename, |
|
110 TFileName& aPostfixOfTTSFilename ); |
|
111 |
|
112 /** |
|
113 * By default Symbian 2nd phase constructor is private. |
|
114 */ |
|
115 void ConstructL(); |
|
116 |
|
117 /** |
|
118 * Helper function to add supported languages to aLanguages |
|
119 */ |
|
120 void DoGetSupportedLanguagesL( RArray<TLanguage>& aLanguages, |
|
121 TFileName& aMask ); |
|
122 |
|
123 /** |
|
124 * Helper function to create file name |
|
125 */ |
|
126 void PackageName (TFileName &aFileName, TUint32 aPackageType, TUint32 aPackageID); |
|
127 |
|
128 #ifdef __SIND_AUTOCONF_LID |
|
129 /** |
|
130 * Special loader for language identification data |
|
131 * @return Pointer to the loaded data |
|
132 * NULL if error occurs during loading |
|
133 */ |
|
134 HBufC8* ConstructLidDataL(); |
|
135 |
|
136 |
|
137 /** |
|
138 * Loads a file to the end of a buffer |
|
139 * @param aBuffer The buffer where to load the data |
|
140 * @param aPackageType Type identifier. |
|
141 * @param aPackageID Identifier of package. |
|
142 */ |
|
143 void AppendLoadL( CBufBase *aBuffer, TUint32 aPackageType, TUint32 aPackageID ); |
|
144 |
|
145 |
|
146 /** |
|
147 * Obtains the list of installed languages in the system and loads the corresponding data files |
|
148 * to the buffer. |
|
149 * @param aBuffer The buffer where to load the data |
|
150 */ |
|
151 void SysLangPackagesToBufferL( CBufBase *aBuffer ); |
|
152 |
|
153 #endif // __SIND_AUTOCONF_LID |
|
154 |
|
155 private: // Data |
|
156 |
|
157 // File name for general data |
|
158 TFileName iGeneralFileName; |
|
159 |
|
160 // Prefix of file name for ttp method data |
|
161 TFileName iPrefixOfTTPFileName; |
|
162 |
|
163 // Postfix of file name for ttp method data |
|
164 TFileName iPostfixOfTTPFileName; |
|
165 |
|
166 // TTS filename |
|
167 TFileName iTTSFileName; |
|
168 |
|
169 // Postfix of file name for tts data |
|
170 TFileName iPostfixOfTTSFileName; |
|
171 |
|
172 // File session |
|
173 RFs& iFs; |
|
174 |
|
175 }; |
|
176 |
|
177 #endif // TTSPLUGINDATALOADER_H |
|
178 |
|
179 // End of File |