Changeset 604 for ossie/trunk/ossie/parser/ComponentSupportedInterface.cpp
- Timestamp:
- 10/05/05 14:34:19 (8 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
ossie/trunk/ossie/parser/ComponentSupportedInterface.cpp
r397 r604 26 26 27 27 #include "ossie/ComponentSupportedInterface.h" 28 #define mdel(x) if (x!=NULL) delete x, x=NULL;29 #define sweetd(x) if (x!=NULL) delete []x, x=NULL;28 #define DELPTR(x) if (x!=NULL) delete x, x=NULL; 29 #define DELARRAY(x) if (x!=NULL) delete []x, x=NULL; 30 30 31 31 /**default constructor … … 48 48 theFindBy(NULL) 49 49 { 50 this->parseElement();50 this->parseElement(); 51 51 } 52 52 … … 61 61 { 62 62 63 this->identifier = new char[strlen (_csi.identifier) + 1];64 strcpy (identifier, _csi.identifier);63 this->identifier = new char[strlen (_csi.identifier) + 1]; 64 strcpy (identifier, _csi.identifier); 65 65 66 this->componentInstantiationRefId =67 new char[strlen (_csi.componentInstantiationRefId) + 1];68 strcpy (componentInstantiationRefId, _csi.componentInstantiationRefId);66 this->componentInstantiationRefId = 67 new char[strlen (_csi.componentInstantiationRefId) + 1]; 68 strcpy (componentInstantiationRefId, _csi.componentInstantiationRefId); 69 69 70 this->ifComponentInstantiationRef = _csi.ifComponentInstantiationRef;71 this->ifFindBy = _csi.ifFindBy;70 this->ifComponentInstantiationRef = _csi.ifComponentInstantiationRef; 71 this->ifFindBy = _csi.ifFindBy; 72 72 73 if (_csi.theFindBy != NULL) this->theFindBy = new FindBy (_csi.root);73 if (_csi.theFindBy != NULL) this->theFindBy = new FindBy (_csi.root); 74 74 } 75 75 … … 77 77 ComponentSupportedInterface::~ComponentSupportedInterface () 78 78 { 79 mdel(theFindBy);80 sweetd(componentInstantiationRefId);81 sweetd(identifier);79 DELPTR(theFindBy); 80 DELARRAY(componentInstantiationRefId); 81 DELARRAY(identifier); 82 82 } 83 83 … … 85 85 void ComponentSupportedInterface::parseElement() 86 86 { 87 parseID(root);88 parseComponentInstantiationRef(root);87 parseID(root); 88 parseComponentInstantiationRef(root); 89 89 } 90 90 … … 92 92 void ComponentSupportedInterface::parseID (DOMElement * _elem) 93 93 { 94 tmpXMLStr = XMLString::transcode ("supportedidentifier"); 95 DOMNodeList *nodeList = _elem->getElementsByTagName(tmpXMLStr);96 sweetd(tmpXMLStr);94 tmpXMLStr = XMLString::transcode("supportedidentifier"); 95 DOMNodeList *nodeList = _elem->getElementsByTagName(tmpXMLStr); 96 XMLString::release(&tmpXMLStr); 97 97 98 if (nodeList->getLength() != 0)99 {100 identifier = getTextNode((DOMElement *) nodeList->item (0));101 }98 if (nodeList->getLength() != 0) 99 { 100 identifier = getTextNode((DOMElement *) nodeList->item (0)); 101 } 102 102 } 103 103 … … 105 105 (DOMElement* _elem) 106 106 { 107 tmpXMLStr = XMLString::transcode ("componentinstantiationref");108 DOMNodeList *nodeList =_elem->getElementsByTagName(tmpXMLStr);109 sweetd(tmpXMLStr);107 tmpXMLStr = XMLString::transcode ("componentinstantiationref"); 108 DOMNodeList *nodeList =_elem->getElementsByTagName(tmpXMLStr); 109 XMLString::release(&tmpXMLStr); 110 110 111 if (nodeList->getLength () != 0)112 {113 ifComponentInstantiationRef = true;114 DOMElement *_tmpElement = (DOMElement *) nodeList->item (0);111 if (nodeList->getLength () != 0) 112 { 113 ifComponentInstantiationRef = true; 114 DOMElement *_tmpElement = (DOMElement *) nodeList->item (0); 115 115 116 tmpXMLStr = XMLString::transcode("refid");117 const XMLCh *_tmp =_tmpElement->getAttribute(tmpXMLStr);118 sweetd(tmpXMLStr);119 componentInstantiationRefId = XMLString::transcode (_tmp);120 }116 tmpXMLStr = XMLString::transcode("refid"); 117 const XMLCh *_tmp =_tmpElement->getAttribute(tmpXMLStr); 118 XMLString::release(&tmpXMLStr); 119 componentInstantiationRefId = XMLString::transcode (_tmp); 120 } 121 121 } 122 122 … … 124 124 char* ComponentSupportedInterface::getTextNode(DOMElement * _elem) 125 125 { 126 DOMNodeList *nodeList = _elem->getChildNodes();126 DOMNodeList *nodeList = _elem->getChildNodes(); 127 127 128 if (nodeList->getLength () == 0)129 {130 char* astr = new char[strlen("Not Specified") +1];131 strcpy(astr,"Not Specified");132 return astr;133 }134 else return XMLString::transcode(nodeList->item (0)->getNodeValue ());128 if (nodeList->getLength () == 0) 129 { 130 char* astr = new char[strlen("Not Specified") +1]; 131 strcpy(astr,"Not Specified"); 132 return astr; 133 } 134 else return XMLString::transcode(nodeList->item (0)->getNodeValue ()); 135 135 } 136 136 … … 138 138 bool ComponentSupportedInterface::isComponentInstantiationRef() 139 139 { 140 return ifComponentInstantiationRef;140 return ifComponentInstantiationRef; 141 141 } 142 142 … … 144 144 bool ComponentSupportedInterface::isFindBy() 145 145 { 146 return ifFindBy;146 return ifFindBy; 147 147 } 148 148 … … 150 150 char* ComponentSupportedInterface::getID() const 151 151 { 152 return identifier;152 return identifier; 153 153 } 154 154 … … 156 156 char* ComponentSupportedInterface::getComponentInstantiationRefId() const 157 157 { 158 return componentInstantiationRefId;158 return componentInstantiationRefId; 159 159 } 160 160 … … 162 162 FindBy* ComponentSupportedInterface::getFindBy() const 163 163 { 164 return theFindBy;164 return theFindBy; 165 165 } 166 166 XMLCh* ComponentSupportedInterface::tmpXMLStr = NULL;