equal
deleted
inserted
replaced
|
1 // pod_lexer.h |
|
2 // |
|
3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #ifndef __POD_LEXER_H__ |
|
14 #define __POD_LEXER_H__ |
|
15 |
|
16 #include <e32std.h> |
|
17 |
|
18 const TInt KMaxNestedAttributes = 16; |
|
19 |
|
20 |
|
21 /** |
|
22 * Responsible for understanding POD interior sequences (B<bold>, I<italic>, etc.). |
|
23 */ |
|
24 class TPodLexer |
|
25 { |
|
26 public: |
|
27 enum TTokenType |
|
28 { |
|
29 EAttributePush, |
|
30 EAttributePop, |
|
31 ETextBlock, |
|
32 ECodeBlock, |
|
33 ELink, |
|
34 EIndexEntry |
|
35 }; |
|
36 enum TAttribute |
|
37 { |
|
38 ENull = 0x00000000, |
|
39 EBold = 0x00000001, |
|
40 ECode = 0x00000002, |
|
41 EItalic = 0x00000004, |
|
42 EFileName = 0x00000008 |
|
43 }; |
|
44 public: |
|
45 TPodLexer(const TDesC& aString); |
|
46 void NextTokenL(TPtrC& aToken, TTokenType& aTokenType, TUint& aAttributes, TBool& aEop, TBool& aEos); |
|
47 private: |
|
48 TInt SkipToClosingAngleBracket(); |
|
49 TBool Eop(); |
|
50 TBool IsInteriorSequenceStart(TUint16& aSequenceIdentifier); |
|
51 void PushAttribute(TAttribute aAttribute); |
|
52 TAttribute PopAttribute(); |
|
53 private: |
|
54 TLex iLex; |
|
55 TUint iAttributes; |
|
56 TBuf<64> iScratch; |
|
57 TFixedArray<TAttribute, KMaxNestedAttributes> iAttributeStack; |
|
58 TInt iAttributeStackIndex; |
|
59 }; |
|
60 |
|
61 #endif // __POD_LEXER_H__ |