24
|
1 |
/**
|
|
2 |
* Copyright (c) 2003-2009 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:
|
|
15 |
* Script Commands Header
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
/**
|
|
23 |
@file Scommand.h
|
|
24 |
@internalComponent
|
|
25 |
*/
|
|
26 |
|
|
27 |
#ifndef __SCOMMAND_H__
|
|
28 |
#define __SCOMMAND_H__
|
|
29 |
|
|
30 |
#include "SVARLAB.H"
|
|
31 |
#include "SCHCONV.H"
|
|
32 |
#include "SSCRREAD.H"
|
|
33 |
|
|
34 |
const TText KDollarChar='$';
|
|
35 |
const TText KUnderscoreChar='_';
|
|
36 |
|
|
37 |
// Forward declarations
|
|
38 |
|
|
39 |
class CScriptIO;
|
|
40 |
class CCommChatString;
|
|
41 |
class CScriptReader;
|
|
42 |
class CScriptExecutor;
|
|
43 |
|
|
44 |
|
|
45 |
class CScriptCommandBase : public CBase
|
|
46 |
/**
|
|
47 |
Base class for script commands. Uses a CScriptReader and a CScriptVarMan.
|
|
48 |
|
|
49 |
@internalComponent
|
|
50 |
*/
|
|
51 |
{
|
|
52 |
public:
|
|
53 |
CScriptCommandBase(TScriptStatus& aStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
54 |
~CScriptCommandBase();
|
|
55 |
virtual TBool ParseL() =0;
|
|
56 |
virtual void Cleanup();
|
|
57 |
protected:
|
|
58 |
virtual void ConstructL();
|
|
59 |
TPtrC ParseCompoundExpressionL(TInt& aOffset);
|
|
60 |
TPtrC ParseExpressionL(TInt& aOffset);
|
|
61 |
TPtrC ParseStringL(TInt& aOffset);
|
|
62 |
TPtrC ParseCharacterL(TInt& aOffset);
|
|
63 |
TPtrC ParseVariableL(TInt& aOffset);
|
|
64 |
TInt32 ParseIntegerL(TInt& aOffset);
|
|
65 |
TReal ParseRealL(TInt& aOffset);
|
|
66 |
TPtrC ParseCharacterTypeL(TInt& aOffset);
|
|
67 |
HBufC8* ConvertLC(const TDesC& aString,TInt& aOffset);
|
|
68 |
TInt FindTokenEnd(TInt aOffset);
|
|
69 |
TBool IsValidChar(const TText& aChar);
|
|
70 |
void EatSpaces(TInt& aOffset);
|
|
71 |
void EatSpacesAndLinesL();
|
|
72 |
void EatSpacesAndLinesAndCommentsL();
|
|
73 |
void SetStatus(TInt& aOffset,TPtrC& aLine,TBool& aSkip,TBool& aSkipModeToggleReq);
|
|
74 |
void SetStatus(const TScriptStatus& aStatus);
|
|
75 |
private:
|
|
76 |
TPtrC ParseEnclosedStringL(TInt& aOffset,TText aEndChar,TInt aError);
|
|
77 |
protected:
|
|
78 |
CScriptReader* iScriptReader;
|
|
79 |
CScriptVarMan* iVarMan;
|
|
80 |
CScriptVarMan* iConvertedVarMan;
|
|
81 |
CScriptCharacterConverter* iCharConv;
|
|
82 |
TInt iTempVarNum;
|
|
83 |
TScriptStatus iStatus;
|
|
84 |
};
|
|
85 |
|
|
86 |
|
|
87 |
class CSetCommand : public CScriptCommandBase
|
|
88 |
/**
|
|
89 |
Executes SET command. One of these per CScriptExecutor object.
|
|
90 |
|
|
91 |
@internalComponent
|
|
92 |
*/
|
|
93 |
{
|
|
94 |
public:
|
|
95 |
static CSetCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
96 |
CSetCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
97 |
~CSetCommand();
|
|
98 |
// CScriptCommandBase
|
|
99 |
virtual TBool ParseL();
|
|
100 |
};
|
|
101 |
|
|
102 |
|
|
103 |
class CSendCommand: public CScriptCommandBase
|
|
104 |
/**
|
|
105 |
Executes SEND command. One of these per CScriptExecutor object. Uses CScriptIO object.
|
|
106 |
|
|
107 |
@internalComponent
|
|
108 |
*/
|
|
109 |
{
|
|
110 |
public:
|
|
111 |
static CSendCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO);
|
|
112 |
CSendCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO);
|
|
113 |
~CSendCommand();
|
|
114 |
// CScriptCommandBase
|
|
115 |
virtual TBool ParseL();
|
|
116 |
private:
|
|
117 |
CScriptIO* iScriptIO;
|
|
118 |
TPtrC8 iSendString;
|
|
119 |
};
|
|
120 |
|
|
121 |
|
|
122 |
class CLabelSearch : public CBase
|
|
123 |
/**
|
|
124 |
@internalComponent
|
|
125 |
*/
|
|
126 |
{
|
|
127 |
public:
|
|
128 |
enum TLabelSearchStatus {
|
|
129 |
ENotFound =-1,
|
|
130 |
EResolved
|
|
131 |
};
|
|
132 |
public:
|
|
133 |
static CLabelSearch* NewLC(const TDesC& aLabelName);
|
|
134 |
~CLabelSearch();
|
|
135 |
inline TPtr LabelName() const;
|
|
136 |
inline CCommChatString* ChatString() const;
|
|
137 |
void CreateCommChatStringL(const TDesC8& aDes,TBool aIsFolded);
|
|
138 |
inline void Set(TLabelSearchStatus aStatus,const TLinePosition& aPosition);
|
|
139 |
private:
|
|
140 |
CLabelSearch();
|
|
141 |
void ConstructL(const TDesC& aLabelName);
|
|
142 |
private:
|
|
143 |
CCommChatString* iChatString;
|
|
144 |
HBufC* iLabelName;
|
|
145 |
TLabelSearchStatus iStatus;
|
|
146 |
TLinePosition iPosition;
|
|
147 |
};
|
|
148 |
|
|
149 |
typedef CArrayFixFlat<CLabelSearch*> CLabelSearchArray;
|
|
150 |
|
|
151 |
|
|
152 |
class CWaitCommand: public CScriptCommandBase
|
|
153 |
/**
|
|
154 |
Executes WAIT command. One of these per CScriptExecutor object. Uses CScriptIO
|
|
155 |
object and CScriptLabelMan.
|
|
156 |
|
|
157 |
@internalComponent
|
|
158 |
*/
|
|
159 |
{
|
|
160 |
public:
|
|
161 |
static CWaitCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO,CScriptLabelMan* aLabelMan, CScriptExecutor* aScriptExec);
|
|
162 |
CWaitCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO,CScriptLabelMan* aLabelMan, CScriptExecutor* aScriptExec);
|
|
163 |
~CWaitCommand();
|
|
164 |
// CScriptCommandBase
|
|
165 |
virtual TBool ParseL();
|
|
166 |
virtual void Cleanup();
|
|
167 |
TPtrC LabelFromIndexL(TInt aIndex);
|
|
168 |
private:
|
|
169 |
void ParseActionL();
|
|
170 |
void ParseSkipL();
|
|
171 |
CLabelSearch* ParseLabelLC();
|
|
172 |
void DeleteLabelArray();
|
|
173 |
private:
|
|
174 |
CScriptIO* iScriptIO;
|
|
175 |
CScriptLabelMan* iLabelMan;
|
|
176 |
CLabelSearchArray* iLabelArray;
|
|
177 |
CScriptExecutor* iScriptExec;
|
|
178 |
};
|
|
179 |
|
|
180 |
|
|
181 |
class CLoopCommand: public CScriptCommandBase
|
|
182 |
/**
|
|
183 |
Executes LOOP command. One of these per CScriptExecutor object.
|
|
184 |
|
|
185 |
@internalComponent
|
|
186 |
*/
|
|
187 |
{
|
|
188 |
public:
|
|
189 |
static CLoopCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
190 |
CLoopCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
191 |
~CLoopCommand();
|
|
192 |
// CScriptCommandase
|
|
193 |
virtual TBool ParseL();
|
|
194 |
//
|
|
195 |
TBool CheckLoopL();
|
|
196 |
inline void Loop(TBool aLoop);
|
|
197 |
private:
|
|
198 |
TBool iLoop;
|
|
199 |
TLinePosition iLoopPosition;
|
|
200 |
TInt iLoopCounter;
|
|
201 |
};
|
|
202 |
|
|
203 |
|
|
204 |
class CGotoCommand: public CScriptCommandBase
|
|
205 |
/**
|
|
206 |
Executes GOTO command. One of these per CScriptExecutor object. Uses a
|
|
207 |
CScriptLabelMan object.
|
|
208 |
|
|
209 |
@internalComponent
|
|
210 |
*/
|
|
211 |
{
|
|
212 |
public:
|
|
213 |
static CGotoCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader, CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptLabelMan* aLabelMan);
|
|
214 |
CGotoCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader, CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptLabelMan* aLabelMan);
|
|
215 |
~CGotoCommand();
|
|
216 |
// CScriptCommandBase
|
|
217 |
virtual TBool ParseL();
|
|
218 |
void Goto(const TDesC& aLabelName);
|
|
219 |
TBool ParseLabelL();
|
|
220 |
void ServiceSkipReqs();
|
|
221 |
private:
|
|
222 |
CScriptLabelMan* iLabelMan;
|
|
223 |
TBuf<KMaxLabelLength> iSearchName;
|
|
224 |
};
|
|
225 |
|
|
226 |
|
|
227 |
class CDTRCommand : public CScriptCommandBase
|
|
228 |
/**
|
|
229 |
Executes DTR command. One of these per CScriptExecutor object. Uses a CScriptIO object.
|
|
230 |
|
|
231 |
@internalComponent
|
|
232 |
*/
|
|
233 |
{
|
|
234 |
public:
|
|
235 |
static CDTRCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO);
|
|
236 |
CDTRCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptIO* aScriptIO);
|
|
237 |
~CDTRCommand();
|
|
238 |
// CScriptCommandBase
|
|
239 |
virtual TBool ParseL();
|
|
240 |
private:
|
|
241 |
CScriptIO* iScriptIO;
|
|
242 |
};
|
|
243 |
|
|
244 |
|
|
245 |
class CReadPCTCommand : public CScriptCommandBase
|
|
246 |
/**
|
|
247 |
Esecutes READ command. One of these per CScriptExecutor object. Uses a CScriptIO object.
|
|
248 |
|
|
249 |
@internalComponent
|
|
250 |
*/
|
|
251 |
{
|
|
252 |
public:
|
|
253 |
static CReadPCTCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptExecutor* aScriptExec);
|
|
254 |
CReadPCTCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv,CScriptExecutor* aScriptExec);
|
|
255 |
~CReadPCTCommand();
|
|
256 |
// CScriptCommandBase
|
|
257 |
virtual TBool ParseL();
|
|
258 |
//
|
|
259 |
TBool CheckReadL();
|
|
260 |
TPtrC CharSet();
|
|
261 |
private:
|
|
262 |
CScriptExecutor* iScriptExec;
|
|
263 |
TBuf<KMaxCharacterTypeLength> iCharSet;
|
|
264 |
};
|
|
265 |
|
|
266 |
|
|
267 |
class CCharMapCommand : public CScriptCommandBase
|
|
268 |
/**
|
|
269 |
Executes CHARMAP command. One of these per CScriptExecutor object.
|
|
270 |
|
|
271 |
@internalComponent
|
|
272 |
*/
|
|
273 |
{
|
|
274 |
public:
|
|
275 |
static CCharMapCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
276 |
CCharMapCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
277 |
~CCharMapCommand();
|
|
278 |
// CScriptCommandBase
|
|
279 |
virtual TBool ParseL();
|
|
280 |
};
|
|
281 |
|
|
282 |
class CExitCommand: public CScriptCommandBase
|
|
283 |
/**
|
|
284 |
Executes EXIT command. One of these per CScriptExecutor object.
|
|
285 |
|
|
286 |
@internalComponent
|
|
287 |
*/
|
|
288 |
{
|
|
289 |
public:
|
|
290 |
static CExitCommand* NewL(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
291 |
CExitCommand(TScriptStatus& aScriptStatus,CScriptReader* aScriptReader,CScriptVarMan* aVarMan,CScriptCharacterConverter* aCharConv);
|
|
292 |
~CExitCommand();
|
|
293 |
// CScriptCommandBase
|
|
294 |
virtual TBool ParseL();
|
|
295 |
};
|
|
296 |
|
|
297 |
#include "SCOMMAND.INL"
|
|
298 |
|
|
299 |
#endif
|