|
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: CNcdConfigurationProtocolClientConfigurationParser implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ncdunknownparser.h" |
|
20 #include "ncdprotocolwords.h" |
|
21 #include "ncdprotocolutils.h" |
|
22 |
|
23 #include "ncd_parser_pp_expiredcacheddata.h" |
|
24 #include "ncd_pp_expiredcacheddataimpl.h" |
|
25 |
|
26 #include "catalogsdebug.h" |
|
27 |
|
28 CNcdPreminetProtocolExpiredCachedDataParser* |
|
29 CNcdPreminetProtocolExpiredCachedDataParser::NewL( MNcdParserObserverBundle& aObservers, |
|
30 MNcdSubParserObserver& aSubParserObserver, |
|
31 TInt aDepth, |
|
32 const Xml::RTagInfo& aElement, |
|
33 const Xml::RAttributeArray& aAttributes ) |
|
34 { |
|
35 CNcdPreminetProtocolExpiredCachedDataParser* self |
|
36 = new(ELeave) CNcdPreminetProtocolExpiredCachedDataParser( aObservers, |
|
37 aSubParserObserver, |
|
38 aDepth ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL( aElement, aAttributes ); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CNcdPreminetProtocolExpiredCachedDataParser::CNcdPreminetProtocolExpiredCachedDataParser( |
|
46 MNcdParserObserverBundle& aObservers, |
|
47 MNcdSubParserObserver& aSubParserObserver, |
|
48 TInt aDepth ) |
|
49 : CNcdSubParser( aObservers, aSubParserObserver, aDepth ) |
|
50 { |
|
51 } |
|
52 |
|
53 CNcdPreminetProtocolExpiredCachedDataParser::~CNcdPreminetProtocolExpiredCachedDataParser() |
|
54 { |
|
55 delete iExpiredCachedData; |
|
56 iExpiredCachedData = 0; |
|
57 } |
|
58 |
|
59 void CNcdPreminetProtocolExpiredCachedDataParser::ConstructL( |
|
60 const Xml::RTagInfo& aElement, const Xml::RAttributeArray& /*aAttributes*/ ) |
|
61 { |
|
62 CNcdSubParser::ConstructL( aElement ); |
|
63 |
|
64 DLTRACEIN(("depth=%d tag=%S",iDepth,iTag)); |
|
65 |
|
66 iExpiredCachedData = new(ELeave) CNcdPreminetProtocolExpiredCachedDataImpl(); |
|
67 iExpiredCachedData->ConstructL(); |
|
68 |
|
69 } |
|
70 |
|
71 void CNcdPreminetProtocolExpiredCachedDataParser::OnStartElementL( const Xml::RTagInfo& aElement, |
|
72 const Xml::RAttributeArray& aAttributes, |
|
73 TInt aErrorCode) |
|
74 { |
|
75 DLTRACE(("start tag=%S",&aElement.LocalName().DesC())); |
|
76 if( iSubParser ) |
|
77 { |
|
78 // Use existing subparser. |
|
79 iSubParser->OnStartElementL( aElement, aAttributes, aErrorCode ); |
|
80 } |
|
81 else |
|
82 { |
|
83 CNcdSubParser::OnStartElementL( aElement, aAttributes, aErrorCode ); |
|
84 |
|
85 TPtrC8 tag( aElement.LocalName().DesC() ); |
|
86 |
|
87 if( tag == KTagExpiredEntity ) |
|
88 { |
|
89 CNcdPreminetProtocolExpiredEntityImpl* expiredEntity = |
|
90 new(ELeave) CNcdPreminetProtocolExpiredEntityImpl(); |
|
91 ( iExpiredCachedData->iExpiredEntityCounts ).AppendL( expiredEntity ); |
|
92 expiredEntity->ConstructL(); |
|
93 |
|
94 // expired entity attributes |
|
95 |
|
96 // entity id |
|
97 NcdProtocolUtils::AssignDesL( expiredEntity->iEntityId, AttributeValue( KAttrEntityId, aAttributes )); |
|
98 |
|
99 // recursive |
|
100 TPtrC8 recursive = AttributeValue( KAttrRecursive, aAttributes ); |
|
101 NcdProtocolUtils::DesToBool( expiredEntity->iRecursive, recursive ); |
|
102 |
|
103 // force update |
|
104 TPtrC8 forceUpdate = AttributeValue( KAttrForceUpdate, aAttributes ); |
|
105 NcdProtocolUtils::DesToBool( expiredEntity->iForceUpdate, forceUpdate ); |
|
106 |
|
107 iSubParser = CNcdUnknownParser::NewL( *iObservers, *this, iDepth+1, aElement, aAttributes ); |
|
108 } |
|
109 |
|
110 else if( tag == KTagClearOldEntities ) |
|
111 { |
|
112 CNcdPreminetProtocolClearOldEntitiesImpl* clearOldEntities = |
|
113 new(ELeave) CNcdPreminetProtocolClearOldEntitiesImpl(); |
|
114 iExpiredCachedData->iClearOldEntities = clearOldEntities; |
|
115 clearOldEntities->ConstructL(); |
|
116 |
|
117 // clear old entities attributes |
|
118 |
|
119 // start timestamp |
|
120 NcdProtocolUtils::AssignDesL( clearOldEntities->iStartTimestamp, AttributeValue( KAttrStartTimestamp, aAttributes )); |
|
121 |
|
122 // end timestamp |
|
123 NcdProtocolUtils::AssignDesL( clearOldEntities->iEndTimestamp, AttributeValue( KAttrEndTimestamp, aAttributes )); |
|
124 |
|
125 iSubParser = CNcdUnknownParser::NewL( *iObservers, *this, iDepth+1, aElement, aAttributes ); |
|
126 } |
|
127 |
|
128 else |
|
129 { |
|
130 iSubParser = CNcdUnknownParser::NewL( *iObservers, *this, iDepth+1, aElement, aAttributes ); |
|
131 } |
|
132 } |
|
133 } |
|
134 |
|
135 |
|
136 void CNcdPreminetProtocolExpiredCachedDataParser::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) |
|
137 { |
|
138 DLTRACEIN(("")); |
|
139 |
|
140 if( iSubParser == 0 && iTag && *iTag == aElement.LocalName().DesC() ) |
|
141 { |
|
142 DLTRACE(("end tag=%S",&aElement.LocalName().DesC())); |
|
143 iSubParserObserver->SubParserFinishedL( aElement.LocalName().DesC(), aErrorCode ); |
|
144 } |
|
145 |
|
146 else if( iSubParser ) |
|
147 { |
|
148 iSubParser->OnEndElementL( aElement, aErrorCode ); |
|
149 } |
|
150 |
|
151 else |
|
152 { |
|
153 DLWARNING(("end tag ignored, tag=%S",&aElement.LocalName().DesC())); |
|
154 } |
|
155 } |
|
156 |
|
157 void CNcdPreminetProtocolExpiredCachedDataParser::SubParserFinishedL( |
|
158 const TDesC8& aTag, TInt /*aErrorCode*/ ) |
|
159 { |
|
160 DLTRACE(("tag=%S subparser=%X",&aTag,iSubParser)); |
|
161 (void) aTag; // suppresses compiler warning |
|
162 |
|
163 delete iSubParser; |
|
164 iSubParser = 0; |
|
165 } |
|
166 |
|
167 MNcdPreminetProtocolExpiredCachedData* CNcdPreminetProtocolExpiredCachedDataParser::ExpiredCachedData() |
|
168 { |
|
169 MNcdPreminetProtocolExpiredCachedData* returnPtr = iExpiredCachedData; |
|
170 iExpiredCachedData = 0; |
|
171 return returnPtr; |
|
172 } |
|
173 |