|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cfoperationnode.h" |
|
21 #include "cftrace.h" |
|
22 |
|
23 #include <gmxmlnode.h> |
|
24 #include <gmxmldomconstants.h> |
|
25 |
|
26 // CONSTANTS |
|
27 static const TInt KDomTreeLocationInfoSize = 64; |
|
28 static const TInt KInfoPrintExtraLen = 4; |
|
29 |
|
30 _LIT( KDebugLocationSeparator, "." ); |
|
31 _LIT( KDebugLocationNameStart, "[" ); |
|
32 _LIT( KDebugLocationNameEnd, "]" ); |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CCFOperationNode::CCFOperationNode |
|
38 // C++ default constructor can NOT contain any code, that might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CCFOperationNode::CCFOperationNode( MCFOperationServices& aServices, |
|
42 CCFOperationNode* aParent ) |
|
43 : iServices( aServices ), |
|
44 iParent( aParent ), |
|
45 iValue( ECFConditionUndefined ) |
|
46 { |
|
47 FUNC_LOG; |
|
48 } |
|
49 |
|
50 |
|
51 // Destructor |
|
52 EXPORT_C CCFOperationNode::~CCFOperationNode() |
|
53 { |
|
54 FUNC_LOG; |
|
55 |
|
56 delete iDomTreeLocationInfo; |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CCFOperationNode::Value |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C CCFOperationNode::TCFConditionValue CCFOperationNode::Value() const |
|
65 { |
|
66 FUNC_LOG; |
|
67 |
|
68 return iValue; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CCFOperationNode::InternalizeL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C void CCFOperationNode::InternalizeL( RReadStream& /*aStream*/ ) |
|
76 { |
|
77 FUNC_LOG; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CCFOperationNode::ExternalizeL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C void CCFOperationNode::ExternalizeL( RWriteStream& /*aStream*/ ) |
|
85 { |
|
86 FUNC_LOG; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CCFOperationNode::Cleanup |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C void CCFOperationNode::Cleanup() |
|
94 { |
|
95 FUNC_LOG; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CCFOperationNode::GenerateDomTreeLocationInfoL |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C void CCFOperationNode::GenerateDomTreeLocationInfoL( |
|
103 CMDXMLNode& aNode ) |
|
104 { |
|
105 FUNC_LOG; |
|
106 |
|
107 iDomTreeLocationInfo = HBufC::NewL( KDomTreeLocationInfoSize ); |
|
108 TPtr info( iDomTreeLocationInfo->Des() ); |
|
109 CMDXMLNode* domNode = &aNode; |
|
110 |
|
111 while ( domNode && domNode->NodeName() != KXMLDocumentElementNodeName ) |
|
112 { |
|
113 TPtrC nodeName( domNode->NodeName() ); |
|
114 TInt sequenceNumber( 1 ); |
|
115 TBuf< 16 > seqNumBuffer; |
|
116 |
|
117 CMDXMLNode* prevSibling = domNode->PreviousSibling(); |
|
118 while ( prevSibling ) |
|
119 { |
|
120 if ( prevSibling->NodeType() != CMDXMLNode::ECommentNode ) |
|
121 { |
|
122 ++sequenceNumber; |
|
123 } |
|
124 prevSibling = prevSibling->PreviousSibling(); |
|
125 } |
|
126 seqNumBuffer.AppendNum( sequenceNumber ); |
|
127 |
|
128 TInt requiredLen = nodeName.Length() + seqNumBuffer.Length() |
|
129 + KInfoPrintExtraLen; |
|
130 TInt freeLen = info.MaxLength() - info.Length(); |
|
131 if ( requiredLen > freeLen ) |
|
132 { |
|
133 iDomTreeLocationInfo = iDomTreeLocationInfo->ReAllocL( |
|
134 info.MaxLength() + KDomTreeLocationInfoSize ); |
|
135 info.Set( iDomTreeLocationInfo->Des() ); |
|
136 } |
|
137 |
|
138 if ( domNode != &aNode ) |
|
139 { |
|
140 info.Insert( 0, KDebugLocationSeparator ); |
|
141 } |
|
142 |
|
143 info.Insert( 0, KDebugLocationNameEnd ); |
|
144 info.Insert( 0, nodeName ); |
|
145 info.Insert( 0, KDebugLocationNameStart ); |
|
146 info.Insert( 0, KDebugLocationSeparator ); |
|
147 info.Insert( 0, seqNumBuffer ); |
|
148 |
|
149 domNode = domNode->ParentNode(); |
|
150 } |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CCFOperationNode::Extension |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C TAny* CCFOperationNode::Extension( const TUid& /*aUid*/ ) const |
|
158 { |
|
159 FUNC_LOG; |
|
160 |
|
161 return NULL; |
|
162 } |