source: XMLIO_V2/dev/dev_rv/context.hpp @ 93

Last change on this file since 93 was 91, checked in by hozdoba, 14 years ago

Corrections de plusieurs problÚmes.

File size: 3.1 KB
Line 
1#ifndef __CONTEXT__
2#define __CONTEXT__
3
4     
5namespace XMLIOSERVER
6{ 
7   class Context : public ObjectTemplate<Context>
8   {
9      public:
10           
11         Context(void) : ObjectTemplate<Context>()
12         {/* Ne rien faire de plus */}               
13         Context(const string& _id) : ObjectTemplate<Context>(_id)
14         {/* Ne rien faire de plus */}
15         
16         static void SetCurrentContext(const string& id)
17         {
18            // On modifie le context courrant pour tout les ObjectTemplate
19            FieldGroup::SetContext(id);
20            Field::SetContext(id);
21         }
22         
23         void parse (XMLNode& _node)
24         {
25            THashAttributes attributes;
26           
27            /// PARSING POUR GESTION DES ENFANTS
28            if (_node.getElementName().compare(string("context")))
29               WARNING("Le noeud est mal nommé mais sera traité comme un context !");
30           
31            if (!(_node.goToChildElement()))
32               WARNING("Le contexts ne contient pas d'enfant !"); 
33            else
34            {
35               //////////////////////////////////////
36              do { // Parcours des contexts pour traitement.       
37                           
38                  string name = _node.getElementName();
39                  attributes.clear();
40                  _node.getAttributes(attributes);   
41                 
42                  if (attributes.end() != attributes.find("id"))
43                  { WARNING("Le noeud de définition possÚde un identifiant, il ne sera pas pris en compte lors du traitement !"); }
44                 
45                  if (name.compare("field_definition") == 0)
46                  { // Parsing pour la définition des champs.
47                 
48                     if (FieldDefinition::HasObject("field_definition")) 
49                        WARNING("Le context possÚde déjà un noeud de définition de champs, le dernier défini complétera le premier !");
50                     
51                     fieldDef = (FieldDefinition*)&FieldDefinition::CreateObject("field_definition");
52                     fieldDef->parse(_node, true);
53                     continue;
54                  }                 
55                  // Traitement file, grid et axis à compléter.
56               } while (_node.goToNextElement());
57               //////////////////////////////////////
58               _node.goToParentElement(); // Retour au parent
59            }
60           
61            return;
62         }
63         
64         void registerAllAttributes(void)
65         { /* Ne rien faire de plus */ }
66         
67         virtual const char* getName(void) const {return ("Context"); }
68         
69         FieldDefinition* getFieldDefinition(void) { return (this->fieldDef); }
70                 
71         ~Context()
72         {/* Ne rien faire de plus pour le moment */ }
73         
74      protected:
75     
76      private:
77     
78         FieldDefinition*  fieldDef;
79         /*FileDefinition* fileDef;
80         AxisDefinition*   axisDef;
81         GridDefinition*   gridDef;*/
82
83     
84   }; //class Context
85}// namespace XMLIOSERVER
86
87#endif  // __CONTEXT__
Note: See TracBrowser for help on using the repository browser.