1 /* |
|
2 * Copyright (c) 2005-2006 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: Shortcut definition parser |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "aiscutappuidparser.h" |
|
20 |
|
21 // ========================= MEMBER FUNCTIONS ================================ |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // TAiScutAppUidParser::TAiScutAppUidParser |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 TAiScutAppUidParser::TAiScutAppUidParser(const TDesC& aData, RArray<TUid>& aUidArray) |
|
28 : |
|
29 iUidArray(aUidArray), |
|
30 iLex(aData), |
|
31 iLexIsValid(EFalse) |
|
32 { |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // TAiScutAppUidParser::SkipChar |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 void TAiScutAppUidParser::SkipChar(TChar aChar, TBool aConditionalSkip) |
|
40 { |
|
41 iLex.SkipSpaceAndMark(); |
|
42 if (iLex.Peek() == aChar) |
|
43 { |
|
44 iLex.Inc(); |
|
45 } |
|
46 else |
|
47 { |
|
48 // If not conditional skip, then the input data is invalid |
|
49 if (!aConditionalSkip) |
|
50 { |
|
51 iLexIsValid = EFalse; |
|
52 } |
|
53 } |
|
54 iLex.SkipSpaceAndMark(); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // TAiScutAppUidParser::ReadAppUid |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 TUid TAiScutAppUidParser::ReadAppUid() |
|
62 { |
|
63 TUint32 appUid; |
|
64 |
|
65 iLex.Mark(); |
|
66 while (iLex.Peek().IsHexDigit()) |
|
67 { |
|
68 iLex.Inc(); |
|
69 } |
|
70 TPtrC uidToken = iLex.MarkedToken(); |
|
71 TLex uidLex(uidToken); |
|
72 if (uidLex.Val(appUid, EHex) != KErrNone) |
|
73 { |
|
74 iLexIsValid = EFalse; |
|
75 } |
|
76 |
|
77 return TUid::Uid(appUid); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // TAiScutAppUidParser::ParseL |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void TAiScutAppUidParser::ParseL() |
|
85 { |
|
86 iLexIsValid = ETrue; |
|
87 |
|
88 while (!iLex.Eos() && iLexIsValid) |
|
89 { |
|
90 SkipChar(',', ETrue); |
|
91 TUid applicationUid = ReadAppUid(); |
|
92 |
|
93 if (iLexIsValid) |
|
94 { |
|
95 iUidArray.AppendL(TUid(applicationUid)); |
|
96 } |
|
97 } |
|
98 } |
|
99 |
|
100 // End of File |
|