diff --git a/apps/trimeshinfo/XMLTree.h b/apps/trimeshinfo/XMLTree.h index 2bb0803d..afb7ddac 100644 --- a/apps/trimeshinfo/XMLTree.h +++ b/apps/trimeshinfo/XMLTree.h @@ -131,10 +131,7 @@ void XMLTree::initializeMain() void XMLTree::finalizeMain() { - - addSlots(&sn); - OwnSlotsNode* ossn = new OwnSlotsNode; ossn->addOwnSlot(&ng); @@ -167,8 +164,6 @@ void XMLTree::addSlots(SlotNode* sn) sn0->addSlot(sn); root.Sons.push_back(sn0); - - } void XMLTree::addClasses(ClassNode* cn) @@ -186,24 +181,23 @@ void XMLTree::addNode(const char* s, int value_type, const char* name) EntryNode* en = new EntryNode; OwnSlotNode* osn = new OwnSlotNode; - - - switch(value_type) { -case VALUE_INTEGER: - en->type = "Integer"; - break; -case VALUE_FLOAT: - en->type = "Float"; - -case VALUE_BOOL: - en->type = "Bool"; - break; -case VALUE_STRING: - en->type = "String"; - break; + case VALUE_INTEGER: + en->type = "Integer"; + break; + case VALUE_FLOAT: + en->type = "Float"; + break; + + case VALUE_BOOL: + en->type = "Bool"; + break; + + case VALUE_STRING: + en->type = "String"; + break; } @@ -245,6 +239,7 @@ void XMLTree::printXMLTree() InstancesNode* isn; InstanceNode* in; int nn = 0; + for(it = root.Sons.begin(); it!=root.Sons.end(); ++it) { if (verbose) @@ -255,8 +250,10 @@ void XMLTree::printXMLTree() switch((*it)->qualifyNode()) { + + // MAIN NODE case MAIN_NODE: - mn = (MainNode*)(*it); + mn = dynamic_cast(*it); fprintf(fp,"<"); for(lit = mn->headers.begin(); lit!= mn->headers.end(); ++lit) fprintf(fp,"%s%s", lit->first,lit->second ); @@ -264,86 +261,91 @@ void XMLTree::printXMLTree() break; + // SLOTS case SLOTS_NODE: - sns = (SlotsNode*)(*it); - fprintf(fp," \n"); + sns = dynamic_cast(*it); + fprintf(fp,"\t\n"); for(it2 = sns->slot.Sons.begin(); it2!=sns->slot.Sons.end(); ++it2) { - sn = (SlotNode*) (*it2); - fprintf(fp,"\t"); + sn = dynamic_cast(*it2); + fprintf(fp,"\t\t\n"); for(it3 = sn->own_slot.Sons.begin(); it3!=sn->own_slot.Sons.end(); ++it3) { - osn = (OwnSlotNode*) (*it3); - fprintf(fp,"\n",osn->name); - fprintf(fp,"\t\t\n",osn->entry.type); - fprintf(fp,"\t\t\t\n"); - fprintf(fp,"\t\t\t%s\n",osn->entry.value.value); - fprintf(fp,"\t\t\t\n"); - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t"); - } - fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - - break; - case CLASSES_NODE: - csn = (ClassesNode*)(*it); - fprintf(fp," \n"); - - for(it2 = csn->classn.Sons.begin(); it2!=csn->classn.Sons.end(); ++it2) - { - cn = (ClassNode*) (*it2); - fprintf(fp,"\t"); - fprintf(fp,"\n"); - for(it3 = cn->own_slots.own_slot.Sons.begin(); it3!=cn->own_slots.own_slot.Sons.end(); ++it3) - { - osn = (OwnSlotNode*) (*it3); - fprintf(fp,"\t\t\n",osn->name); - fprintf(fp,"\t\t\t\n",osn->entry.type); - fprintf(fp,"\t\t\t\t\n"); - fprintf(fp,"\t\t\t%s\n",osn->entry.value.value); - fprintf(fp,"\t\t\t\t\n"); - fprintf(fp,"\t\t\t\n"); - fprintf(fp,"\t\t\n"); - } - fprintf(fp,"\t\n"); - fprintf(fp,"\n"); - } - fprintf(fp,"\n"); - - break; - case INSTANCES_NODE: - isn = (InstancesNode*)(*it); - fprintf(fp," \n"); - - for(it2 = isn->instances.Sons.begin(); it2!=isn->instances.Sons.end(); ++it2) - { - in = (InstanceNode*) (*it2); - fprintf(fp,"\t\n"); - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t\t%s\n", in->id); - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t\t%s\n", in->type); - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t\t\n"); - for(it3 = in->own_slots.own_slot.Sons.begin(); it3!=in->own_slots.own_slot.Sons.end(); ++it3) - { - osn = (OwnSlotNode*) (*it3); + osn = dynamic_cast(*it3); fprintf(fp,"\t\t\t\n",osn->name); fprintf(fp,"\t\t\t\t\n",osn->entry.type); - fprintf(fp,"\t\t\t\t\n"); - fprintf(fp,"\t\t\t\t%s\n",osn->entry.value.value); - fprintf(fp,"\t\t\t\t\n"); + fprintf(fp,"\t\t\t\t\t%s", osn->entry.value.value); + fprintf(fp,"\n"); fprintf(fp,"\t\t\t\t\n"); fprintf(fp,"\t\t\t\n"); } - fprintf(fp,"\t\t\n"); - fprintf(fp,"\t\n"); + fprintf(fp,"\t\t\n"); } - fprintf(fp,"\n"); + fprintf(fp,"\t\n"); + + break; + + // CLASSES + case CLASSES_NODE: + csn = dynamic_cast(*it); + fprintf(fp,"\t\n"); + + for(it2 = csn->classn.Sons.begin(); it2!=csn->classn.Sons.end(); ++it2) + { + cn = dynamic_cast(*it2); + fprintf(fp,"\t\t\n"); + fprintf(fp,"\t\t\t\n"); + for(it3 = cn->own_slots.own_slot.Sons.begin(); + it3!=cn->own_slots.own_slot.Sons.end(); ++it3) + { + osn = dynamic_cast(*it3); + fprintf(fp,"\t\t\t\t\n",osn->name); + fprintf(fp,"\t\t\t\t\t\n",osn->entry.type); + fprintf(fp,"\t\t\t\t\t\t%s", osn->entry.value.value); + fprintf(fp,"\n"); + fprintf(fp,"\t\t\t\t\t\n"); + fprintf(fp,"\t\t\t\t\n"); + } + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\n"); + } + fprintf(fp,"\t\n"); + + break; + + // INSTANCES + case INSTANCES_NODE: + isn = dynamic_cast(*it); + fprintf(fp,"\t\n"); + + for(it2 = isn->instances.Sons.begin(); it2!=isn->instances.Sons.end(); ++it2) + { + in = dynamic_cast(*it2); + fprintf(fp,"\t\t\n"); + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\t%s\n", in->id); + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\t%s\n", in->type); + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\t\n"); + + for(it3 = in->own_slots.own_slot.Sons.begin(); + it3!=in->own_slots.own_slot.Sons.end(); ++it3) + { + osn = dynamic_cast(*it3); + fprintf(fp,"\t\t\t\t\n",osn->name); + fprintf(fp,"\t\t\t\t\t\n",osn->entry.type); + fprintf(fp,"\t\t\t\t\t\t%s", osn->entry.value.value); + fprintf(fp,"\n"); + fprintf(fp,"\t\t\t\t\t\n"); + fprintf(fp,"\t\t\t\t\n"); + } + fprintf(fp,"\t\t\t\n"); + fprintf(fp,"\t\t\n"); + } + fprintf(fp,"\t\n"); break; }