|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: Resolves entities. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef XML_ENTITY_H |
|
20 #define XML_ENTITY_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // MACROS |
|
29 |
|
30 // DATA TYPES |
|
31 |
|
32 // FUNCTION PROTOTYPES |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 |
|
39 /** |
|
40 * Resolves entities. |
|
41 * |
|
42 * \b Library: FeedsEngine.lib |
|
43 * |
|
44 * @since 3.0 |
|
45 */ |
|
46 class CXmlEntity: public CBase |
|
47 { |
|
48 public: // Datatypes |
|
49 struct EntityEntry |
|
50 { |
|
51 const char* entityName; |
|
52 TUint16 ucs2Value; |
|
53 }; |
|
54 |
|
55 |
|
56 public: // Constructors and destructor |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 */ |
|
60 static CXmlEntity* NewL(); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CXmlEntity(); |
|
66 |
|
67 |
|
68 public: // New Methods |
|
69 /** |
|
70 * Resolves the named entity into its char-value. Can handle numeric entities. |
|
71 * |
|
72 * @since 3.0 |
|
73 * @param aName The name of the entity. |
|
74 * @param aUcs2Value The resulting value. |
|
75 * @return void. |
|
76 */ |
|
77 void ResolveL(const TDesC& aName, TUint16& aUcs2Value); |
|
78 |
|
79 /** |
|
80 * Resolves the named entity into its xmlEntity. Can NOT handle numeric entities. |
|
81 * |
|
82 * @since 3.0 |
|
83 * @param aName The name of the entity. |
|
84 * @return The LibXml2 entity. |
|
85 */ |
|
86 const xmlEntity* ResolveL(const xmlChar *aName); |
|
87 |
|
88 |
|
89 private: // New Methods |
|
90 /** |
|
91 * Looks up the named entity in the static table. Can NOT handle numeric entities. |
|
92 * |
|
93 * @since 3.0 |
|
94 * @param aName The name of the entity. |
|
95 * @return The EntityEntry. |
|
96 */ |
|
97 const CXmlEntity::EntityEntry& LookupUsc2Value(const xmlChar *aName); |
|
98 |
|
99 /** |
|
100 * Resolves the numeric entity into it's value. |
|
101 * |
|
102 * @since 3.0 |
|
103 * @param aName The name of the entity. |
|
104 * @param aUcs2Value The resulting value. |
|
105 * @return ETrue if the entity was resolved. |
|
106 */ |
|
107 TBool ResolveNumericL(const TDesC& aName, TUint16& aUcs2Value); |
|
108 |
|
109 /** |
|
110 * Comparison method for iEntityMappings. |
|
111 * |
|
112 * @since 3.0 |
|
113 * @param aName The name of the entity. |
|
114 * @param aUcs2Value The resulting value. |
|
115 * @return ETrue if the entity was resolved. |
|
116 */ |
|
117 static TInt LinearOrder(const xmlEntity& aFirst, const xmlEntity& aSecond); |
|
118 |
|
119 /** |
|
120 * Comparison method for iEntityMappings. |
|
121 * |
|
122 * @since 3.0 |
|
123 * @param aName The name of the entity. |
|
124 * @param aUcs2Value The resulting value. |
|
125 * @return ETrue if the entity was resolved. |
|
126 */ |
|
127 static TInt LinearCaseOrder(const xmlEntity& aFirst, const xmlEntity& aSecond); |
|
128 |
|
129 |
|
130 private: |
|
131 /** |
|
132 * C++ default constructor. |
|
133 */ |
|
134 CXmlEntity(); |
|
135 |
|
136 /** |
|
137 * By default Symbian 2nd phase constructor is private. |
|
138 */ |
|
139 void ConstructL(); |
|
140 |
|
141 |
|
142 private: // Data |
|
143 TLeakTracker iLeakTracker; |
|
144 |
|
145 RArray<xmlEntity> iEntityMappings; |
|
146 }; |
|
147 |
|
148 #endif // XmlEntity |
|
149 |
|
150 // End of File |