Changeset 105 for XMLIO_V2/dev/dev_rv


Ignore:
Timestamp:
06/08/10 15:43:19 (14 years ago)
Author:
hozdoba
Message:

Commit intermédiaire.
Ajout d'un systÚme d'indentation trÚs simplifié pour les flux de sortie.
Un problÚme corrigé - seg. fault en cas d'absence de field_definition dans un context donnée.

Location:
XMLIO_V2/dev/dev_rv/src/XMLIO
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp

    r104 r105  
    2424         friend ostream& operator<< (ostream& out, const Context& c)  
    2525         {  
    26             out << "<" << c.getName()<< " id=\"" <<  c.getId() << "\">"; 
    27             if(c.fieldDef != NULL) out << std::endl << *(FieldGroup*)c.fieldDef << std::endl; 
    28             out << "</" << c.getName()<< ">"; 
     26            out << IncIndent << "<" << c.getName()<< " id=\"" <<  c.getId() << "\">" << std::endl; 
     27            if(c.fieldDef != NULL) out << *(FieldGroup*)c.fieldDef << std::endl; 
     28            out << NIndent << "</" << c.getName()<< ">" << DecEndl; 
    2929            return (out); 
    3030         }  
     
    3333         { 
    3434            // Résolution des héritages descendants pour chacun des groupes de définitions. 
    35             fieldDef->resolveDescInheritance(); 
     35            if(fieldDef != NULL) fieldDef->resolveDescInheritance(); 
    3636         } 
    3737          
     
    9999                   
    100100         ~Context() 
    101          { delete fieldDef; }       
     101         { if(fieldDef != NULL) delete fieldDef; }       
    102102 
    103103       
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field.hpp

    r104 r105  
    1818         friend ostream& operator<< (ostream& out, const Field& c)  
    1919         { 
    20             out << "<" << c.getName(); 
     20            out << IncIndent << "<" << c.getName(); 
    2121            if(c.hasId()) out << " id=\"" <<  c.getId() << "\""; 
    2222            for(unsigned int i = 0; i < c.attrList.getVectorSize(); i++) out << *c.attrList.getVector()[i]; 
    23             out << "/>"; 
     23            out << "/>" << DecEndl; 
    2424                            
    2525            return (out); 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/field_group.hpp

    r104 r105  
    2626         } 
    2727                  
    28          const char* getName(void) const {return ("FieldGroup"); }   
     28         const char* getName(void) const {return ("Field_Group"); }   
    2929          
    3030         friend ostream& operator<< (ostream& out, const FieldGroup& c)  
    3131         {             
    32             out << "<" << c.getName(); 
     32            out << IncIndent << "<" << c.getName(); 
    3333            if(c.hasId()) out << " id=\"" <<  c.getId() << "\""; 
    3434            for(unsigned int i = 0; i < c.attrList.getVectorSize(); i++) out << *c.attrList.getVector()[i]; 
    3535            out << ">" << std::endl; 
     36             
    3637             
    3738            for(unsigned int i = 0; i < c.groupList.getVector().size() ; i++) 
     
    4142               out << *(c.childList.getVector()[i]) << std::endl; 
    4243                
    43             out << "</" << c.getName()<< ">"; 
     44            out << NIndent << "</" << c.getName()<< ">" << DecEndl; 
    4445            return (out); 
    4546         }  
  • XMLIO_V2/dev/dev_rv/src/XMLIO/main_cpp.cpp

    r104 r105  
    1111        try 
    1212        { 
    13       string file("/local/testsuite/iodef_test.xml"); 
     13      string file("/local/svn/dev_rv/test/iodef_test.xml"); 
    1414      ifstream istr( file.c_str() , ifstream::in ); 
    1515       
     
    3131 
    3232        } 
    33         catch(const XMLIOException &exc) 
     33        catch(const Exception &exc) 
    3434        {  // Pour tout type d'exceptions, on note les informations sur la sortie paramétrée. 
    3535                ERROR(exc.displayText());  
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio_logger.hpp

    r104 r105  
    5151   // Initialisation de la classe de Logging 
    5252   static ILogger LOGGER("xmlio.log"); 
     53    
     54static unsigned int Indent; 
     55 
     56std::ostream& NIndent(std::ostream& out) 
     57{ for(unsigned int i = 0; i < Indent; i++) out << "  "; return(out); } 
     58 
     59std::ostream& IncIndent(std::ostream& out) 
     60{ Indent++; return (NIndent(out)); } 
     61 
     62std::ostream& DecEndl(std::ostream& out) 
     63{ Indent--; return (NIndent(out)); } 
    5364 
    5465/************* POUR MEMOIRE ********************** 
  • XMLIO_V2/dev/dev_rv/src/XMLIO/xmlio_xml_parser.hpp

    r104 r105  
    6060            static void ShowTree(ostream& os = std::clog) 
    6161            { 
    62                clog <<  "<?xml version=\"1.0\"?>" << std::endl << "<Simulation>" << std::endl; 
     62               clog <<  "<?xml version=\"1.0\"?>" << std::endl; 
     63               clog <<  "<Simulation>" << std::endl; 
    6364               HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    6465                
Note: See TracChangeset for help on using the changeset viewer.