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