1.1 --- a/epoc32/include/xmlelemt.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,192 +0,0 @@
1.4 -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -// XmlElement.h
1.18 -// XML Element class
1.19 -// Derived from CTypedNode. Adds functionality
1.20 -// to make the use of the node simpler
1.21 -//
1.22 -//
1.23 -
1.24 -#ifndef __XMLELEMT_H
1.25 -#define __XMLELEMT_H
1.26 -
1.27 -//
1.28 -// INCLUDES
1.29 -//
1.30 -#include <e32base.h>
1.31 -#include <cnode.h>
1.32 -
1.33 -//
1.34 -// CONSTANTS
1.35 -//
1.36 -/**
1.37 -@publishedAll
1.38 -@deprecated
1.39 -*/
1.40 -_LIT(KXmlElementDataItemAttributeName, "__XML_DI");
1.41 -
1.42 -//
1.43 -// DATA TYPES
1.44 -//
1.45 -enum TXmlElementPanic
1.46 -/**
1.47 -@publishedAll
1.48 -@deprecated
1.49 -*/
1.50 -{
1.51 - EXmlElPanicInvalidDataItem = 1
1.52 -};
1.53 -
1.54 -// Type of an attribute in a node
1.55 -typedef const TDesC* TXmlAttributeType;
1.56 -// Type of an element (type of node)
1.57 -typedef const TDesC* TXmlElementType;
1.58 -
1.59 -//
1.60 -// FUNCTION PROTOTYPES
1.61 -//
1.62 -/**
1.63 -@publishedAll
1.64 -@deprecated
1.65 -*/
1.66 -GLREF_C void Panic(TXmlElementPanic aPanic);
1.67 -
1.68 -//
1.69 -// FORWARD DECLARATIONS
1.70 -//
1.71 -class RFile;
1.72 -class CAttributeLookupTable;
1.73 -
1.74 -//
1.75 -// CLASS DEFINITIONS
1.76 -//
1.77 -//##ModelId=3B66798702FF
1.78 -class CXmlElement : public CTypedNode<TXmlElementType, TXmlAttributeType>
1.79 -/**
1.80 -@publishedAll
1.81 -@deprecated
1.82 -*/
1.83 -{
1.84 -public:
1.85 - // Construction
1.86 - //##ModelId=3B6679870364
1.87 - static inline CXmlElement* NewL(TXmlElementType aType,CNode* aParent);
1.88 -
1.89 - // Attributes
1.90 - // Return the value of a particular attribute
1.91 - //##ModelId=3B667987035D
1.92 - IMPORT_C const TDesC* Attribute(const TDesC& aAttributeName) const;
1.93 - // Return the value of an aIndexth attribute
1.94 - //##ModelId=3B6679870362
1.95 - inline const TDesC* Attribute(TInt aIndex) const;
1.96 -
1.97 - // Set attribute value
1.98 - //##ModelId=3B6679870359
1.99 - IMPORT_C void SetAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue, CAttributeLookupTable& aAttributeLUT);
1.100 -
1.101 - // Store a unicode descriptor as data value.
1.102 - //##ModelId=3B6679870357
1.103 - IMPORT_C void SetTextL(const TDesC& aData);
1.104 - // Get data value
1.105 - //##ModelId=3B6679870352
1.106 - inline const TDesC* Text() const;
1.107 -
1.108 - // Children
1.109 - //##ModelId=3B6679870350
1.110 - inline void AppendChildL(CXmlElement* aElement);
1.111 -
1.112 - //##ModelId=3B667987034D
1.113 - IMPORT_C void InsertChildL(TInt aIndexToInsertBefore, CXmlElement* aElement);
1.114 -
1.115 - //##ModelId=3B6679870347
1.116 - inline TInt Count() const;
1.117 -
1.118 - //##ModelId=3B6679870345
1.119 - inline CXmlElement* Child(TInt aIndex) const;
1.120 -
1.121 - // Find out the index of this child
1.122 - // INPUT:
1.123 - // aChild - Pointer to the child node
1.124 - // RETURN:
1.125 - // TInt - index to the child, -1 if no child found
1.126 - //##ModelId=3B6679870343
1.127 - IMPORT_C TInt ChildIndex(CXmlElement* aChild) const;
1.128 -
1.129 - // Data item
1.130 - //##ModelId=3B667987033C
1.131 - IMPORT_C void SetDataItemL(CBase* aDataItem, CAttributeLookupTable& aAttributeLUT); // takes ownership of aDataItem
1.132 - //##ModelId=3B667987033B
1.133 - IMPORT_C CBase* DataItem() const;
1.134 - //##ModelId=3B6679870339
1.135 - IMPORT_C void DeleteDataItem(CAttributeLookupTable& aAttributeLUT);
1.136 -
1.137 -private:
1.138 - // Data Item handling
1.139 - class CDataItemAttribute : public CBase
1.140 - {
1.141 - public:
1.142 - ~CDataItemAttribute() { delete iDataItem; };
1.143 - CBase* iDataItem;
1.144 - };
1.145 -
1.146 - //##ModelId=3B6679870335
1.147 - CXmlElement() : CTypedNode<TXmlElementType, TXmlAttributeType>(NULL, NULL) {};
1.148 -
1.149 -// Debug stuff
1.150 -//#ifdef _DEBUG
1.151 -public:
1.152 - //##ModelId=3B6679870334
1.153 - IMPORT_C void WriteIntoFileL();
1.154 - //##ModelId=3B6679870331
1.155 - void StartWriteL(RFile& aFile, TInt aIndentation);
1.156 -private:
1.157 - //##ModelId=3B6679870327
1.158 - void WriteNameL(RFile& aFile, TInt aIndentation);
1.159 -//#endif
1.160 -};
1.161 -
1.162 -//
1.163 -// INLINE METHODS
1.164 -//
1.165 -inline CXmlElement* CXmlElement::NewL(TXmlElementType aType,CNode* aParent)
1.166 -{
1.167 - return (CXmlElement*)CTypedNode<TXmlElementType, TXmlAttributeType>::NewL(aType, aParent);
1.168 -}
1.169 -
1.170 -inline const TDesC* CXmlElement::Attribute(TInt aIndex) const
1.171 -{
1.172 - return (TDesC*)((CDataDelete*)AttributeByIndex(aIndex))->Data();
1.173 -}
1.174 -
1.175 -inline const TDesC* CXmlElement::Text() const
1.176 -{
1.177 - return (const TDesC*)CTypedNode<TXmlElementType, TXmlAttributeType>::Data();
1.178 -}
1.179 -
1.180 -inline void CXmlElement::AppendChildL(CXmlElement* aElement)
1.181 -{
1.182 - CTypedNode<TXmlElementType, TXmlAttributeType>::AppendNodeToThisNodeL(aElement);
1.183 -}
1.184 -
1.185 -inline TInt CXmlElement::Count() const
1.186 -{
1.187 - return NumberImmediateChildren();
1.188 -}
1.189 -
1.190 -inline CXmlElement* CXmlElement::Child(TInt aIndex) const
1.191 -{
1.192 - return (CXmlElement*)CTypedNode<TXmlElementType, TXmlAttributeType>::Child(aIndex);
1.193 -}
1.194 -
1.195 -#endif //__XMLELEMT_H