Beispiel #1
0
void processParticle(XSParticle *xsParticle)
{
    if (!xsParticle) {
        XERCES_STD_QUALIFIER cout << "xsParticle is NULL"; 
        return;
    }
    XSParticle::TERM_TYPE termType = xsParticle->getTermType();
    if (termType == XSParticle::TERM_ELEMENT) {
        XSElementDeclaration *xsElement = xsParticle->getElementTerm();
        XERCES_STD_QUALIFIER cout << StrX(xsElement->getName());
    } else if (termType == XSParticle::TERM_MODELGROUP) {
        XERCES_STD_QUALIFIER cout << "(";
        
        XSModelGroup *xsModelGroup = xsParticle->getModelGroupTerm();
        XSModelGroup::COMPOSITOR_TYPE compositorType = xsModelGroup->getCompositor();
        XSParticleList *xsParticleList = xsModelGroup->getParticles();
        for (unsigned i = 0; i < xsParticleList->size()-1; i++) {
            processParticle(xsParticleList->elementAt(i));
            printCompositorTypeConnector(compositorType);
        }
        processParticle(xsParticleList->elementAt(xsParticleList->size()-1));
        
        XERCES_STD_QUALIFIER cout << ")";
    } else if (termType == XSParticle::TERM_WILDCARD) {
        XERCES_STD_QUALIFIER cout << "* (wildcard)";
    }
}
/**
 * \brief Handles a group of XSParticles.
 *
 * \param xsModelGroup The XSModelGroup to handle.
 */
void TypeDefinition::processParticles(XSModelGroup& xsModelGroup)
{
     // Should we care about gropus contra sequences?
//      switch (xsModelGroup.getCompositor()) {
//      case XSModelGroup::COMPOSITOR_SEQUENCE:
//           break;
//      case XSModelGroup::COMPOSITOR_CHOICE:
//           break;
//      case XSModelGroup::COMPOSITOR_ALL:
//           break;
//      }    

     XSParticleList* xsParticleList = xsModelGroup.getParticles();
     for (unsigned i = 0; i < xsParticleList->size(); i++) {
          processParticle(*xsParticleList->elementAt(i));
     }
}