void XMLParser::buildTypeSystemDesc()

in src/framework/taespecifierbuilder.cpp [929:987]


  void XMLParser::buildTypeSystemDesc(TypeSystemDescription & typeSystemDesc, DOMElement * descElem) {
    assert(EXISTS(descElem));
    assert( XMLString::compareString(descElem->getNodeName(), convert(TAG_TYPE_SYSTEM_DESC)) == 0);
    DOMNodeList * children = descElem->getChildNodes();
    assert( EXISTS(children) );
    //assert( children->getLength() == 1); //currently, there's only the 'types' element

    ///TypeSystemDescription * typeSystemDesc = new TypeSystemDescription();

    size_t j;
    for (j=0; j < children->getLength(); j++) {
      if ((children->item(j))->getNodeType() != DOMNode::ELEMENT_NODE) {
        continue;
      }
      DOMElement * child = (DOMElement *) children->item(j);
      const icu::UnicodeString & childTag = convert(child->getNodeName());
      if (childTag.compare(TAG_TYPES) == 0) {
        DOMNodeList * typeDescs = (children->item(j))->getChildNodes();
        if (EXISTS(typeDescs)) {
          size_t i;
          for (i=0; i < typeDescs->getLength(); i++) {
            if ((typeDescs->item(i))->getNodeType() != DOMNode::ELEMENT_NODE) {
              continue;
            }
            bool takesMemoryOwnerShip;
            unique_ptr<TypeDescription> desc( buildTypeDesc((DOMElement *) typeDescs->item(i)) );
            typeSystemDesc.addTypeDescription(desc.get(), takesMemoryOwnerShip);
            if (takesMemoryOwnerShip) {
              desc.release();
            }
          }
        }
      } else if (childTag.compare(TAG_IMPORT_DESC) == 0) {
        bool takesMemoryOwnerShip;
        unique_ptr<ImportDescription> desc( buildImportDesc((DOMElement *) children->item(j)) );
        typeSystemDesc.addImportDescription(desc.get(), takesMemoryOwnerShip);
        if (takesMemoryOwnerShip) {
          desc.release();
        }
      } else if (childTag.compare(TAG_IMPORTS) == 0) {
        DOMNodeList * importDescs = (children->item(j))->getChildNodes();
        if (EXISTS(importDescs)) {
          size_t i;
          for (i=0; i < importDescs->getLength(); i++) {
            if ((importDescs->item(i))->getNodeType() != DOMNode::ELEMENT_NODE) {
              continue;
            }
            bool takesMemoryOwnerShip;
            unique_ptr<ImportDescription> desc( buildImportDesc((DOMElement *) importDescs->item(i)) );
            typeSystemDesc.addImportDescription(desc.get(), takesMemoryOwnerShip);
            if (takesMemoryOwnerShip) {
              desc.release();
            }
          }
        }
      }
    }
    return;
  }