1 | #ifndef __CFILE__ |
---|
2 | #define __CFILE__ |
---|
3 | |
---|
4 | using XMLIOSERVER::XML::XMLNode; |
---|
5 | using XMLIOSERVER::XML::THashAttributes; |
---|
6 | |
---|
7 | namespace XMLIOSERVER |
---|
8 | { |
---|
9 | class CFile : public ObjectTemplate<CFile>, public FileAttribut |
---|
10 | { |
---|
11 | public: |
---|
12 | |
---|
13 | CFile(void) : ObjectTemplate<CFile>(), FileAttribut(), vfieldGroup(NULL) |
---|
14 | {/* Ne rien faire de plus */} |
---|
15 | CFile(const string& _id) : ObjectTemplate<CFile>(_id), FileAttribut(), vfieldGroup(NULL) |
---|
16 | {/* Ne rien faire de plus */} |
---|
17 | |
---|
18 | static string GetName(void) { return ("file"); } |
---|
19 | |
---|
20 | void parse (XMLNode& _node) |
---|
21 | { |
---|
22 | string name = _node.getElementName(); |
---|
23 | THashAttributes attributes; |
---|
24 | |
---|
25 | /// PARSING GESTION DES ATTRIBUTS /// |
---|
26 | _node.getAttributes(attributes); |
---|
27 | this->setAttributes(attributes); |
---|
28 | attributes.clear(); |
---|
29 | |
---|
30 | /// PARSING POUR GESION DES ENFANTS /// |
---|
31 | if (_node.goToChildElement() and hasId()) |
---|
32 | { // Si la définition du fichier intégre des champs et si le fichier est identifié. |
---|
33 | _node.goToParentElement(); |
---|
34 | vfieldGroup = CreateInstanceAndParse<FieldGroup>(attributes, _node, getId().c_str(), false ); |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | virtual bool hasChild(void) const { return (vfieldGroup != NULL); } |
---|
39 | virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } |
---|
40 | virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) |
---|
41 | { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } |
---|
42 | |
---|
43 | FieldGroup* getVirtualFieldGroup(void) { return (vfieldGroup); } |
---|
44 | |
---|
45 | ~CFile(void) |
---|
46 | { if(vfieldGroup != NULL) delete vfieldGroup; } |
---|
47 | |
---|
48 | private : |
---|
49 | |
---|
50 | FieldGroup* vfieldGroup; // FieldGroup "virtuel" |
---|
51 | |
---|
52 | }; // class CFile |
---|
53 | |
---|
54 | }; // namespace XMLIOSERVER |
---|
55 | |
---|
56 | #endif // __CFILE__ |
---|