|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Implementation for XCFW Tree Node |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "xcfwnode.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CXCFWNode::CXCFWNode |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CXCFWNode::CXCFWNode() |
|
32 { |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CXCFWNode::ConstructL |
|
37 // Symbian 2nd phase constructor can leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CXCFWNode::ConstructL( |
|
41 CGECOObjectBase* aData ) |
|
42 { |
|
43 SetData(aData); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CXCFWNode::NewL |
|
48 // Two-phased constructor with Node Data initializer. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CXCFWNode* CXCFWNode::NewL( |
|
52 CGECOObjectBase* aData ) |
|
53 { |
|
54 CXCFWNode* self = new( ELeave ) CXCFWNode; |
|
55 |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(aData); |
|
58 CleanupStack::Pop( self ); |
|
59 |
|
60 return self; |
|
61 } |
|
62 |
|
63 |
|
64 // Destructor |
|
65 CXCFWNode::~CXCFWNode() |
|
66 { |
|
67 delete iData; //delete only owned pointer. Others are not owned. |
|
68 iParent = NULL; |
|
69 iFirstChild = NULL; |
|
70 iLastChild = NULL; |
|
71 iPrevSibling = NULL; |
|
72 iNextSibling = NULL; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CXCFWNode::SetParent |
|
77 // Assign given node to non-owned member pointer variable |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CXCFWNode::SetParent( |
|
81 MXCFWNode* aNode ) |
|
82 { |
|
83 iParent = aNode; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CXCFWNode::SetFirstChild |
|
88 // Assign given node to non-owned member pointer variable |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CXCFWNode::SetFirstChild( |
|
92 MXCFWNode* aNode ) |
|
93 { |
|
94 iFirstChild = aNode; |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CXCFWNode::SetLastChild |
|
99 // Assign given node to non-owned member pointer variable |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CXCFWNode::SetLastChild( |
|
103 MXCFWNode* aNode ) |
|
104 { |
|
105 iLastChild = aNode; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CXCFWNode::SetNextSibling |
|
110 // Assign given node to non-owned member pointer variable |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CXCFWNode::SetNextSibling( |
|
114 MXCFWNode* aNode ) |
|
115 { |
|
116 iNextSibling = aNode; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CXCFWNode::SetPrevSibling |
|
121 // Assign given node to non-owned member pointer variable |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void CXCFWNode::SetPrevSibling( |
|
125 MXCFWNode* aNode ) |
|
126 { |
|
127 iPrevSibling = aNode; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CXCFWNode::SetData |
|
132 // Assign given data to member data variable. Owned. User should take care that |
|
133 // the previous data object is deleted. |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CXCFWNode::SetData( |
|
137 CGECOObjectBase* aData ) |
|
138 { |
|
139 iData = aData; |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CXCFWNode::Parent |
|
144 // return internal pointer |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 EXPORT_C MXCFWNode* CXCFWNode::Parent() |
|
148 { |
|
149 return iParent; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CXCFWNode::FirstChild |
|
154 // return internal pointer |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C MXCFWNode* CXCFWNode::FirstChild() |
|
158 { |
|
159 return iFirstChild; |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CXCFWNode::LastChild |
|
164 // return internal pointer |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C MXCFWNode* CXCFWNode::LastChild() |
|
168 { |
|
169 return iLastChild; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CXCFWNode::NextSibling |
|
174 // return internal pointer |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C MXCFWNode* CXCFWNode::NextSibling() |
|
178 { |
|
179 return iNextSibling; |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // CXCFWNode::PrevSibling |
|
184 // return internal pointer |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C MXCFWNode* CXCFWNode::PrevSibling() |
|
188 { |
|
189 return iPrevSibling; |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CXCFWNode::Data |
|
195 // return internal data object as CGECOObjectBase pointer. User needs to do |
|
196 // appropriate casting operations to get access to object-specific functionality |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C CGECOObjectBase* CXCFWNode::Data() |
|
200 { |
|
201 return iData; |
|
202 } |
|
203 |
|
204 |
|
205 // End of File |