|
1 /** @file |
|
2 * Copyright (c) 2007 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: Declares the CUpnpDeviceContentHandler class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __UPNPDEVICECONTENTHANDLER_H__ |
|
21 #define __UPNPDEVICECONTENTHANDLER_H__ |
|
22 |
|
23 #include "upnpcontenthandler.h" |
|
24 |
|
25 class CUpnpDevice; |
|
26 class CUpnpDeviceImplementation; |
|
27 class CUpnpSilentDeviceImplementation; |
|
28 |
|
29 using namespace Xml; |
|
30 |
|
31 /** |
|
32 * This class handles xml device descriptions |
|
33 * It extends CUpnpContentHandler class, thus it is subsequent implementation of MContentHandler interface |
|
34 * It is designed to be used by upnp controler that delegates to it events from xml sax parser |
|
35 * |
|
36 * @since Series60 2.6 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CUpnpDeviceContentHandler ) : public CUpnpContentHandler |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two-phased constructor that will parse CUpnpDevice object. If aResultDevice |
|
44 * is NULL the result object will be created during the parsing, and will be |
|
45 * owned by this CUpnpDeviceContentHandler. |
|
46 * Otherwise result will be parsed to existing aResultDevice object |
|
47 * @since Series60 3.2 |
|
48 * @return instance of CUpnpDeviceContentHandler class |
|
49 */ |
|
50 static CUpnpDeviceContentHandler* NewL( CUpnpContentHandlersController& aController, |
|
51 CUpnpDevice* aResultDevice ); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor that will parse CUpnpDevice object. If aResultDevice |
|
55 * is NULL the result object will be created during the parsing, and will be |
|
56 * owned by this CUpnpDeviceContentHandler. |
|
57 * Otherwise result will be parsed to existing aResultDevice object. |
|
58 * Leaves the object on the CleanupStack |
|
59 * @since Series60 3.2 |
|
60 * @return instance of CUpnpDeviceContentHandler class |
|
61 */ |
|
62 static CUpnpDeviceContentHandler* NewLC( CUpnpContentHandlersController& aController, |
|
63 CUpnpDevice* aResultDevice ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor that will parse CUpnpDeviceImplementation object. If |
|
67 * aResultDeviceImpl is NULL the result object will be created during the parsing, |
|
68 * and will be owned by this CUpnpDeviceContentHandler. |
|
69 * Otherwise result will be parsed to existing aResultDevice object. |
|
70 * @since Series60 3.2 |
|
71 * @return instance of CUpnpDeviceContentHandler class |
|
72 */ |
|
73 static CUpnpDeviceContentHandler* NewL( CUpnpContentHandlersController& aController, |
|
74 CUpnpDeviceImplementation* aResultDeviceImpl ); |
|
75 |
|
76 /** |
|
77 * Two-phased constructor that will parse CUpnpDeviceImplementation object. If |
|
78 * aResultDeviceImpl is NULL the result object will be created during the parsing, |
|
79 * and will be owned by this CUpnpDeviceContentHandler. |
|
80 * Otherwise result will be parsed to existing aResultDevice object. |
|
81 * Leaves the object on the CleanupStack |
|
82 * @since Series60 3.2 |
|
83 * @return instance of CUpnpDeviceContentHandler class |
|
84 */ |
|
85 static CUpnpDeviceContentHandler* NewLC( CUpnpContentHandlersController& aController, |
|
86 CUpnpDeviceImplementation* aResultDeviceImpl ); |
|
87 |
|
88 |
|
89 /** |
|
90 * Two-phased constructor that will parse CUpnpSilentDeviceImplementation object. If |
|
91 * aResultDeviceImpl is NULL the result object will be created during the parsing, |
|
92 * and will be owned by this CUpnpDeviceContentHandler. |
|
93 * Otherwise result will be parsed to existing aResultDevice object. |
|
94 * @since Series60 3.2 |
|
95 * @return instance of CUpnpDeviceContentHandler class |
|
96 */ |
|
97 static CUpnpDeviceContentHandler* NewL( CUpnpContentHandlersController& aController, |
|
98 CUpnpSilentDeviceImplementation* aResultSilentDeviceImpl ); |
|
99 |
|
100 /** |
|
101 * Two-phased constructor that will parse CUpnpSilentDeviceImplementation object. If |
|
102 * aResultDeviceImpl is NULL the result object will be created during the parsing, |
|
103 * and will be owned by this CUpnpDeviceContentHandler. |
|
104 * Otherwise result will be parsed to existing aResultDevice object. |
|
105 * Leaves the object on the CleanupStack |
|
106 * @since Series60 3.2 |
|
107 * @return instance of CUpnpDeviceContentHandler class |
|
108 */ |
|
109 static CUpnpDeviceContentHandler* NewLC( CUpnpContentHandlersController& aController, |
|
110 CUpnpSilentDeviceImplementation* aResultSilentDeviceImpl ); |
|
111 |
|
112 /** |
|
113 * Destructor of CUpnpDeviceContentHandler class |
|
114 * @since Series60 3.2 |
|
115 */ |
|
116 virtual ~CUpnpDeviceContentHandler(); |
|
117 |
|
118 /** |
|
119 * Returns parsed CUpnpDevice object, and pass ownership of it to the caller. |
|
120 * One shouldn't call this method if CUpnpDeviceContentHandler dosn't have |
|
121 * ownership CUpnpDevice object. |
|
122 * @see GetResultDevice( CUpnpDevice*& aResultDevice ) |
|
123 * |
|
124 * @param aResultDevice result |
|
125 */ |
|
126 void GetResultDevice( CUpnpDevice*& aResultDevice ); |
|
127 |
|
128 /** |
|
129 * Returns parsed CUpnpDeviceImplamentation object, and pass ownership of it to the caller. |
|
130 * One shouldn't call this method if CUpnpDeviceContentHandler dosn't have |
|
131 * ownership CUpnpDeviceImplementation object. |
|
132 * @see GetResultDevice( CUpnpDevice*& aResultDevice ) |
|
133 * |
|
134 * @param aResultDeviceImpl result |
|
135 */ |
|
136 void GetResultDevice( CUpnpDeviceImplementation*& aResultDeviceImpl ); |
|
137 |
|
138 /** |
|
139 * Returns parsed CUpnpSilentDeviceImplamentation object, and pass ownership of it to the caller. |
|
140 * One shouldn't call this method if CUpnpDeviceContentHandler dosn't have |
|
141 * ownership CUpnpSilentDeviceImplementation object. |
|
142 * @see GetResultDevice( CUpnpDevice*& aResultDevice ) |
|
143 * |
|
144 * @param aResultDeviceImpl result |
|
145 */ |
|
146 void GetResultDevice( CUpnpSilentDeviceImplementation*& aResultSilentDeviceImpl ); |
|
147 |
|
148 public: // from CUpnpContentHandler |
|
149 |
|
150 /** |
|
151 * This method is a callback to indicate an element has been parsed. |
|
152 * @param aElement is a handle to the element's details. |
|
153 * @param aAttributes contains the attributes for the element. |
|
154 */ |
|
155 virtual void OnStartElementL( const RTagInfo& aElement, |
|
156 const RAttributeArray& aAttributes ); |
|
157 |
|
158 /** |
|
159 * This method is a callback to indicate the end of the element has been reached. |
|
160 * @param aElement is a handle to the element's details. |
|
161 */ |
|
162 virtual void OnEndElementL( const RTagInfo& aElement ); |
|
163 |
|
164 /** |
|
165 * This method is a callback that sends the content of the element. |
|
166 * @param aBytes is the raw content data for the element in one chunk |
|
167 */ |
|
168 virtual void OnContentL( const TDesC8& aBytes ); |
|
169 |
|
170 protected: |
|
171 |
|
172 /** |
|
173 * Default C++ constructor |
|
174 * @since Series60 3.2 |
|
175 */ |
|
176 CUpnpDeviceContentHandler( CUpnpContentHandlersController& aController, |
|
177 CUpnpDevice* aResultDevice ); |
|
178 |
|
179 /** |
|
180 * Default C++ constructor |
|
181 * @since Series60 3.2 |
|
182 */ |
|
183 CUpnpDeviceContentHandler( CUpnpContentHandlersController& aController, |
|
184 CUpnpDeviceImplementation* aResultDeviceImpl ); |
|
185 |
|
186 /** |
|
187 * Default C++ constructor |
|
188 * @since Series60 3.2 |
|
189 */ |
|
190 CUpnpDeviceContentHandler( CUpnpContentHandlersController& aController, |
|
191 CUpnpSilentDeviceImplementation* aResultSilentDeviceImpl ); |
|
192 |
|
193 private: |
|
194 CUpnpDevice* iResultDevice; |
|
195 CUpnpDeviceImplementation* iResultDeviceImpl; |
|
196 CUpnpSilentDeviceImplementation* iResultSilentDeviceImpl; |
|
197 TBool iIsDeviceOwned; |
|
198 TParseType iParseType; |
|
199 |
|
200 }; |
|
201 |
|
202 #endif //__UPNPDEVICECONTENTHANDLER_H__ |