Ignore:
Timestamp:
Nov 18, 2013, 5:53:53 AM (6 years ago)
Author:
cameron
Message:

Updates to xercesc sources

Location:
icXML/icXML-devel/src/xercesc/dom/impl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icXML/icXML-devel/src/xercesc/dom/impl/DOMAttrImpl.cpp

    r2777 r3565  
    3232
    3333DOMAttrImpl::DOMAttrImpl(DOMDocument *ownerDoc, const XMLCh *aName)
    34     : fNode(ownerDoc), fParent (ownerDoc), fSchemaType(0)
    35 {
    36     DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
    37     fName = docImpl->getPooledString(aName);
     34: fNode(ownerDoc)
     35, fName(((DOMDocumentImpl *)ownerDoc)->getPooledString(aName))
     36, fParent(ownerDoc)
     37, fSchemaType(0)
     38{
    3839    fNode.isSpecified(true);
    3940}
    4041
    4142DOMAttrImpl::DOMAttrImpl(const DOMAttrImpl &other, bool /*deep*/)
    42     : DOMAttr(other)
    43     , fNode(other.fNode)
    44     , fParent (other.fParent)
    45     , fName(other.fName)
    46     , fSchemaType(other.fSchemaType)
    47 {
    48     if (other.fNode.isSpecified())
    49         fNode.isSpecified(true);
    50     else
    51         fNode.isSpecified(false);
     43: DOMAttr(other)
     44, fNode(other.fNode)
     45, fName(other.fName)
     46, fParent (other.fParent)
     47, fSchemaType(other.fSchemaType)
     48{
     49    fNode.isSpecified(other.fNode.isSpecified());
    5250
    5351    if (other.fNode.isIdAttr())
  • icXML/icXML-devel/src/xercesc/dom/impl/DOMAttrMapImpl.cpp

    r2777 r3565  
    3333XERCES_CPP_NAMESPACE_BEGIN
    3434
    35 DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod)
    36 {
    37     this->fOwnerNode=ownerNod;
    38     this->fNodes = 0;
    39         hasDefaults(false);
    40 }
    41 
    42 DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults)
    43 {
    44     this->fOwnerNode=ownerNod;
    45     this->fNodes = 0;
    46         hasDefaults(false);
    47         if (defaults != 0)
    48         {
    49                 if (defaults->getLength() > 0)
    50                 {
    51                         hasDefaults(true);
    52                         cloneContent(defaults);
    53                 }
    54         }
     35DOMAttrMapImpl::DOMAttrMapImpl(DOMNode * owner)
     36: fOwnerNode(owner)
     37, fNodes(0)
     38, attrDefaults(false)
     39{
     40
     41}
     42
     43DOMAttrMapImpl::DOMAttrMapImpl(DOMNode * owner, const DOMAttrMapImpl *defaults)
     44: fOwnerNode(owner)
     45, fNodes(0)
     46, attrDefaults(false)
     47{
     48    cloneContent(defaults);
    5549}
    5650
     
    6155void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap)
    6256{
     57    attrDefaults = false;
    6358    if ((srcmap != 0) && (srcmap->fNodes != 0))
    6459    {
    65         if (fNodes != 0)
     60        attrDefaults = true;
     61        if (fNodes)
    6662            fNodes->reset();
    6763        else
     
    9086        DOMAttrMapImpl *newmap = new (castToNodeImpl(ownerNode_p)->getOwnerDocument()) DOMAttrMapImpl(ownerNode_p);
    9187        newmap->cloneContent(this);
    92         // newmap->attrDefaults = this->attrDefaults;  // revisit
    9388        return newmap;
    9489}
  • icXML/icXML-devel/src/xercesc/dom/impl/DOMDocumentImpl.cpp

    r2777 r3565  
    507507DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const
    508508{
     509    DEBUG_MESSAGE("DOMElementImpl::getElementsByTagName(" << tagname << ')')
     510
    509511    // cast off the const of this because we will update the fNodeListPool
    510512    return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname);
     
    644646
    645647
    646 DOMNodeList *DOMDocumentImpl::getElementsByTagNameNS(const XMLCh *fNamespaceURI,
    647     const XMLCh *fLocalName)  const
    648 {
     648DOMNodeList *DOMDocumentImpl::getElementsByTagNameNS(const XMLCh *fNamespaceURI, const XMLCh *fLocalName)  const
     649{
     650    DEBUG_MESSAGE("DOMDocumentImpl::getElementsByTagNameNS(" << fNamespaceURI << ',' << fLocalName << ')')
     651
    649652    // cast off the const of this because we will update the fNodeListPool
    650653    return ((DOMDocumentImpl*)this)->getDeepNodeList(this, fNamespaceURI, fLocalName);
     
    10641067    DOMNode *newnode=0;
    10651068    bool oldErrorCheckingFlag = errorChecking;
     1069
     1070    assert (source);
    10661071
    10671072    switch (source->getNodeType())
     
    12741279        fNode.callUserDataHandlers(DOMUserDataHandler::NODE_IMPORTED, source, newnode);
    12751280
     1281    assert (newnode);
     1282
    12761283    return newnode;
    12771284}
  • icXML/icXML-devel/src/xercesc/dom/impl/DOMElementImpl.cpp

    r2777 r3565  
    4444
    4545DOMElementImpl::DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *eName)
    46     : fNode(ownerDoc), fParent(ownerDoc), fAttributes(0), fDefaultAttributes(0)
     46: fNode(ownerDoc)
     47, fName(((DOMDocumentImpl *)ownerDoc)->getPooledString(eName))
     48, fParent(ownerDoc)
     49, fAttributes(0)
     50, fDefaultAttributes(0)
    4751{
    4852    DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
    49     fName = docImpl->getPooledString(eName);
    5053    setupDefaultAttributes();
    51     if (!fDefaultAttributes) {
    52         fDefaultAttributes = new (docImpl) DOMAttrMapImpl(this);
    53         fAttributes = new (docImpl) DOMAttrMapImpl(this);
    54     }
    55     else {
    56       fAttributes = new (docImpl) DOMAttrMapImpl(this, fDefaultAttributes);
    57     }
     54    fAttributes = new (docImpl) DOMAttrMapImpl(this, fDefaultAttributes);
    5855}
    5956
    6057
    6158DOMElementImpl::DOMElementImpl(const DOMElementImpl &other, bool deep)
    62     : DOMElement(other),
    63       fNode (other.fParent.fOwnerDocument),
    64       fParent (other.fParent.fOwnerDocument),
    65       fAttributes(0),
    66       fDefaultAttributes(0)
    67 {
    68     fName = other.fName;
    69 
     59: DOMElement(other)
     60, fNode(other.fParent.fOwnerDocument)
     61, fName(other.fName)
     62, fParent(other.fParent.fOwnerDocument)
     63, fAttributes(0)
     64, fDefaultAttributes(0)
     65{
    7066    if (deep)
    7167        fParent.cloneChildren(&other);
     
    8076        fDefaultAttributes = ((DOMAttrMapImpl *)other.getDefaultAttributes())->cloneAttrMap(this);
    8177    }
    82 
    83     if (!fDefaultAttributes)
     78    else
     79    {
    8480        setupDefaultAttributes();
    85 
    86     if (!fDefaultAttributes)
    87         fDefaultAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this);
    88 
    89     if (!fAttributes) {
    90         if (!fDefaultAttributes) {
    91             fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this);
    92         }
    93         else {
    94             fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this, fDefaultAttributes);
    95         }
     81    }
     82
     83    if (!fAttributes)
     84    {
     85        fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this, fDefaultAttributes);
    9686    }
    9787
     
    114104
    115105
    116 const XMLCh * DOMElementImpl::getNodeName() const {
     106const XMLCh * DOMElementImpl::getNodeName() const
     107{
    117108    return fName;
    118109}
    119110
    120111
    121 DOMNode::NodeType DOMElementImpl::getNodeType() const {
     112DOMNode::NodeType DOMElementImpl::getNodeType() const
     113{
    122114    return DOMNode::ELEMENT_NODE;
    123115}
     
    143135DOMNamedNodeMap *DOMElementImpl::getAttributes() const
    144136{
    145     DOMElementImpl *ncThis = (DOMElementImpl *)this;   // cast off const
    146     return ncThis->fAttributes;
     137    return const_cast<DOMElementImpl *>(this)->fAttributes;
    147138}
    148139
     
    151142DOMNodeList *DOMElementImpl::getElementsByTagName(const XMLCh *tagname) const
    152143{
     144    DEBUG_MESSAGE("DOMElementImpl::getElementsByTagName(" << tagname << ')')
     145
    153146    DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument;
    154147    return docImpl->getDeepNodeList(this,tagname);
     
    389382
    390383
    391 DOMNodeList *DOMElementImpl::getElementsByTagNameNS(const XMLCh *namespaceURI,
    392     const XMLCh *localName) const
    393 {
     384DOMNodeList *DOMElementImpl::getElementsByTagNameNS(const XMLCh *namespaceURI, const XMLCh *localName) const
     385{
     386    DEBUG_MESSAGE("DOMElementImpl::getElementsByTagNameNS(" << namespaceURI << ',' << localName << ')')
     387
    394388    DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument;
    395389    return docImpl->getDeepNodeList(this, namespaceURI, localName);
     
    408402
    409403
    410 bool DOMElementImpl::hasAttributeNS(const XMLCh *namespaceURI,
    411     const XMLCh *localName) const
     404bool DOMElementImpl::hasAttributeNS(const XMLCh *namespaceURI, const XMLCh *localName) const
    412405{
    413406    return (getAttributeNodeNS(namespaceURI, localName) != 0);
     
    419412DOMAttrMapImpl *DOMElementImpl::getDefaultAttributes() const
    420413{
     414    if (unlikely(fDefaultAttributes == 0))
     415    {
     416        DOMDocumentImpl * docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument;
     417        const_cast<DOMElementImpl*>(this)->fDefaultAttributes = new (docImpl) DOMAttrMapImpl(const_cast<DOMElementImpl*>(this));
     418    }
    421419    return fDefaultAttributes;
    422420}
     
    447445
    448446    // This will throw INUSE if necessary
    449     DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItem(newAttr);
     447    DOMAttr *oldAttr = (DOMAttr *)getDefaultAttributes()->setNamedItem(newAttr);
    450448    fAttributes->hasDefaults(true);
    451449
     
    464462
    465463    // This will throw INUSE if necessary
    466     DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItemNS(newAttr);
     464    DOMAttr *oldAttr = (DOMAttr *)getDefaultAttributes()->setNamedItemNS(newAttr);
    467465    fAttributes->hasDefaults(true);
    468466
Note: See TracChangeset for help on using the changeset viewer.