|
1 /* |
|
2 * Copyright (c) 2005-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef TDESTOKENISER_H |
|
21 #define TDESTOKENISER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANT DECLARATIONS |
|
27 const TUint8 KPosDefaultSeparator = ','; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * A helper class used to simplify parsing. |
|
33 * |
|
34 * Creates tokens from a descriptor with values separated by a single character |
|
35 */ |
|
36 class TDesTokeniser |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * C++ constructor. |
|
42 * |
|
43 * @param aTokenString the string to parse |
|
44 * @param aSeparator the separator character |
|
45 */ |
|
46 TDesTokeniser(const TDesC8& aTokenString); |
|
47 |
|
48 public: // New functions |
|
49 |
|
50 /** |
|
51 * Checks whether the string contains more unseen tokens. |
|
52 * |
|
53 * @return true if more tokens, otherwise false |
|
54 */ |
|
55 TBool HasMoreTokens(); |
|
56 |
|
57 /** |
|
58 * Skips the next token. |
|
59 * |
|
60 * @param aSeparator specific separator |
|
61 */ |
|
62 void SkipToken( |
|
63 /* IN */ const TChar& aSeparator = KPosDefaultSeparator |
|
64 ); |
|
65 |
|
66 /** |
|
67 * Skips the next token. |
|
68 * |
|
69 * @param aNrOfTimes Number of times tokeniser should skip set token. |
|
70 */ |
|
71 void SkipToken( |
|
72 /* IN */ const TInt aNrOfTimes |
|
73 ); |
|
74 |
|
75 /** |
|
76 * Retreives the next token. |
|
77 * |
|
78 * @param aSeparator specific separator |
|
79 * @return the next token |
|
80 */ |
|
81 TPtrC8 NextToken(const TChar& aSeparator = KPosDefaultSeparator); |
|
82 |
|
83 private: // Data |
|
84 TLex8 iLexer; |
|
85 }; |
|
86 |
|
87 #endif // TDESTOKENISER_H |
|
88 |
|
89 // End of File |