|
1 // Copyright (c) 2005-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 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "EPos_TDesTokeniser.h" |
|
20 |
|
21 // ================= MEMBER FUNCTIONS ======================= |
|
22 |
|
23 // C++ default constructor can NOT contain any code, that |
|
24 // might leave. |
|
25 // |
|
26 TDesTokeniser::TDesTokeniser(const TDesC8& aTokenString) : |
|
27 iLexer(aTokenString) |
|
28 { |
|
29 } |
|
30 |
|
31 // ---------------------------------------------------------------------------- |
|
32 // TDesTokeniser::HasMoreTokens |
|
33 // |
|
34 // (other items were commented in a header). |
|
35 // ---------------------------------------------------------------------------- |
|
36 // |
|
37 TBool TDesTokeniser::HasMoreTokens() |
|
38 { |
|
39 return (!iLexer.Eos()); |
|
40 } |
|
41 |
|
42 // ---------------------------------------------------------------------------- |
|
43 // TDesTokeniser::SkipToken |
|
44 // |
|
45 // (other items were commented in a header). |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 void TDesTokeniser::SkipToken(const TChar& aSeparator) |
|
49 { |
|
50 while (HasMoreTokens() && iLexer.Get() != aSeparator) {} |
|
51 } |
|
52 |
|
53 // ---------------------------------------------------------------------------- |
|
54 // TDesTokeniser::SkipToken |
|
55 // |
|
56 // (other items were commented in a header). |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 void TDesTokeniser::SkipToken(const TInt aNrOfTimes) |
|
60 { |
|
61 for(TInt i=0; i<aNrOfTimes; i++) |
|
62 { |
|
63 SkipToken(); |
|
64 } |
|
65 } |
|
66 |
|
67 // ---------------------------------------------------------------------------- |
|
68 // TDesTokeniser::NextToken |
|
69 // |
|
70 // (other items were commented in a header). |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 TPtrC8 TDesTokeniser::NextToken(const TChar& aSeparator) |
|
74 { |
|
75 iLexer.SkipSpace(); |
|
76 iLexer.Mark(); |
|
77 while (HasMoreTokens() && iLexer.Peek() != aSeparator) |
|
78 { |
|
79 iLexer.Inc(); |
|
80 } |
|
81 TPtrC8 retVal = iLexer.MarkedToken(); |
|
82 |
|
83 |
|
84 if (HasMoreTokens()) |
|
85 { |
|
86 iLexer.Inc(); |
|
87 } |
|
88 return retVal; |
|
89 } |
|
90 |
|
91 // End of File |