Show
Ignore:
Timestamp:
10/05/05 14:34:19 (8 years ago)
Author:
tuan
Message:

Fix up format and some Terminate stuffs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossie/trunk/ossie/parser/ComponentSupportedInterface.cpp

    r397 r604  
    2626 
    2727#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; 
    3030 
    3131/**default constructor 
     
    4848theFindBy(NULL) 
    4949{ 
    50         this->parseElement(); 
     50    this->parseElement(); 
    5151} 
    5252 
     
    6161{ 
    6262 
    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); 
    6565 
    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); 
    6969 
    70         this->ifComponentInstantiationRef = _csi.ifComponentInstantiationRef; 
    71         this->ifFindBy = _csi.ifFindBy; 
     70    this->ifComponentInstantiationRef = _csi.ifComponentInstantiationRef; 
     71    this->ifFindBy = _csi.ifFindBy; 
    7272 
    73         if (_csi.theFindBy != NULL) this->theFindBy = new FindBy (_csi.root); 
     73    if (_csi.theFindBy != NULL) this->theFindBy = new FindBy (_csi.root); 
    7474} 
    7575 
     
    7777ComponentSupportedInterface::~ComponentSupportedInterface () 
    7878{ 
    79         mdel(theFindBy); 
    80         sweetd(componentInstantiationRefId); 
    81         sweetd(identifier); 
     79    DELPTR(theFindBy); 
     80    DELARRAY(componentInstantiationRefId); 
     81    DELARRAY(identifier); 
    8282} 
    8383 
     
    8585void ComponentSupportedInterface::parseElement() 
    8686{ 
    87         parseID(root); 
    88         parseComponentInstantiationRef(root); 
     87    parseID(root); 
     88    parseComponentInstantiationRef(root); 
    8989} 
    9090 
     
    9292void ComponentSupportedInterface::parseID (DOMElement * _elem) 
    9393{ 
    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); 
    9797 
    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    } 
    102102} 
    103103 
     
    105105(DOMElement* _elem) 
    106106{ 
    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); 
    110110 
    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); 
    115115 
    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    } 
    121121} 
    122122 
     
    124124char* ComponentSupportedInterface::getTextNode(DOMElement * _elem) 
    125125{ 
    126         DOMNodeList *nodeList = _elem->getChildNodes(); 
     126    DOMNodeList *nodeList = _elem->getChildNodes(); 
    127127 
    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 ()); 
    135135} 
    136136 
     
    138138bool ComponentSupportedInterface::isComponentInstantiationRef() 
    139139{ 
    140         return ifComponentInstantiationRef; 
     140    return ifComponentInstantiationRef; 
    141141} 
    142142 
     
    144144bool ComponentSupportedInterface::isFindBy() 
    145145{ 
    146         return ifFindBy; 
     146    return ifFindBy; 
    147147} 
    148148 
     
    150150char* ComponentSupportedInterface::getID() const 
    151151{ 
    152         return identifier; 
     152    return identifier; 
    153153} 
    154154 
     
    156156char* ComponentSupportedInterface::getComponentInstantiationRefId() const 
    157157{ 
    158         return componentInstantiationRefId; 
     158    return componentInstantiationRefId; 
    159159} 
    160160 
     
    162162FindBy* ComponentSupportedInterface::getFindBy() const 
    163163{ 
    164         return theFindBy; 
     164    return theFindBy; 
    165165} 
    166166XMLCh* ComponentSupportedInterface::tmpXMLStr = NULL;