|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // cupnpserviceparser.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <upnpdescriptionschema.h> |
|
19 #include "cupnpdescriptionparser.h" |
|
20 #include "inetprottextutils.h" |
|
21 #include "rootserviceparser.h" |
|
22 #include "rootdeviceparser.h" |
|
23 #include "parsehandlerbase.h" |
|
24 |
|
25 using namespace Xml; |
|
26 |
|
27 /** |
|
28 Allocates and constructs a CUPnPDescriptionParser object. |
|
29 Initialises all member data to their default values. |
|
30 */ |
|
31 EXPORT_C CUPnPDescriptionParser* CUPnPDescriptionParser::NewL(const RStringPool& aStringPool , TUPnPDescriptionType aType) |
|
32 { |
|
33 CUPnPDescriptionParser* self = new (ELeave) CUPnPDescriptionParser(aStringPool ,aType); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CUPnPDescriptionParser::CUPnPDescriptionParser( const RStringPool& aStringPool , TUPnPDescriptionType aType) |
|
38 :iStringPool ( aStringPool ) |
|
39 { |
|
40 iDescriptionType = aType; |
|
41 } |
|
42 |
|
43 /** |
|
44 Passes an XML to the framework for parsing from buffer |
|
45 */ |
|
46 EXPORT_C TAny* CUPnPDescriptionParser::ParseDescriptionBufL(const TDesC8 &aDocument) |
|
47 { |
|
48 if( iDescriptionType == CUPnPDescriptionParser::EService ) |
|
49 { |
|
50 iServiceDescObj = CUPnPServiceDescription::NewL(); |
|
51 CRootServiceParser* parser = CRootServiceParser::NewL(iServiceDescObj, iStringPool); |
|
52 CleanupStack::PushL(parser); |
|
53 parser->StartParseL(aDocument); |
|
54 CleanupStack::PopAndDestroy(parser); |
|
55 return iServiceDescObj; |
|
56 } |
|
57 else |
|
58 { |
|
59 iDeviceDescObj = CUPnPDeviceDescription::NewL(); |
|
60 CRootDeviceParser* parser = CRootDeviceParser::NewL(iDeviceDescObj, iStringPool); |
|
61 CleanupStack::PushL(parser); |
|
62 parser->StartParseL(aDocument); |
|
63 CleanupStack::PopAndDestroy(parser); |
|
64 return iDeviceDescObj; |
|
65 } |
|
66 |
|
67 } |
|
68 |
|
69 /** |
|
70 Destructor |
|
71 */ |
|
72 EXPORT_C CUPnPDescriptionParser::~CUPnPDescriptionParser() |
|
73 { |
|
74 } |
|
75 |
|
76 |
|
77 |