|
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: Implements the CUpnpSoapContentHandler class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "upnpsoapcontenthandler.h" |
|
20 #include "upnpcontenthandlerscontroller.h" |
|
21 #include "upnpbodyofsoapcontenthandler.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CUpnpSoapContentHandler::NewL |
|
25 // Two-phased constructor |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 CUpnpSoapContentHandler* CUpnpSoapContentHandler::NewL( |
|
29 CUpnpContentHandlersController& aController, |
|
30 RPointerArray<CUpnpDescriptionProperty>& aParsedValues ) |
|
31 { |
|
32 CUpnpSoapContentHandler* soapContentHandler = |
|
33 CUpnpSoapContentHandler::NewLC( aController, aParsedValues ); |
|
34 CleanupStack::Pop( soapContentHandler ); |
|
35 return soapContentHandler; |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CUpnpSoapContentHandler::NewLC |
|
40 // Two-phased constructor. Leaves teh object on the CleanupStack |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CUpnpSoapContentHandler* CUpnpSoapContentHandler::NewLC( |
|
44 CUpnpContentHandlersController& aController, |
|
45 RPointerArray<CUpnpDescriptionProperty>& aParsedValues ) |
|
46 { |
|
47 CUpnpSoapContentHandler* soapContentHandler = |
|
48 new (ELeave) CUpnpSoapContentHandler( aController, aParsedValues ); |
|
49 CleanupStack::PushL( soapContentHandler ); |
|
50 return soapContentHandler; |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CUpnpSoapContentHandler::~CUpnpSoapContentHandler |
|
55 // Destructor of CUpnpSoapContentHandler class |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CUpnpSoapContentHandler::~CUpnpSoapContentHandler() |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CUpnpSoapContentHandler::CUpnpSoapContentHandler |
|
64 // Constructor |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CUpnpSoapContentHandler::CUpnpSoapContentHandler( |
|
68 CUpnpContentHandlersController& aController, |
|
69 RPointerArray<CUpnpDescriptionProperty>& aParsedValues ) : |
|
70 CUpnpContentHandler( aController ), iParsedValues( aParsedValues ) |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CUpnpSoapContentHandler::OnStartElementL |
|
76 // This method is a callback to indicate an element has been parsed. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CUpnpSoapContentHandler::OnStartElementL( |
|
80 const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/) |
|
81 { |
|
82 if ( iIsInsideEnvelope ) |
|
83 { |
|
84 if ( aElement.LocalName().DesC().Compare( KUpnpSoapBody ) == 0 ) |
|
85 { |
|
86 iController.SetCurrentContentHandlerL( CUpnpBodyOfSoapContentHandler::NewL( |
|
87 iController, iParsedValues ) ); |
|
88 } |
|
89 else |
|
90 { |
|
91 SetIgnoreHandlerL(); |
|
92 } |
|
93 } |
|
94 else |
|
95 { |
|
96 if ( aElement.LocalName().DesC().Compare( KUpnpSoapEnvelope ) == 0 ) |
|
97 { |
|
98 iIsInsideEnvelope = ETrue; |
|
99 } |
|
100 else |
|
101 { |
|
102 User::Leave( KErrArgument ); //wrong root node |
|
103 } |
|
104 } |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CUpnpSoapContentHandler::OnEndElementL |
|
109 // This method is a callback to indicate the end of the element has been reached. |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CUpnpSoapContentHandler::OnEndElementL( const RTagInfo& aElement ) |
|
113 { |
|
114 if ( iIsInsideEnvelope ) |
|
115 { |
|
116 ASSERT( aElement.LocalName().DesC().Compare(KUpnpSoapEnvelope) == 0 ); |
|
117 iIsInsideEnvelope = EFalse; |
|
118 } |
|
119 else |
|
120 { |
|
121 ASSERT( EFalse ); //we should never be here |
|
122 } |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CUpnpSoapContentHandler::OnContentL |
|
127 // This method is a callback that sends the content of the element. |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void CUpnpSoapContentHandler::OnContentL( const TDesC8& /*aBytes*/) |
|
131 { |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CUpnpSoapContentHandler::ClearEnvelopeFlag |
|
136 // Clears envleope flag |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CUpnpSoapContentHandler::ResetState() |
|
140 { |
|
141 iIsInsideEnvelope = EFalse; |
|
142 } |
|
143 // End of File |