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