|
1 /* |
|
2 * Copyright (c) 2004-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: Internal interface for TtsCommon |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef TTSCOMMONBODY_H |
|
21 #define TTSCOMMONBODY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 #include "srsfbldvariant.hrh" |
|
27 #include "ttscommonbody.h" |
|
28 #include "nssttscommon.h" |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Class to store parsed text for TTS. |
|
34 * |
|
35 * @lib ttscommon.lib |
|
36 * @since 2.8 |
|
37 */ |
|
38 class CTtsParsedTextBody : public CBase |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aText Text to be parsed. |
|
45 * @param aPhonemeSequence Corresponding phoneme sequence. |
|
46 * If the sequence is not given, it will be determined automatically. |
|
47 * @param aPhonemeNotation Identifier of phoneme notation. |
|
48 * If the descriptor is empty, the TTS engine will use default notation. |
|
49 */ |
|
50 static CTtsParsedTextBody* NewL( const TDesC& aText, |
|
51 const TDesC8& aPhonemeSequence, |
|
52 const TDesC& aPhonemeNotation); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CTtsParsedTextBody(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Adds new segment and takes its ownership. |
|
63 * @since 2.8 |
|
64 * @param aSegment A new segment.aIndex Index where to add segment. |
|
65 * If index is equal or larger than NumberOfSegments(), the segment will be added into end. |
|
66 * @return None |
|
67 */ |
|
68 void AddSegmentL( const TTtsSegment& aSegment, TInt aIndex ); |
|
69 |
|
70 /** |
|
71 * Deletes a segment |
|
72 * @since 2.8 |
|
73 * @param aIndex The index of segment to be deleted. The index must be 0..NumberOfSegments()-1. |
|
74 * @return None |
|
75 */ |
|
76 void DeleteSegmentL( TInt aIndex ); |
|
77 |
|
78 /** |
|
79 * Checks that the internal structure is valid. |
|
80 * @since 2.8 |
|
81 * @param None |
|
82 * @return ETrue if valid and EFalse if invalid. |
|
83 */ |
|
84 TBool IsValid() const; |
|
85 |
|
86 /** |
|
87 * Returns the number of segments. |
|
88 * @since 2.8 |
|
89 * @param None |
|
90 * @return The number of segments |
|
91 */ |
|
92 TInt NumberOfSegments() const; |
|
93 |
|
94 /** |
|
95 * Returns phoneme notation definition. |
|
96 * @since 2.8 |
|
97 * @param None |
|
98 * @return Notation descriptor. KNullDesC8 if none. |
|
99 */ |
|
100 const TDesC& PhonemeNotation() const; |
|
101 |
|
102 /** |
|
103 * Returns phoneme sequence. |
|
104 * @since 2.8 |
|
105 * @param None |
|
106 * @return Phoneme sequence. KNullDesC8 if none. |
|
107 */ |
|
108 const TDesC8& PhonemeSequence() const; |
|
109 |
|
110 /** |
|
111 * Returns segment from given index |
|
112 * @since 2.8 |
|
113 * @param aIndex The index of segment to be deleted. The index must be 0..NumberOfSegments()-1. |
|
114 * @return Requested segment. |
|
115 */ |
|
116 const TTtsSegment& SegmentL( TInt aIndex ) const; |
|
117 |
|
118 /** |
|
119 * Sets a phoneme notation. The descriptor is copied and can be released after the function call. |
|
120 * @since 2.8 |
|
121 * @param aPhonemeNotation Phoneme notation. |
|
122 * @return None |
|
123 */ |
|
124 void SetPhonemeNotationL( const TDesC& aPhonemeNotation ); |
|
125 |
|
126 /** |
|
127 * Sets a phoneme sequence. The descriptor is copied and can be released after the function call. |
|
128 * @since 2.8 |
|
129 * @param aPhonemeSequence Phoneme sequence. |
|
130 * @return None |
|
131 */ |
|
132 void SetPhonemeSequenceL( const TDesC8& aPhonemeSequence ); |
|
133 |
|
134 /** |
|
135 * Sets a text. The descriptor is copied and can be released after the function call. |
|
136 * @since 2.8 |
|
137 * @param aText Text. |
|
138 * @return None |
|
139 */ |
|
140 void SetTextL( const TDesC& aText ); |
|
141 |
|
142 /** |
|
143 * Returns text. |
|
144 * @since 2.8 |
|
145 * @param None |
|
146 * @return Text. KNullDesC8 if none. |
|
147 */ |
|
148 const TDesC& Text() const; |
|
149 |
|
150 private: |
|
151 |
|
152 /** |
|
153 * C++ default constructor. |
|
154 */ |
|
155 CTtsParsedTextBody(); |
|
156 |
|
157 /** |
|
158 * By default Symbian 2nd phase constructor is private. |
|
159 */ |
|
160 void ConstructL( const TDesC& aText, |
|
161 const TDesC8& aPhonemeSequence, |
|
162 const TDesC& aPhonemeNotation ); |
|
163 |
|
164 |
|
165 private: // Data |
|
166 // Buffer containing text |
|
167 HBufC* iText; |
|
168 |
|
169 // Buffer containing phoneme sequence |
|
170 HBufC8* iPhonemeSequence; |
|
171 |
|
172 // Buffer containing phoneme notation |
|
173 HBufC* iPhonemeNotation; |
|
174 |
|
175 // Array containing segments |
|
176 RArray<TTtsSegment> iSegmentArray; |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // TTSCOMMONBODY_H |
|
181 |
|
182 // End of File |