root/ossieparser/trunk/ComponentSupportedInterface.cpp @ 10

Revision 10, 3.1 KB (checked in by balister, 9 years ago)

Initial import

Line 
1#include "ComponentSupportedInterface.h"
2
3ComponentSupportedInterface::ComponentSupportedInterface( )
4{
5        this->theFindBy = NULL;
6        this->identifier = NULL;
7        this->componentInstantiationRefId = NULL;
8        this->ifFindBy = false;
9        this->ifComponentInstantiationRef = false;
10}
11
12ComponentSupportedInterface::ComponentSupportedInterface( DOMElement* _element )
13{
14        this->root = _element;
15        this->identifier = NULL;
16        this->ifComponentInstantiationRef = false;
17        this->ifFindBy = false;
18        this->theFindBy = NULL;
19        this->componentInstantiationRefId = NULL;
20        this->parseElement();
21}
22       
23ComponentSupportedInterface::ComponentSupportedInterface( const ComponentSupportedInterface& _csi )
24{
25        this->root = _csi.root;
26       
27        this->identifier = new char[ strlen( _csi.identifier ) + 1 ];
28        strcpy( identifier, _csi.identifier );
29
30        this->componentInstantiationRefId = new char[ strlen( _csi.componentInstantiationRefId ) + 1 ];
31        strcpy( componentInstantiationRefId, _csi.componentInstantiationRefId );
32
33        this->ifComponentInstantiationRef = _csi.ifComponentInstantiationRef;
34        this->ifFindBy = _csi.ifFindBy;
35
36        if( _csi.theFindBy == NULL )
37                this->theFindBy = NULL;
38        else
39                this->theFindBy = new FindBy( _csi.root );
40}
41
42ComponentSupportedInterface::~ComponentSupportedInterface()
43{
44        delete this->theFindBy;
45        this->theFindBy = NULL;
46
47        delete this->componentInstantiationRefId;
48        this->componentInstantiationRefId = NULL;
49
50        delete this->identifier;
51        this->identifier = NULL;
52}
53
54void ComponentSupportedInterface::parseElement()
55{
56        parseID(root);
57        parseComponentInstantiationRef(root);
58}
59
60
61void ComponentSupportedInterface::parseID( DOMElement* _elem )
62{
63        DOMNodeList* nodeList = _elem->getElementsByTagName( XMLString::transcode( "supportedidentifier" ) );
64   
65    if(nodeList->getLength() != 0)
66                identifier = getTextNode( (DOMElement*) nodeList->item(0) );
67}
68
69void ComponentSupportedInterface::parseComponentInstantiationRef( DOMElement* _elem )
70{
71        DOMNodeList* nodeList = _elem->getElementsByTagName( XMLString::transcode( "componentinstantiationref" ) );
72   
73    if(nodeList->getLength() != 0)
74    {
75                ifComponentInstantiationRef = true;
76                DOMElement* _tmpElement = (DOMElement*) nodeList->item(0);
77               
78                const XMLCh* _tmp = _tmpElement->getAttribute( XMLString::transcode( "refid" ) );
79                componentInstantiationRefId = XMLString::transcode( _tmp );
80    }
81}
82
83char* ComponentSupportedInterface::getTextNode(DOMElement* _elem)
84{
85    DOMNodeList* nodeList = _elem->getChildNodes();
86
87    if(nodeList->getLength() == 0)
88                return "NotSpecified";
89    else
90                return XMLString::transcode( nodeList->item(0)->getNodeValue() );
91}
92
93bool ComponentSupportedInterface::isComponentInstantiationRef() { return ifComponentInstantiationRef; }
94
95bool ComponentSupportedInterface::isFindBy() { return ifFindBy; }
96
97char* ComponentSupportedInterface::getID() const { return identifier; }
98 
99char* ComponentSupportedInterface::getComponentInstantiationRefId() const { return componentInstantiationRefId; }
100
101FindBy* ComponentSupportedInterface::getFindBy() const { return theFindBy; }
102
Note: See TracBrowser for help on using the browser.