sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "T_ParseBaseData.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
// Commands
|
sl@0
|
22 |
|
sl@0
|
23 |
_LIT( KCmdDrive, "Drive" );
|
sl@0
|
24 |
_LIT( KCmdDriveAndPath, "DriveAndPath" );
|
sl@0
|
25 |
_LIT( KCmdDrivePresent, "DrivePresent" );
|
sl@0
|
26 |
_LIT( KCmdExt, "Ext" );
|
sl@0
|
27 |
_LIT( KCmdExtPresent, "ExtPresent" );
|
sl@0
|
28 |
_LIT( KCmdFullName, "FullName" );
|
sl@0
|
29 |
_LIT( KCmdIsExtWild, "IsExtWild" );
|
sl@0
|
30 |
_LIT( KCmdIsKMatchAny, "IsKMatchAny" );
|
sl@0
|
31 |
_LIT( KCmdIsKMatchOne, "IsKMatchOne" );
|
sl@0
|
32 |
_LIT( KCmdIsNameWild, "IsNameWild" );
|
sl@0
|
33 |
_LIT( KCmdIsRoot, "IsRoot" );
|
sl@0
|
34 |
_LIT( KCmdIsWild, "IsWild" );
|
sl@0
|
35 |
_LIT( KCmdName, "Name" );
|
sl@0
|
36 |
_LIT( KCmdNameAndExt, "NameAndExt" );
|
sl@0
|
37 |
_LIT( KCmdNameOrExtPresent, "NameOrExtPresent" );
|
sl@0
|
38 |
_LIT( KCmdNamePresent, "NamePresent" );
|
sl@0
|
39 |
_LIT( KCmdPath, "Path" );
|
sl@0
|
40 |
_LIT( KCmdPathPresent, "PathPresent" );
|
sl@0
|
41 |
|
sl@0
|
42 |
// Parameters
|
sl@0
|
43 |
_LIT( KParamExpected, "expected" );
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
CT_ParseBaseData::~CT_ParseBaseData()
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
* Destructor.
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
{
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
TAny* CT_ParseBaseData::GetObject()
|
sl@0
|
55 |
/**
|
sl@0
|
56 |
* Return a pointer to the object that the data wraps
|
sl@0
|
57 |
*
|
sl@0
|
58 |
* @return pointer to the object that the data wraps
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
{
|
sl@0
|
61 |
return GetParse();
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
TBool CT_ParseBaseData::DoCommandL( const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/ )
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Process a command read from the ini file
|
sl@0
|
67 |
*
|
sl@0
|
68 |
* @param aCommand the command to process
|
sl@0
|
69 |
* @param aSection the entry in the ini file requiring the command to be processed
|
sl@0
|
70 |
*
|
sl@0
|
71 |
* @return ETrue if the command is processed
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
{
|
sl@0
|
74 |
TBool retVal = ETrue;
|
sl@0
|
75 |
|
sl@0
|
76 |
|
sl@0
|
77 |
if ( aCommand == KCmdDrive )
|
sl@0
|
78 |
{
|
sl@0
|
79 |
DoCmdDrive( aSection );
|
sl@0
|
80 |
}
|
sl@0
|
81 |
else if ( aCommand == KCmdDriveAndPath )
|
sl@0
|
82 |
{
|
sl@0
|
83 |
DoCmdDriveAndPath( aSection );
|
sl@0
|
84 |
}
|
sl@0
|
85 |
else if ( aCommand == KCmdDrivePresent )
|
sl@0
|
86 |
{
|
sl@0
|
87 |
DoCmdDrivePresent( aSection );
|
sl@0
|
88 |
}
|
sl@0
|
89 |
else if ( aCommand == KCmdExt )
|
sl@0
|
90 |
{
|
sl@0
|
91 |
DoCmdExt( aSection );
|
sl@0
|
92 |
}
|
sl@0
|
93 |
else if ( aCommand == KCmdExtPresent )
|
sl@0
|
94 |
{
|
sl@0
|
95 |
DoCmdExtPresent( aSection );
|
sl@0
|
96 |
}
|
sl@0
|
97 |
else if ( aCommand == KCmdFullName )
|
sl@0
|
98 |
{
|
sl@0
|
99 |
DoCmdFullName( aSection );
|
sl@0
|
100 |
}
|
sl@0
|
101 |
else if ( aCommand == KCmdIsKMatchAny )
|
sl@0
|
102 |
{
|
sl@0
|
103 |
DoCmdIsKMatchAny( aSection );
|
sl@0
|
104 |
}
|
sl@0
|
105 |
else if ( aCommand == KCmdIsKMatchOne )
|
sl@0
|
106 |
{
|
sl@0
|
107 |
DoCmdIsKMatchOne( aSection );
|
sl@0
|
108 |
}
|
sl@0
|
109 |
else if ( aCommand == KCmdIsExtWild )
|
sl@0
|
110 |
{
|
sl@0
|
111 |
DoCmdIsExtWild( aSection );
|
sl@0
|
112 |
}
|
sl@0
|
113 |
else if ( aCommand == KCmdIsNameWild )
|
sl@0
|
114 |
{
|
sl@0
|
115 |
DoCmdIsNameWild( aSection );
|
sl@0
|
116 |
}
|
sl@0
|
117 |
else if ( aCommand == KCmdIsRoot)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
DoCmdIsRoot( aSection );
|
sl@0
|
120 |
}
|
sl@0
|
121 |
else if ( aCommand == KCmdIsWild )
|
sl@0
|
122 |
{
|
sl@0
|
123 |
DoCmdIsWild( aSection );
|
sl@0
|
124 |
}
|
sl@0
|
125 |
else if ( aCommand == KCmdName )
|
sl@0
|
126 |
{
|
sl@0
|
127 |
DoCmdName( aSection );
|
sl@0
|
128 |
}
|
sl@0
|
129 |
else if ( aCommand == KCmdNameAndExt )
|
sl@0
|
130 |
{
|
sl@0
|
131 |
DoCmdNameAndExt( aSection );
|
sl@0
|
132 |
}
|
sl@0
|
133 |
else if ( aCommand == KCmdNameOrExtPresent )
|
sl@0
|
134 |
{
|
sl@0
|
135 |
DoCmdNameOrExtPresent( aSection );
|
sl@0
|
136 |
}
|
sl@0
|
137 |
else if ( aCommand == KCmdNamePresent )
|
sl@0
|
138 |
{
|
sl@0
|
139 |
DoCmdNamePresent( aSection );
|
sl@0
|
140 |
}
|
sl@0
|
141 |
else if ( aCommand == KCmdPath )
|
sl@0
|
142 |
{
|
sl@0
|
143 |
DoCmdPath( aSection );
|
sl@0
|
144 |
}
|
sl@0
|
145 |
else if ( aCommand == KCmdPathPresent )
|
sl@0
|
146 |
{
|
sl@0
|
147 |
DoCmdPathPresent( aSection );
|
sl@0
|
148 |
}
|
sl@0
|
149 |
else
|
sl@0
|
150 |
{
|
sl@0
|
151 |
retVal = EFalse;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
return retVal;
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
|
sl@0
|
158 |
void CT_ParseBaseData::DoCmdDrive( const TDesC& aSection )
|
sl@0
|
159 |
/** Gets the drive letter using Drive(). */
|
sl@0
|
160 |
{
|
sl@0
|
161 |
INFO_PRINTF1( _L( "Drive()" ) );
|
sl@0
|
162 |
|
sl@0
|
163 |
TPtrC result = GetParse()->Drive();
|
sl@0
|
164 |
INFO_PRINTF2(_L("Drive() return: %S"), &result);
|
sl@0
|
165 |
|
sl@0
|
166 |
TPtrC expected;
|
sl@0
|
167 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
168 |
{
|
sl@0
|
169 |
if ( result != expected )
|
sl@0
|
170 |
{
|
sl@0
|
171 |
ERR_PRINTF3(_L("Drive() returns %S but expected %S"), &result, &expected);
|
sl@0
|
172 |
SetBlockResult( EFail);
|
sl@0
|
173 |
}
|
sl@0
|
174 |
}
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
void CT_ParseBaseData::DoCmdDriveAndPath( const TDesC& aSection )
|
sl@0
|
178 |
/** Gets the path and drive letter using DriveAndPath(). */
|
sl@0
|
179 |
{
|
sl@0
|
180 |
INFO_PRINTF1( _L( "DriveAndPath()" ) );
|
sl@0
|
181 |
|
sl@0
|
182 |
TPtrC result = GetParse()->DriveAndPath();
|
sl@0
|
183 |
INFO_PRINTF2(_L("DriveAndPath() return: %S"), &result);
|
sl@0
|
184 |
|
sl@0
|
185 |
TPtrC expected;
|
sl@0
|
186 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
187 |
{
|
sl@0
|
188 |
if ( result != expected )
|
sl@0
|
189 |
{
|
sl@0
|
190 |
ERR_PRINTF3(_L("DriveAndPath() returns %S but expected %S"), &result, &expected);
|
sl@0
|
191 |
SetBlockResult( EFail);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
void CT_ParseBaseData::DoCmdDrivePresent( const TDesC& aSection )
|
sl@0
|
199 |
/** Tests whether a drive is present using DrivePresent(). */
|
sl@0
|
200 |
{
|
sl@0
|
201 |
INFO_PRINTF1( _L( "DrivePresent()" ) );
|
sl@0
|
202 |
|
sl@0
|
203 |
TBool result = GetParse()->DrivePresent();
|
sl@0
|
204 |
|
sl@0
|
205 |
TPtrC strIsTrue = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
206 |
INFO_PRINTF2(_L("DrivePresent() return: %S"), &strIsTrue);
|
sl@0
|
207 |
|
sl@0
|
208 |
TBool expected;
|
sl@0
|
209 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
210 |
{
|
sl@0
|
211 |
if ( (result>0) != (expected>0) )
|
sl@0
|
212 |
{
|
sl@0
|
213 |
ERR_PRINTF3(_L("DrivePresent() returns %d but expected %d"), result, expected);
|
sl@0
|
214 |
SetBlockResult( EFail);
|
sl@0
|
215 |
}
|
sl@0
|
216 |
}
|
sl@0
|
217 |
}
|
sl@0
|
218 |
|
sl@0
|
219 |
void CT_ParseBaseData::DoCmdExt( const TDesC& aSection )
|
sl@0
|
220 |
/** Gets the file extension using Ext(). */
|
sl@0
|
221 |
{
|
sl@0
|
222 |
INFO_PRINTF1( _L( "Ext()" ) );
|
sl@0
|
223 |
|
sl@0
|
224 |
TPtrC result = GetParse()->Ext();
|
sl@0
|
225 |
INFO_PRINTF2(_L("Ext() returns: %S"), &result);
|
sl@0
|
226 |
|
sl@0
|
227 |
TPtrC expected;
|
sl@0
|
228 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
229 |
{
|
sl@0
|
230 |
if ( result != expected )
|
sl@0
|
231 |
{
|
sl@0
|
232 |
ERR_PRINTF3(_L("Ext() returns %S but expected %S"), &result, &expected);
|
sl@0
|
233 |
SetBlockResult( EFail);
|
sl@0
|
234 |
}
|
sl@0
|
235 |
}
|
sl@0
|
236 |
}
|
sl@0
|
237 |
|
sl@0
|
238 |
void CT_ParseBaseData::DoCmdExtPresent( const TDesC& aSection )
|
sl@0
|
239 |
/** Tests whether an extension is present using ExtPresent(). */
|
sl@0
|
240 |
{
|
sl@0
|
241 |
INFO_PRINTF1( _L( "ExtPresent()" ) );
|
sl@0
|
242 |
|
sl@0
|
243 |
TBool result = GetParse()->ExtPresent();
|
sl@0
|
244 |
|
sl@0
|
245 |
TPtrC strIsTrue = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
246 |
INFO_PRINTF2(_L("ExtPresent() return: %S"), &strIsTrue);
|
sl@0
|
247 |
|
sl@0
|
248 |
TBool expected;
|
sl@0
|
249 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
250 |
{
|
sl@0
|
251 |
if ( (result>0) != (expected>0) )
|
sl@0
|
252 |
{
|
sl@0
|
253 |
ERR_PRINTF3(_L("ExtPresent() returns %d but expected %d"), result, expected);
|
sl@0
|
254 |
SetBlockResult( EFail);
|
sl@0
|
255 |
}
|
sl@0
|
256 |
}
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
void CT_ParseBaseData::DoCmdFullName( const TDesC& aSection )
|
sl@0
|
260 |
/** Gets the complete file specification using FullName(). */
|
sl@0
|
261 |
{
|
sl@0
|
262 |
INFO_PRINTF1( _L( "FullName()" ) );
|
sl@0
|
263 |
|
sl@0
|
264 |
TPtrC result = GetParse()->FullName();
|
sl@0
|
265 |
INFO_PRINTF2(_L("FullName() return: %S"), &result);
|
sl@0
|
266 |
|
sl@0
|
267 |
TPtrC expected;
|
sl@0
|
268 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
269 |
{
|
sl@0
|
270 |
if ( result != expected )
|
sl@0
|
271 |
{
|
sl@0
|
272 |
ERR_PRINTF3(_L("FullName() returns %S but expected %S"), &result, &expected);
|
sl@0
|
273 |
SetBlockResult( EFail);
|
sl@0
|
274 |
}
|
sl@0
|
275 |
}
|
sl@0
|
276 |
}
|
sl@0
|
277 |
|
sl@0
|
278 |
void CT_ParseBaseData::DoCmdIsExtWild( const TDesC& aSection )
|
sl@0
|
279 |
/** Tests whether the extension in the fully parsed specification contains one or
|
sl@0
|
280 |
* more wildcard characters using IsExtWild()
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
{
|
sl@0
|
283 |
INFO_PRINTF1( _L( "IsExtWild()" ) );
|
sl@0
|
284 |
|
sl@0
|
285 |
TBool result = GetParse()->IsExtWild();
|
sl@0
|
286 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
287 |
INFO_PRINTF2(_L("IsExtWild() return: %S"), &temp);
|
sl@0
|
288 |
|
sl@0
|
289 |
TBool expected;
|
sl@0
|
290 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
291 |
{
|
sl@0
|
292 |
//NB! IsExtWild can return values >1
|
sl@0
|
293 |
if ( (result>0) != (expected>0) )
|
sl@0
|
294 |
{
|
sl@0
|
295 |
ERR_PRINTF3(_L("IsExtWild() returns %S but expected %S"), &result, &expected);
|
sl@0
|
296 |
SetBlockResult( EFail);
|
sl@0
|
297 |
}
|
sl@0
|
298 |
}
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
void CT_ParseBaseData::DoCmdIsKMatchAny( const TDesC& aSection )
|
sl@0
|
302 |
/** Tests whether the name or the extension contains asterisk wildcards usinbg IsKMatchAny(). */
|
sl@0
|
303 |
{
|
sl@0
|
304 |
INFO_PRINTF1( _L( "IsKMatchAny()" ) );
|
sl@0
|
305 |
|
sl@0
|
306 |
TBool result = GetParse()->IsKMatchAny();
|
sl@0
|
307 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
308 |
INFO_PRINTF2(_L("IsKMatchAny() return: %S"), &temp);
|
sl@0
|
309 |
|
sl@0
|
310 |
TBool expected;
|
sl@0
|
311 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
312 |
{
|
sl@0
|
313 |
if ( (result>0) != (expected>0) )
|
sl@0
|
314 |
{
|
sl@0
|
315 |
ERR_PRINTF3(_L("IsKMatchAny() returns %d but expected %d"), result, expected);
|
sl@0
|
316 |
SetBlockResult( EFail);
|
sl@0
|
317 |
}
|
sl@0
|
318 |
}
|
sl@0
|
319 |
}
|
sl@0
|
320 |
|
sl@0
|
321 |
void CT_ParseBaseData::DoCmdIsKMatchOne( const TDesC& aSection )
|
sl@0
|
322 |
/** Tests whether the name or the extension contains a question mark wildcard using IsKMatchOne() */
|
sl@0
|
323 |
{
|
sl@0
|
324 |
INFO_PRINTF1( _L( "IsKMatchOne()" ) );
|
sl@0
|
325 |
|
sl@0
|
326 |
TBool result = GetParse()->IsKMatchOne();
|
sl@0
|
327 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
328 |
INFO_PRINTF2(_L("IsKMatchOne() return: %S"), &temp);
|
sl@0
|
329 |
|
sl@0
|
330 |
TBool expected;
|
sl@0
|
331 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
332 |
{
|
sl@0
|
333 |
if ( (result>0) != (expected>0) )
|
sl@0
|
334 |
{
|
sl@0
|
335 |
ERR_PRINTF3(_L("IsKMatchOne() returns %d but expected %d"), result, expected);
|
sl@0
|
336 |
SetBlockResult( EFail);
|
sl@0
|
337 |
}
|
sl@0
|
338 |
}
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
void CT_ParseBaseData::DoCmdIsNameWild( const TDesC& aSection )
|
sl@0
|
342 |
/** Tests whether the filename in the fully parsed specification contains one or more wildcard
|
sl@0
|
343 |
* characters using IsNameWild()
|
sl@0
|
344 |
*/
|
sl@0
|
345 |
{
|
sl@0
|
346 |
INFO_PRINTF1( _L( "IsNameWild()" ) );
|
sl@0
|
347 |
|
sl@0
|
348 |
TBool result = GetParse()->IsNameWild();
|
sl@0
|
349 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
350 |
INFO_PRINTF2(_L("IsNameWild() return: %S"), &temp);
|
sl@0
|
351 |
|
sl@0
|
352 |
TBool expected;
|
sl@0
|
353 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
354 |
{
|
sl@0
|
355 |
if ( (result>0) != (expected>0) )
|
sl@0
|
356 |
{
|
sl@0
|
357 |
ERR_PRINTF3(_L("IsNameWild() returns %d but expected %d"), result, expected);
|
sl@0
|
358 |
SetBlockResult( EFail);
|
sl@0
|
359 |
}
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
|
sl@0
|
363 |
void CT_ParseBaseData::DoCmdIsRoot( const TDesC& aSection )
|
sl@0
|
364 |
/** Tests whether the path in the fully parsed specification is the root directory using IsRoot(). */
|
sl@0
|
365 |
{
|
sl@0
|
366 |
INFO_PRINTF1( _L( "IsRoot()" ) );
|
sl@0
|
367 |
|
sl@0
|
368 |
TBool result = GetParse()->IsRoot();
|
sl@0
|
369 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
370 |
INFO_PRINTF2(_L("IsRoot() return: %S"), &temp);
|
sl@0
|
371 |
|
sl@0
|
372 |
TBool expected;
|
sl@0
|
373 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
374 |
{
|
sl@0
|
375 |
if ( (result>0) != (expected>0) )
|
sl@0
|
376 |
{
|
sl@0
|
377 |
ERR_PRINTF3(_L("IsRoot() returns %d but expected %d"), result, expected);
|
sl@0
|
378 |
SetBlockResult( EFail);
|
sl@0
|
379 |
}
|
sl@0
|
380 |
}
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
void CT_ParseBaseData::DoCmdIsWild( const TDesC& aSection )
|
sl@0
|
384 |
/** Tests whether the filename or the extension in the fully parsed specification contains one or
|
sl@0
|
385 |
* more wildcard characters using IsWild()
|
sl@0
|
386 |
*/
|
sl@0
|
387 |
{
|
sl@0
|
388 |
INFO_PRINTF1( _L( "IsWild()" ) );
|
sl@0
|
389 |
|
sl@0
|
390 |
TBool result = GetParse()->IsWild();
|
sl@0
|
391 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
392 |
INFO_PRINTF2(_L("IsWild() return: %S"), &temp);
|
sl@0
|
393 |
|
sl@0
|
394 |
TBool expected;
|
sl@0
|
395 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
396 |
{
|
sl@0
|
397 |
if ( (result>0) != (expected>0) )
|
sl@0
|
398 |
{
|
sl@0
|
399 |
ERR_PRINTF3(_L("IsWild() returns %d but expected %d"), result, expected);
|
sl@0
|
400 |
SetBlockResult( EFail);
|
sl@0
|
401 |
}
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
void CT_ParseBaseData::DoCmdName( const TDesC& aSection )
|
sl@0
|
407 |
/** Gets the file name using Name(). */
|
sl@0
|
408 |
{
|
sl@0
|
409 |
INFO_PRINTF1( _L( "Name()" ) );
|
sl@0
|
410 |
|
sl@0
|
411 |
TPtrC result = GetParse()->Name();
|
sl@0
|
412 |
INFO_PRINTF2(_L( "Name() return: %S" ), &result);
|
sl@0
|
413 |
|
sl@0
|
414 |
TPtrC expected;
|
sl@0
|
415 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
416 |
{
|
sl@0
|
417 |
if ( result != expected )
|
sl@0
|
418 |
{
|
sl@0
|
419 |
ERR_PRINTF3(_L("Name() returns %S but expected %S"), &result, &expected);
|
sl@0
|
420 |
SetBlockResult( EFail);
|
sl@0
|
421 |
}
|
sl@0
|
422 |
}
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
void CT_ParseBaseData::DoCmdNameOrExtPresent( const TDesC& aSection )
|
sl@0
|
426 |
/** Tests whether a name or an extension are present using NameOrExtPresent(). */
|
sl@0
|
427 |
{
|
sl@0
|
428 |
INFO_PRINTF1( _L( "NameOrExtPresent()" ) );
|
sl@0
|
429 |
|
sl@0
|
430 |
TBool result = GetParse()->NameOrExtPresent();
|
sl@0
|
431 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
432 |
INFO_PRINTF2(_L("NameOrExtPresent() return: %S"), &temp);
|
sl@0
|
433 |
|
sl@0
|
434 |
TBool expected;
|
sl@0
|
435 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
436 |
{
|
sl@0
|
437 |
if ( (result>0) != (expected>0) )
|
sl@0
|
438 |
{
|
sl@0
|
439 |
ERR_PRINTF3(_L("NameOrExtPresent() returns %d but expected %d"), result, expected);
|
sl@0
|
440 |
SetBlockResult( EFail);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
}
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
void CT_ParseBaseData::DoCmdNameAndExt( const TDesC& aSection )
|
sl@0
|
446 |
/** Gets the file name and extension using NameAndExt(). */
|
sl@0
|
447 |
{
|
sl@0
|
448 |
INFO_PRINTF1( _L( "NameAndExt()" ) );
|
sl@0
|
449 |
|
sl@0
|
450 |
TPtrC result = GetParse()->NameAndExt();
|
sl@0
|
451 |
INFO_PRINTF2( _L( "NameAndExt() return: %S" ), &result );
|
sl@0
|
452 |
|
sl@0
|
453 |
TPtrC expected;
|
sl@0
|
454 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
455 |
{
|
sl@0
|
456 |
if ( result != expected )
|
sl@0
|
457 |
{
|
sl@0
|
458 |
ERR_PRINTF3(_L("NameAndExt() returns %S but expected %S"), &result, &expected);
|
sl@0
|
459 |
SetBlockResult( EFail);
|
sl@0
|
460 |
}
|
sl@0
|
461 |
}
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
void CT_ParseBaseData::DoCmdNamePresent( const TDesC& aSection )
|
sl@0
|
465 |
/** Tests whether a file name is present using NamePresent(). */
|
sl@0
|
466 |
{
|
sl@0
|
467 |
INFO_PRINTF1( _L( "NamePresent()" ) );
|
sl@0
|
468 |
|
sl@0
|
469 |
TBool result = GetParse()->NamePresent();
|
sl@0
|
470 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
471 |
INFO_PRINTF2(_L("NamePresent() return: %S"), &temp);
|
sl@0
|
472 |
|
sl@0
|
473 |
TBool expected;
|
sl@0
|
474 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
475 |
{
|
sl@0
|
476 |
if ( (result>0) != (expected>0) )
|
sl@0
|
477 |
{
|
sl@0
|
478 |
ERR_PRINTF3(_L("NamePresent() returns %d but expected %d"), result, expected);
|
sl@0
|
479 |
SetBlockResult( EFail);
|
sl@0
|
480 |
}
|
sl@0
|
481 |
}
|
sl@0
|
482 |
}
|
sl@0
|
483 |
|
sl@0
|
484 |
void CT_ParseBaseData::DoCmdPath( const TDesC& aSection )
|
sl@0
|
485 |
/** Gets the path using Path(). */
|
sl@0
|
486 |
{
|
sl@0
|
487 |
INFO_PRINTF1( _L( "Path()" ) );
|
sl@0
|
488 |
|
sl@0
|
489 |
TPtrC result = GetParse()->Path();
|
sl@0
|
490 |
INFO_PRINTF2( _L( "Path() return: %S" ), &result );
|
sl@0
|
491 |
|
sl@0
|
492 |
TPtrC expected;
|
sl@0
|
493 |
if ( GET_OPTIONAL_STRING_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
494 |
{
|
sl@0
|
495 |
if ( result != expected )
|
sl@0
|
496 |
{
|
sl@0
|
497 |
ERR_PRINTF3(_L("Path() returns %S but expected %S"), &result, &expected);
|
sl@0
|
498 |
SetBlockResult( EFail);
|
sl@0
|
499 |
}
|
sl@0
|
500 |
}
|
sl@0
|
501 |
}
|
sl@0
|
502 |
|
sl@0
|
503 |
void CT_ParseBaseData::DoCmdPathPresent( const TDesC& aSection )
|
sl@0
|
504 |
/** Tests whether a path is present using PathPresent(). */
|
sl@0
|
505 |
{
|
sl@0
|
506 |
INFO_PRINTF1( _L( "PathPresent()" ) );
|
sl@0
|
507 |
|
sl@0
|
508 |
TBool result = GetParse()->PathPresent();
|
sl@0
|
509 |
TPtrC temp = result ? _L("TRUE") : _L("FALSE");
|
sl@0
|
510 |
INFO_PRINTF2(_L("PathPresent() return: %S"), &temp);
|
sl@0
|
511 |
|
sl@0
|
512 |
TBool expected;
|
sl@0
|
513 |
if ( GET_OPTIONAL_BOOL_PARAMETER( KParamExpected, aSection, expected ) )
|
sl@0
|
514 |
{
|
sl@0
|
515 |
if ( (result>0) != (expected>0) )
|
sl@0
|
516 |
{
|
sl@0
|
517 |
ERR_PRINTF3(_L("PathPresent() returns %d but expected %d"), result, expected);
|
sl@0
|
518 |
SetBlockResult( EFail);
|
sl@0
|
519 |
}
|
sl@0
|
520 |
}
|
sl@0
|
521 |
}
|
sl@0
|
522 |
|