#ifndef __CFILE__ #define __CFILE__ using XMLIOSERVER::XML::XMLNode; using XMLIOSERVER::XML::THashAttributes; namespace XMLIOSERVER { class CFile : public ObjectTemplate, public FileAttribut { public: CFile(void) : ObjectTemplate(), FileAttribut(), vfieldGroup(NULL) {/* Ne rien faire de plus */} CFile(const string& _id) : ObjectTemplate(_id), FileAttribut(), vfieldGroup(NULL) {/* Ne rien faire de plus */} static string GetName(void) { return ("file"); } void parse (XMLNode& _node) { string name = _node.getElementName(); THashAttributes attributes; /// PARSING GESTION DES ATTRIBUTS /// _node.getAttributes(attributes); this->setAttributes(attributes); attributes.clear(); /// PARSING POUR GESION DES ENFANTS /// if (_node.goToChildElement() and hasId()) { // Si la définition du fichier intégre des champs et si le fichier est identifié. _node.goToParentElement(); vfieldGroup = CreateInstanceAndParse(attributes, _node, getId().c_str(), false ); } } void getAllFields(std::vector& _allF) const { if (vfieldGroup!=NULL) vfieldGroup->getAllChildren(_allF); } virtual bool hasChild(void) const { return (vfieldGroup != NULL); } virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } /*{ // Sortie sans affichage des groupes. std::vector allF; getAllFields(allF); for (unsigned int i = 0; i < allF.size(); i++) out << *(allF[i]) << std::endl; }*/ virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } void resolveFieldRefInheritance(void) { // Résolution des héritages par référence de chacun des champs contenus dans le fichier. std::vector allF; getAllFields(allF); for (unsigned int i = 0; i < allF.size(); i++) allF[i]->resolveRefInheritance(); } FieldGroup* getVirtualFieldGroup(void) { return (vfieldGroup); } ~CFile(void) { if(vfieldGroup != NULL) delete vfieldGroup; } private : FieldGroup* vfieldGroup; // FieldGroup "virtuel" }; // class CFile }; // namespace XMLIOSERVER #endif // __CFILE__