|
1 /* |
|
2 * Copyright (c) 2002 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: Reference object resolver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BTSU_REF_OBJECT_RESOLVER_H |
|
20 #define BTSU_REF_OBJECT_RESOLVER_H |
|
21 |
|
22 // INCLUDES |
|
23 // new headers |
|
24 #include <xml/contenthandler.h> |
|
25 #include <xml/parser.h> |
|
26 |
|
27 |
|
28 #include <badesca.h> |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 class Xml::RTagInfo; |
|
33 /** |
|
34 * A content handler class implementing MContentHandler interface. |
|
35 * Listens notifications and appends found objects to a given list. |
|
36 */ |
|
37 NONSHARABLE_CLASS (CBTSURefObjectResolver) : public Xml::MContentHandler |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CBTSURefObjectResolver* NewL( CDesCArrayFlat* aCapabilityList ); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CBTSURefObjectResolver(); |
|
51 |
|
52 private: |
|
53 |
|
54 /** |
|
55 * From MContentHandler A notification telling about the beginning |
|
56 * of a document. |
|
57 * @param aDocParam Specifies the various parameters of the document. |
|
58 * @param aErrorCode is the error code. |
|
59 */ |
|
60 void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); |
|
61 |
|
62 /** |
|
63 * From MContentHandler A notification telling about the end |
|
64 * of a document. |
|
65 * @param aErrorCode is the error code. |
|
66 If this is not KErrNone then special action may be required. |
|
67 */ |
|
68 void OnEndDocumentL(TInt aErrorCode); |
|
69 |
|
70 /** |
|
71 * From MContentHandler A notification telling about the beginning |
|
72 * of an element. |
|
73 * @param aElement is a handle to the element's details. |
|
74 * @param aAttributes contains the attributes for the element. |
|
75 * @param aErrorCode is the error code. |
|
76 * @return A boolean according to success. |
|
77 */ |
|
78 void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, |
|
79 TInt aErrorCode); |
|
80 |
|
81 /** |
|
82 This method is a callback to indicate the end of the element has been reached. |
|
83 @param aElement is a handle to the element's details. |
|
84 @param aErrorCode is the error code. |
|
85 If this is not KErrNone then special action may be required. |
|
86 */ |
|
87 void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); |
|
88 |
|
89 /** |
|
90 This method is a callback that sends the content of the element. |
|
91 Not all the content may be returned in one go. The data may be sent in chunks. |
|
92 When an OnEndElementL is received this means there is no more content to be sent. |
|
93 @param aBytes is the raw content data for the element. |
|
94 The client is responsible for converting the data to the |
|
95 required character set if necessary. |
|
96 In some instances the content may be binary and must not be converted. |
|
97 @param aErrorCode is the error code. |
|
98 If this is not KErrNone then special action may be required. |
|
99 */ |
|
100 void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
101 /** |
|
102 This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. |
|
103 This method is always called before the corresponding OnStartElementL method. |
|
104 @param aPrefix is the Namespace prefix being declared. |
|
105 @param aUri is the Namespace URI the prefix is mapped to. |
|
106 @param aErrorCode is the error code. |
|
107 If this is not KErrNone then special action may be required. |
|
108 */ |
|
109 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, |
|
110 TInt aErrorCode); |
|
111 |
|
112 /** |
|
113 This method is a notification of the end of the scope of a prefix-URI mapping. |
|
114 This method is called after the corresponding DoEndElementL method. |
|
115 @param aPrefix is the Namespace prefix that was mapped. |
|
116 @param aErrorCode is the error code. |
|
117 If this is not KErrNone then special action may be required. |
|
118 */ |
|
119 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
120 |
|
121 |
|
122 /** |
|
123 This method is a notification of ignorable whitespace in element content. |
|
124 @param aBytes are the ignored bytes from the document being parsed. |
|
125 @param aErrorCode is the error code. |
|
126 If this is not KErrNone then special action may be required. |
|
127 */ |
|
128 void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
129 |
|
130 |
|
131 /** |
|
132 This method is a notification of a skipped entity. If the parser encounters an |
|
133 external entity it does not need to expand it - it can return the entity as aName |
|
134 for the client to deal with. |
|
135 @param aName is the name of the skipped entity. |
|
136 @param aErrorCode is the error code. |
|
137 If this is not KErrNone then special action may be required. |
|
138 */ |
|
139 void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
|
140 |
|
141 |
|
142 /** |
|
143 This method is a receive notification of a processing instruction. |
|
144 @param aTarget is the processing instruction target. |
|
145 @param aData is the processing instruction data. If empty none was supplied. |
|
146 @param aErrorCode is the error code. |
|
147 If this is not KErrNone then special action may be required. |
|
148 */ |
|
149 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, |
|
150 TInt aErrorCode); |
|
151 |
|
152 |
|
153 /** |
|
154 This method indicates an error has occurred. |
|
155 @param aError is the error code |
|
156 */ |
|
157 void OnError(TInt aErrorCode); |
|
158 |
|
159 |
|
160 /** |
|
161 This method obtains the interface matching the specified uid. |
|
162 @return 0 if no interface matching the uid is found. |
|
163 Otherwise, the this pointer cast to that interface. |
|
164 @param aUid the uid identifying the required interface. |
|
165 */ |
|
166 TAny* GetExtendedInterface(const TInt32 aUid); |
|
167 |
|
168 |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CBTSURefObjectResolver( CDesCArrayFlat* aCapabilityList ); |
|
173 |
|
174 /** |
|
175 * By default Symbian 2nd phase constructor is private. |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 |
|
180 private: // Data |
|
181 |
|
182 // Not owned. |
|
183 // |
|
184 CDesCArrayFlat* iObjectList; |
|
185 }; |
|
186 |
|
187 #endif // BTSU_REF_OBJECT_RESOLVER_H |
|
188 |
|
189 // End of File |