|
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 CUpnpIconContentHandler class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __UPNPICONCONTENTHANDLER_H__ |
|
21 #define __UPNPICONCONTENTHANDLER_H__ |
|
22 |
|
23 #include <babitflags.h> |
|
24 |
|
25 #include "upnpcontenthandler.h" |
|
26 |
|
27 class CUpnpIcon; |
|
28 |
|
29 using namespace Xml; |
|
30 |
|
31 /** |
|
32 * This class handles icon subtree of service 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( CUpnpIconContentHandler ) : public CUpnpContentHandler |
|
39 { |
|
40 protected: |
|
41 enum TState |
|
42 { |
|
43 EInitial, |
|
44 EMimeType, |
|
45 EWidth, |
|
46 EHeight, |
|
47 EDepth, |
|
48 EUrl |
|
49 }; |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Two-phased constructor |
|
55 * @since Series60 3.2 |
|
56 * @return instance of CUpnpIconContentHandler class |
|
57 */ |
|
58 static CUpnpIconContentHandler* NewL( |
|
59 CUpnpContentHandlersController& aController, CUpnpIcon& aResultIcon ); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. Leaves the object on CleanupStack |
|
63 * @since Series60 3.2 |
|
64 * @return instance of CUpnpIconContentHandler class |
|
65 */ |
|
66 static CUpnpIconContentHandler* NewLC( |
|
67 CUpnpContentHandlersController& aController, CUpnpIcon& aResultIcon ); |
|
68 |
|
69 /** |
|
70 * Destructor of CUpnpIconContentHandler class |
|
71 * @since Series60 3.2 |
|
72 */ |
|
73 virtual ~CUpnpIconContentHandler(); |
|
74 |
|
75 public: // from CUpnpContentHandler |
|
76 |
|
77 /** |
|
78 * This method is a callback to indicate an element has been parsed. |
|
79 * @param aElement is a handle to the element's details. |
|
80 * @param aAttributes contains the attributes for the element. |
|
81 */ |
|
82 virtual void OnStartElementL( const RTagInfo& aElement, |
|
83 const RAttributeArray& aAttributes ); |
|
84 |
|
85 /** |
|
86 * This method is a callback to indicate the end of the element has been reached. |
|
87 * @param aElement is a handle to the element's details. |
|
88 */ |
|
89 virtual void OnEndElementL( const RTagInfo& aElement ); |
|
90 |
|
91 /** |
|
92 * This method is a callback that sends the content of the element. |
|
93 * @param aBytes is the raw content data for the element in one chunk |
|
94 */ |
|
95 virtual void OnContentL( const TDesC8& aBytes ); |
|
96 |
|
97 protected: |
|
98 |
|
99 /** |
|
100 * Default C++ constructor |
|
101 * @since Series60 3.2 |
|
102 */ |
|
103 CUpnpIconContentHandler( CUpnpContentHandlersController& aController, |
|
104 CUpnpIcon& aResultIcon ); |
|
105 |
|
106 /** |
|
107 * Parses and returns int value stored in descriptor, or leaves with KErrArgument |
|
108 * if parsing failes. |
|
109 * @param aToParse descriptor to parse |
|
110 * @return parsed value as int |
|
111 */ |
|
112 TInt ParseIntL( const TDesC8& aToParse ); |
|
113 |
|
114 private: |
|
115 CUpnpIcon& iResultIcon; |
|
116 TState iCurrentState; |
|
117 TBitFlags8 iFoundTags; |
|
118 |
|
119 }; |
|
120 |
|
121 #endif //__UPNPICONCONTENTHANDLER_H__ |