Ignore:
Timestamp:
May 19, 2013, 9:20:51 AM (6 years ago)
Author:
cameron
Message:

Fixes for icXML 0.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icXML/icXML-devel/src/icxercesc/validators/schema/ComplexTypeInfo.cpp

    r3104 r3157  
    131131        , fContentSpec(0)
    132132        , fAttWildCard(0)
    133         , fAttList(0)
     133    , fAttList(NULL, manager)
    134134        , fElements(0)
    135135//      , fAttDefs(0)
     
    140140        , fMemoryManager(manager)
    141141{
    142 //      fAttDefs = new (fMemoryManager) RefHash2KeysTableOf<SchemaAttDef>(29, true, fMemoryManager);
    143     fAttList = new (fMemoryManager) SchemaAttDefList(NULL ,fMemoryManager);
     142
    144143}
    145144
     
    156155
    157156        delete fAttWildCard;
    158         delete fAttList;
    159157        delete fElements;
    160158        delete fLocator;
     
    175173    // fAttDefs->put((void*)(attName->getLocalPart()), attName->getURI(), toAdd);
    176174        // update and/or create fAttList
    177     fAttList->addAttDef(toAdd);
     175    fAttList.addAttDef(toAdd);
    178176}
    179177
     
    206204        //       access attributes (especially if same grammar is used in
    207205        //       multiple threads).
    208         return *fAttList;
     206    return const_cast<ComplexTypeInfo*>(this)->fAttList;
    209207}
    210208
     
    821819}
    822820
     821void ComplexTypeInfo::addElement(SchemaElementDecl* const elem)
     822{
     823    if (!fElements)
     824    {
     825        fElements = new (fMemoryManager) RefVectorOf<SchemaElementDecl>(8, false, fMemoryManager);
     826    }
     827    else if (fElements->containsElement(elem))
     828    {
     829        return;
     830    }
     831    fElements->addElement(elem);
     832}
     833
     834void ComplexTypeInfo::setTypeName(const XMLCh* const typeName)
     835{
     836    fMemoryManager->deallocate(fTypeName);
     837    fMemoryManager->deallocate(fTypeLocalName);
     838    fMemoryManager->deallocate(fTypeUri);
     839
     840    if (typeName)
     841    {
     842        fTypeName = XMLString::replicate(typeName, fMemoryManager);
     843
     844        int index = XMLString::indexOf(fTypeName, chComma);
     845        XMLSize_t length = XMLString::stringLen(fTypeName);
     846        fTypeLocalName = (XMLCh*) fMemoryManager->allocate((length - index + 1) * sizeof(XMLCh)); //new XMLCh[length - index + 1];
     847        XMLString::subString(fTypeLocalName, fTypeName, index + 1, length, fMemoryManager);
     848
     849        fTypeUri = (XMLCh*) fMemoryManager->allocate
     850        (
     851            (index + 1) * sizeof(XMLCh)
     852        ); //new XMLCh[index + 1];
     853        XMLString::subString(fTypeUri, fTypeName, 0, index, fMemoryManager);
     854    }
     855    else
     856    {
     857        fTypeName = fTypeLocalName = fTypeUri = 0;
     858    }
     859}
     860
    823861/***
    824862 * Support for Serialization/De-serialization
Note: See TracChangeset for help on using the changeset viewer.