|
1 /* |
|
2 * Copyright (c) 2006 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: CNcdEntityRefParser implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ncdunknownparser.h" |
|
20 #include "ncdprotocolwords.h" |
|
21 #include "ncdprotocolutils.h" |
|
22 #include "ncd_cp_detailimpl.h" |
|
23 #include "ncd_parser_cp_details.h" |
|
24 #include "catalogsdebug.h" |
|
25 #include "ncd_parser_cp_detail.h" |
|
26 |
|
27 CNcdConfigurationProtocolDetailsParser* |
|
28 CNcdConfigurationProtocolDetailsParser::NewL( MNcdParserObserverBundle& aObservers, |
|
29 MNcdSubParserObserver& aSubParserObserver, |
|
30 TInt aDepth, |
|
31 const Xml::RTagInfo& aElement, |
|
32 const Xml::RAttributeArray& aAttributes ) |
|
33 { |
|
34 CNcdConfigurationProtocolDetailsParser* self |
|
35 = new(ELeave) CNcdConfigurationProtocolDetailsParser( aObservers, |
|
36 aSubParserObserver, |
|
37 aDepth ); |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL( aElement, aAttributes ); |
|
40 CleanupStack::Pop( self ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 CNcdConfigurationProtocolDetailsParser::CNcdConfigurationProtocolDetailsParser( MNcdParserObserverBundle& aObservers, |
|
45 MNcdSubParserObserver& aSubParserObserver, |
|
46 TInt aDepth ) |
|
47 : CNcdSubParser( aObservers, aSubParserObserver, aDepth ) |
|
48 { |
|
49 } |
|
50 |
|
51 CNcdConfigurationProtocolDetailsParser::~CNcdConfigurationProtocolDetailsParser() |
|
52 { |
|
53 delete iDetails; |
|
54 iDetails = 0; |
|
55 } |
|
56 |
|
57 void CNcdConfigurationProtocolDetailsParser::ConstructL( |
|
58 const Xml::RTagInfo& aElement, |
|
59 const Xml::RAttributeArray& /*aAttributes*/ ) |
|
60 { |
|
61 CNcdSubParser::ConstructL( aElement ); |
|
62 iDetails = new(ELeave) CArrayPtrFlat<MNcdConfigurationProtocolDetail>( 4 ); |
|
63 } |
|
64 |
|
65 void CNcdConfigurationProtocolDetailsParser::OnStartElementL( const Xml::RTagInfo& aElement, |
|
66 const Xml::RAttributeArray& aAttributes, |
|
67 TInt aErrorCode ) |
|
68 { |
|
69 if( iSubParser == 0 ) |
|
70 { |
|
71 CNcdSubParser::OnStartElementL( aElement, aAttributes, aErrorCode ); |
|
72 |
|
73 TPtrC8 tag( aElement.LocalName().DesC() ); |
|
74 DLTRACE(("details start tag=%S error=%d depth=%d",&aElement.LocalName().DesC(),aErrorCode,iDepth)); |
|
75 |
|
76 if( tag == KTagDetail ) |
|
77 { |
|
78 iSubParser = CNcdConfigurationProtocolDetailParser::NewL( *iObservers, *this, iDepth+1, aElement, aAttributes ); |
|
79 } |
|
80 |
|
81 else |
|
82 { |
|
83 iSubParser = CNcdUnknownParser::NewL( *iObservers, *this, iDepth+1, aElement, aAttributes ); |
|
84 } |
|
85 } |
|
86 else |
|
87 { |
|
88 iSubParser->OnStartElementL( aElement, aAttributes, aErrorCode ); |
|
89 } |
|
90 } |
|
91 |
|
92 |
|
93 void CNcdConfigurationProtocolDetailsParser::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) |
|
94 { |
|
95 DLTRACEIN(("")); |
|
96 if( iSubParser == 0 && iTag && *iTag == aElement.LocalName().DesC() ) |
|
97 { |
|
98 DLTRACE(("end tag=%S",&aElement.LocalName().DesC())); |
|
99 iSubParserObserver->SubParserFinishedL( aElement.LocalName().DesC(), aErrorCode ); |
|
100 } |
|
101 else if( iSubParser ) |
|
102 { |
|
103 iSubParser->OnEndElementL( aElement, aErrorCode ); |
|
104 } |
|
105 else |
|
106 { |
|
107 DLWARNING(("end tag ignored, tag=%S",&aElement.LocalName().DesC())); |
|
108 } |
|
109 } |
|
110 |
|
111 void CNcdConfigurationProtocolDetailsParser::SubParserFinishedL( const TDesC8& aTag, TInt /*aErrorCode*/ ) |
|
112 { |
|
113 DLTRACE(("tag=%S subparser=%X",&aTag,iSubParser)); |
|
114 |
|
115 if( aTag == KTagDetail ) |
|
116 { |
|
117 MNcdConfigurationProtocolDetail* detail = |
|
118 static_cast<CNcdConfigurationProtocolDetailParser*>( iSubParser )->Detail(); |
|
119 CleanupDeletePushL( detail ); |
|
120 iDetails->AppendL( detail ); |
|
121 CleanupStack::Pop( detail ); |
|
122 } |
|
123 |
|
124 delete iSubParser; |
|
125 iSubParser = 0; |
|
126 } |
|
127 |
|
128 CArrayPtr<MNcdConfigurationProtocolDetail>* CNcdConfigurationProtocolDetailsParser::Details() |
|
129 { |
|
130 CArrayPtr<MNcdConfigurationProtocolDetail>* returnPtr = iDetails; |
|
131 iDetails = 0; |
|
132 return returnPtr; |
|
133 } |
|
134 |