1 /// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 /// All rights reserved. |
2 // All rights reserved. |
3 /// This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 /// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of "Eclipse Public License v1.0" |
5 /// which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 /// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 /// |
7 // |
8 /// Initial Contributors: |
8 // Initial Contributors: |
9 /// Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 /// |
10 // |
11 /// Contributors: |
11 // Contributors: |
12 /// |
12 // |
13 /// Description: |
13 // Description: |
14 /// All rights reserved. |
14 // This contains the definitions of CDataDelete, CDataNoDelete, CIntAttribute, CNode, and CTypedNode. |
15 /// This component and the accompanying materials are made available |
15 // CDataNoDelete is a base class to CDataDelete and are essentially a wrapper around an HBufC16. |
16 /// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
16 // The node owns the data that is added to it and therefore is responsible for deleting all its data, |
17 /// which accompanies this distribution, and is available |
17 // hence theses two classes allow a user to have non deletable data. Internally to the node it is also |
18 /// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
18 // sometimes necessary to change the data into either deletable or non-deletable data api's are provided |
19 /// Initial Contributors: |
19 // for this. |
20 /// Nokia Corporation - initial contribution. |
20 // CIntAttribute is wrapper around a TInt, this is provided as the nodes attribute value is a CBase* however |
21 /// Contributors: |
21 // it might be desirable to store integer's in here. Attribute value is owned by the node therefore the node is |
22 /// This contains the definitions of CDataDelete, CDataNoDelete, CIntAttribute, CNode, and CTypedNode. |
22 // responsible for deleting it. |
23 /// CDataNoDelete is a base class to CDataDelete and are essentially a wrapper around an HBufC16. |
23 // CNode is the basis for constructing a tree. It consists of an array of child nodes, node type, a parent node, |
24 /// The node owns the data that is added to it and therefore is responsible for deleting all its data, |
24 // an array of attributes, and a data member. Internally the data member is defined as CDataNoDelete however |
25 /// hence theses two classes allow a user to have non deletable data. Internally to the node it is also |
25 // to the user all the exported api's take an HBufC16*. Data is owned by the node and is destroyed by the node, |
26 /// sometimes necessary to change the data into either deletable or non-deletable data api's are provided |
26 // However in certain circumstances this is not desirable hence the api's to make the data non-deletable. The |
27 /// for this. |
27 // node type is defined as a TAny* however normal usage would use the templated node - CTypedNode. The node type |
28 /// CIntAttribute is wrapper around a TInt, this is provided as the nodes attribute value is a CBase* however |
28 // is used to identify groups of nodes. The attribute array is fairy simple and consists of AttributeType and |
29 /// it might be desirable to store integer's in here. Attribute value is owned by the node therefore the node is |
29 // AttributeValue. AttributeType can be defined by using the templated class and should be a 32bit value. AttributeValue |
30 /// responsible for deleting it. |
30 // can be any object derived from CBase and the node takes ownership therefore the node delete's it. |
31 /// CNode is the basis for constructing a tree. It consists of an array of child nodes, node type, a parent node, |
31 // Basic usage should be to use the templated class in order to make use of the templated types (TNodeType,TAttributeType). |
32 /// an array of attributes, and a data member. Internally the data member is defined as CDataNoDelete however |
32 // Create a node for example: |
33 /// to the user all the exported api's take an HBufC16*. Data is owned by the node and is destroyed by the node, |
33 // CTypedNode<CNode*, const TDesC*> *tree = CTypedNode<CNode*, const TDesC*>::NewL(0,0); |
34 /// However in certain circumstances this is not desirable hence the api's to make the data non-deletable. The |
34 // add a new child: |
35 /// node type is defined as a TAny* however normal usage would use the templated node - CTypedNode. The node type |
35 // CNODE *TestChildNode1 = tree->AppendNodeL(aTempNodeForNodeType); |
36 /// is used to identify groups of nodes. The attribute array is fairy simple and consists of AttributeType and |
36 // add some data: |
37 /// AttributeValue. AttributeType can be defined by using the templated class and should be a 32bit value. AttributeValue |
37 // TestChildNode1->SetDataL(aHBufC16); |
38 /// can be any object derived from CBase and the node takes ownership therefore the node delete's it. |
38 // add an attribute: |
39 /// Basic usage should be to use the templated class in order to make use of the templated types (TNodeType,TAttributeType). |
39 // TestChildNode1->->AddAttributeL(aTAttributeType,aCBasePointerAttributeValue); |
40 /// Create a node for example: |
40 // Explanation of individual api's is documented below. |
41 /// CTypedNode<CNode*, const TDesC*> *tree = CTypedNode<CNode*, const TDesC*>::NewL(0,0); |
41 // |
42 /// add a new child: |
|
43 /// CNODE *TestChildNode1 = tree->AppendNodeL(aTempNodeForNodeType); |
|
44 /// add some data: |
|
45 /// TestChildNode1->SetDataL(aHBufC16); |
|
46 /// add an attribute: |
|
47 /// TestChildNode1->->AddAttributeL(aTAttributeType,aCBasePointerAttributeValue); |
|
48 /// Explanation of individual api's is documented below. |
|
49 /// |
|
50 |
|
51 |
42 |
52 |
43 |
53 |
44 |
54 #ifndef __CNODE_H__ |
45 #ifndef __CNODE_H__ |
55 #define __CNODE_H__ |
46 #define __CNODE_H__ |
289 //##ModelId=3B666BCE0049 |
280 //##ModelId=3B666BCE0049 |
290 IMPORT_C CBase* AttributeByIndex(TInt aIndex,TAny*& aType) const; |
281 IMPORT_C CBase* AttributeByIndex(TInt aIndex,TAny*& aType) const; |
291 |
282 |
292 //Adds an attribute, parameters are the type of attribute and its value |
283 //Adds an attribute, parameters are the type of attribute and its value |
293 //WARNING node takes ownership of aAttributeValue |
284 //WARNING node takes ownership of aAttributeValue |
294 ////Push aAttributeValue onto the CleanupStack before calling then pop off on return |
285 //Push aAttributeValue onto the CleanupStack before calling then pop off on return |
295 //##ModelId=3B666BCE002B |
286 //##ModelId=3B666BCE002B |
296 IMPORT_C void AddAttributeL(TAny* AttributeType, CBase* aAttributeValue); |
287 IMPORT_C void AddAttributeL(TAny* AttributeType, CBase* aAttributeValue); |
297 |
288 |
298 //Adds data to the node and also adds an attribute, parameters are the Data to be added, the type of attribute and its value |
289 //Adds data to the node and also adds an attribute, parameters are the Data to be added, the type of attribute and its value |
299 //WARNING node takes ownership of aData and aAttributeValue |
290 //WARNING node takes ownership of aData and aAttributeValue |
300 ////Push aAttributeValue and aData onto the CleanupStack before calling then pop off on return |
291 //Push aAttributeValue and aData onto the CleanupStack before calling then pop off on return |
301 //##ModelId=3B666BCE000D |
292 //##ModelId=3B666BCE000D |
302 IMPORT_C void AddDataAndAttributeL(HBufC16 *aData, TAny* AttributeType, CBase* aAttributeValue); |
293 IMPORT_C void AddDataAndAttributeL(HBufC16 *aData, TAny* AttributeType, CBase* aAttributeValue); |
303 |
294 |
304 //Returns an attribute value for the given AttributeType(the parameter) |
295 //Returns an attribute value for the given AttributeType(the parameter) |
305 //##ModelId=3B666BCE0003 |
296 //##ModelId=3B666BCE0003 |