X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_FeatureReader.h;h=75eb376e5cdd88ba8a6249a863e522e7ec1c3163;hb=257a9c9ed768fca5dfd54adf466549e8dd1ea82d;hp=bbc25ba274d94b3f9f3725df57ffcb799bf97090;hpb=e607e2c793a83dc30d483e1819f44c3497a08555;p=modules%2Fshaper.git diff --git a/src/Config/Config_FeatureReader.h b/src/Config/Config_FeatureReader.h index bbc25ba27..75eb376e5 100644 --- a/src/Config/Config_FeatureReader.h +++ b/src/Config/Config_FeatureReader.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * Config_FeatureReader.h * @@ -8,27 +10,67 @@ #ifndef CONFIG_FEATUREREADER_H_ #define CONFIG_FEATUREREADER_H_ +#include #include +#include + +#include +#include +#include -class CONFIG_EXPORT Config_FeatureReader: public Config_XMLReader +class Config_FeatureMessage; + +/*! + * \class Config_FeatureReader + * \ingroup Config + * \brief Class to process feature's xml definition. + */ +class Config_FeatureReader : public Config_XMLReader { -public: - Config_FeatureReader(const std::string& theXmlFile); + public: + /// Constructor + Config_FeatureReader(const std::string& theXmlFile, + const std::string& theLibraryName, + const char* theEventGenerated = 0); virtual ~Config_FeatureReader(); + /// Returns list of all features defined in reader's file + std::list features() const; + + protected: + /// Overloaded method. Defines how to process each node + virtual void processNode(xmlNodePtr aNode); + + /// Overloaded method. Clears attribute cache on extit from attribute's node + virtual void cleanup(xmlNodePtr aNode); + + /// Overloaded method. Defines if the given node should be parsed recursively + virtual bool processChildren(xmlNodePtr aNode); - std::string featureWidgetCfg(std::string theFeatureName); + /// Fills feature message + void fillFeature(xmlNodePtr theRoot, + const std::shared_ptr& outFeatureMessage); -protected: - void processNode(xmlNodePtr aNode); - bool processChildren(xmlNodePtr aNode); + /// Stores an attribute in internal map for later use. + /// Key is "Node_Name:Node_Attribute" and value is getProperty(theNodeAttribute) + void storeAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + /// Restores an attribute from internal map. + std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + /// Restores an attribute from internal map. + std::string restoreAttribute(const char* theNodeName, const char* theNodeAttribute); - void fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFeatureMessage); + bool cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + bool cleanupAttribute(const char* theNodeName, const char* theNodeAttribute); - std::string m_lastWorkbench; - std::string m_lastGroup; + private: + /// A map to store all parent's attributes. + /// The key has from "Node_Name:Node_Attribute" + std::map myParentAttributes; + std::string myLibraryName; - bool m_fetchWidgetCfg; - std::string m_widgetCfg; + std::list myFeatures; + /// event generated on feature data sending, by default it is Config_FeatureMessage::GUI_EVENT() + const char* myEventGenerated; + bool myIsProcessWidgets; }; #endif /* CONFIG_FEATUREREADER_H_ */