|
0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
2 |
// All rights reserved.
|
|
|
3 |
// This component and the accompanying materials are made available
|
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
|
5 |
// which accompanies this distribution, and is available
|
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
7 |
//
|
|
|
8 |
// Initial Contributors:
|
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
|
10 |
//
|
|
|
11 |
// Contributors:
|
|
|
12 |
//
|
|
|
13 |
// Description:
|
|
|
14 |
//
|
|
|
15 |
|
|
|
16 |
#include <e32base.h>
|
|
|
17 |
#include <mmf/common/mmfcontroller.h>
|
|
|
18 |
#include <mmf/common/speechrecognitioncustomcommands.h>
|
|
|
19 |
#include <mmf/common/speechrecognitiondataclient.h>
|
|
|
20 |
#include <mmf/common/speechrecognitiondatatest.h>
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
EXPORT_C CSDClientResult::~CSDClientResult()
|
|
|
24 |
{
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
CSDClientResult::CSDClientResult()
|
|
|
28 |
{
|
|
|
29 |
}
|
|
|
30 |
CSDClientResult::CSDClientResult(TGrammarID aGrammarID, TRuleID aRuleID)
|
|
|
31 |
: iGrammarID(aGrammarID),
|
|
|
32 |
iRuleID(aRuleID)
|
|
|
33 |
{
|
|
|
34 |
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
void CSDClientResult::ConstructL()
|
|
|
38 |
{
|
|
|
39 |
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
EXPORT_C CSDClientResult* CSDClientResult::NewLC()
|
|
|
43 |
{
|
|
|
44 |
CSDClientResult* self = new (ELeave) CSDClientResult;
|
|
|
45 |
CleanupStack::PushL(self);
|
|
|
46 |
self->ConstructL();
|
|
|
47 |
return self;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
EXPORT_C CSDClientResult* CSDClientResult::NewL()
|
|
|
51 |
{
|
|
|
52 |
CSDClientResult* self = CSDClientResult::NewLC();
|
|
|
53 |
CleanupStack::Pop(self);
|
|
|
54 |
return self;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
EXPORT_C CSDClientResult* CSDClientResult::NewLC(TGrammarID aGrammarID, TRuleID aRuleID)
|
|
|
58 |
{
|
|
|
59 |
CSDClientResult* self = new (ELeave) CSDClientResult(aGrammarID, aRuleID);
|
|
|
60 |
CleanupStack::PushL(self);
|
|
|
61 |
self->ConstructL();
|
|
|
62 |
return self;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
EXPORT_C CSDClientResult* CSDClientResult::NewL(TGrammarID aGrammarID, TRuleID aRuleID)
|
|
|
66 |
{
|
|
|
67 |
CSDClientResult* self = CSDClientResult::NewLC(aGrammarID, aRuleID);
|
|
|
68 |
CleanupStack::Pop(self);
|
|
|
69 |
return self;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
EXPORT_C void CSDClientResult::SetGrammarID(TGrammarID aGrammarID)
|
|
|
74 |
{
|
|
|
75 |
iGrammarID = aGrammarID;
|
|
|
76 |
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
EXPORT_C TGrammarID CSDClientResult::GrammarID() const
|
|
|
80 |
{
|
|
|
81 |
return iGrammarID;
|
|
|
82 |
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
EXPORT_C void CSDClientResult::SetRuleID(TRuleID aRuleID)
|
|
|
86 |
{
|
|
|
87 |
iRuleID = aRuleID;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
EXPORT_C TRuleID CSDClientResult::RuleID() const
|
|
|
91 |
{
|
|
|
92 |
return iRuleID;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
void CSDClientResult::ExternalizeL(RWriteStream& aStream) const
|
|
|
96 |
{
|
|
|
97 |
aStream.WriteUint32L(iGrammarID);
|
|
|
98 |
aStream.WriteUint32L(iRuleID);
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
void CSDClientResult::InternalizeL(RReadStream& aStream)
|
|
|
102 |
{
|
|
|
103 |
iGrammarID = static_cast<TGrammarID> (aStream.ReadUint32L());
|
|
|
104 |
iRuleID = static_cast<TRuleID>(aStream.ReadUint32L());
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
CSDClientResultSet::CSDClientResultSet()
|
|
|
108 |
{
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
EXPORT_C CSDClientResultSet::~CSDClientResultSet()
|
|
|
113 |
{
|
|
|
114 |
iResultArray.ResetAndDestroy();
|
|
|
115 |
delete iDiagnostic;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
EXPORT_C CSDClientResultSet* CSDClientResultSet::NewL()
|
|
|
119 |
{
|
|
|
120 |
CSDClientResultSet* self = CSDClientResultSet::NewLC();
|
|
|
121 |
CleanupStack::Pop(self);
|
|
|
122 |
return self;
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
EXPORT_C CSDClientResultSet* CSDClientResultSet::NewLC()
|
|
|
126 |
{
|
|
|
127 |
CSDClientResultSet* self = new (ELeave) CSDClientResultSet;
|
|
|
128 |
CleanupStack::PushL(self);
|
|
|
129 |
self->ConstructL();
|
|
|
130 |
return self;
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
EXPORT_C void CSDClientResultSet::SetMaxResultsL(TInt aMaxResults)
|
|
|
135 |
{
|
|
|
136 |
iMaxResults = aMaxResults;
|
|
|
137 |
if (iResultArray.Count() < iMaxResults)
|
|
|
138 |
{
|
|
|
139 |
TInt numAdd = iMaxResults - iResultArray.Count();
|
|
|
140 |
for (TInt i = 0;i<numAdd;i++)
|
|
|
141 |
{
|
|
|
142 |
CSDClientResult* result = CSDClientResult::NewLC();
|
|
|
143 |
User::LeaveIfError(iResultArray.Append(result));
|
|
|
144 |
CleanupStack::Pop(result);
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
}
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
EXPORT_C TInt CSDClientResultSet::MaxResults() const
|
|
|
152 |
{
|
|
|
153 |
return iMaxResults;
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
EXPORT_C const CSDClientResult& CSDClientResultSet::At(TInt aIndex) const
|
|
|
157 |
{
|
|
|
158 |
return *iResultArray[aIndex];
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
EXPORT_C void CSDClientResultSet::SetResultCount(TInt aResultCount)
|
|
|
162 |
{
|
|
|
163 |
iResultCount = aResultCount;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
EXPORT_C TInt CSDClientResultSet::ResultCount() const
|
|
|
167 |
{
|
|
|
168 |
return iResultCount;
|
|
|
169 |
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
EXPORT_C void CSDClientResultSet::SetDiagnostic(TDiagnostic& aDiagnostic)
|
|
|
173 |
{
|
|
|
174 |
iDiagnostic = &aDiagnostic;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
EXPORT_C const TDiagnostic& CSDClientResultSet::Diagnostic() const
|
|
|
178 |
{
|
|
|
179 |
return *iDiagnostic;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
EXPORT_C void CSDClientResultSet::ExternalizeL(RWriteStream& aStream) const
|
|
|
183 |
{
|
|
|
184 |
aStream.WriteUint32L(iMaxResults);
|
|
|
185 |
aStream.WriteUint32L(iResultCount);
|
|
|
186 |
for (TInt i=0;i<iMaxResults;i++)
|
|
|
187 |
iResultArray[i]->ExternalizeL(aStream);
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
EXPORT_C void CSDClientResultSet::InternalizeL(RReadStream& aStream)
|
|
|
191 |
{
|
|
|
192 |
iResultArray.ResetAndDestroy();
|
|
|
193 |
iMaxResults = aStream.ReadUint32L();
|
|
|
194 |
iResultCount = aStream.ReadUint32L();
|
|
|
195 |
for (TInt i=0;i<iMaxResults;i++)
|
|
|
196 |
{
|
|
|
197 |
CSDClientResult* clientResult = CSDClientResult::NewLC();
|
|
|
198 |
clientResult->InternalizeL(aStream);
|
|
|
199 |
User::LeaveIfError(iResultArray.Append(clientResult));
|
|
|
200 |
CleanupStack::Pop(clientResult);
|
|
|
201 |
}
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
void CSDClientResultSet::ConstructL()
|
|
|
205 |
{
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
enum TDllReason {};
|
|
|
209 |
EXPORT_C TInt E32Dll(TDllReason /* aReason */)
|
|
|
210 |
{
|
|
|
211 |
return (KErrNone);
|
|
|
212 |
}
|
|
|
213 |
|