// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-/*
- *
- */
#include "Config_AttributeMessage.h"
Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, const void* theParent)
#include <string>
-/*
- * Class to pass an attribute's (widget's) entry info extracted from xml file.
+/*!
+ * \class Config_AttributeMessage
+ * \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
* <widget id="tool_object" concealment="true" obligatory="0"/>
*/
class Config_AttributeMessage : public Events_Message
struct _xmlDoc;
//<<
-/*
+/*!
* Returns true if theNode is XML ELEMENT node (not a "text" node ie).
*/
CONFIG_EXPORT bool isElementNode(xmlNodePtr theNode);
-/*
+/*!
* Returns true if theNode is XML node with a given name.
* Please note that this function should be called with NULL last argument.
*/
CONFIG_EXPORT bool isNode(xmlNodePtr theNode, const char* theNodeName, ...);
-/*
+/*!
* Checks is the given node is attribute (widget) node.
*/
CONFIG_EXPORT bool isWidgetNode(xmlNodePtr theNode);
-/*
+/*!
* Every xml node has child. Even if there is no explicit
* child nodes libxml gives the "Text node" as child.
*
*/
CONFIG_EXPORT bool hasChild(xmlNodePtr theNode);
-/*
+/*!
* Returns named property for an id node as std::string and the parameters of the node.
*/
CONFIG_EXPORT bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId,
*/
CONFIG_EXPORT std::string library(const std::string& theLibName);
-/*
+/*!
* Returns named property for a given node as std::string.
*/
CONFIG_EXPORT std::string getProperty(xmlNodePtr theNode, const char* thePropName);
-/*
+/*!
* Checks if the given XML node has the given attribute,
* if yes - returns it's bool value, if no, or if the value can not
* be converted to bool - returns theDefault value.
const char* theAttributeName,
bool theDefault);
-/*
+/*!
* Returns normalized (lower case) version of string.
* Should be used for case insensitive string matching.
*/
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-/*
- *
- */
#include "Config_FeatureMessage.h"
Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* theParent)
\r
#include <string>\r
\r
-/*\r
- * Class to pass a feature entry extracted from xml file.\r
+/*!\r
+ * \class Config_FeatureMessage\r
+ * \brief Class to pass a feature entry extracted from xml file.\r
* Example of the feature entry:\r
* <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>\r
*/\r
class Config_FeatureMessage;
+/*!
+ * \class Config_FeatureReader
+ * \brief Class to process feature's xml definition.
+ */
class Config_FeatureReader : public Config_XMLReader
{
public:
- Config_FeatureReader(const std::string& theXmlFile, const std::string& theLibraryName,
+ 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<std::string> features() const;
protected:
- void processNode(xmlNodePtr aNode);
- bool processChildren(xmlNodePtr aNode);
+ /// Overloaded method. Defines how to process each node
+ virtual void processNode(xmlNodePtr aNode);
+ /// Overloaded method. Defines if the given node should be parsed recursively
+ virtual bool processChildren(xmlNodePtr aNode);
+ /// Fills feature message
void fillFeature(xmlNodePtr theRoot,
const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
+ /// 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);
private:
return myFeaturesInFiles;
}
-/*
+/*!
* Get module name from plugins.xml
* (property "module")
*/
return getProperty(aRoot, PLUGINS_MODULE);
}
-/*
- *
- */
void Config_ModuleReader::processNode(xmlNodePtr theNode)
{
if (isNode(theNode, NODE_PLUGIN, NULL)) {
#include <set>
#include <string>
+/*!
+ * \class Config_ModuleReader
+ * \brief Class to process plugins.xml - definition of plugins (scripts, libraries).
+ */
class Config_ModuleReader : public Config_XMLReader
{
enum PluginType {
#include <Config_def.h>
#include <Events_Message.h>
-/*
- * A general class to pass pointers over the event loop.
+/*!
+ * \class Config_PointerMessage
+ * \brief A general class to pass pointers over the event loop.
*/
class CONFIG_EXPORT Config_PointerMessage : public Events_Message
{
#include <string>
#include <vector>
-//! Class wihich let to register properties
+//! Class which let to register properties
class Config_PropManager
{
public:
/// Event ID that Selection Filter is loaded (comes with Config_SelectionFilterMessage)
static const char * EVENT_SELFILTER_LOADED = "SelectionFilterLoaded";
+/*!
+ * \class Config_SelectionFilterMessage
+ * \brief Transmits info about selection filters on "SelectionFilterLoaded" event
+ */
class Config_SelectionFilterMessage : public Events_Message
{
std::string mySelectionFilterId;
/// Event ID that Validator is loaded (comes with Config_ValidatorMessage)
static const char * EVENT_VALIDATOR_LOADED = "ValidatorLoaded";
+/*!
+ * \class Config_ValidatorMessage
+ * \brief Transmits info about created validator on "ValidatorLoaded" event
+ */
class Config_ValidatorMessage : public Events_Message
{
std::string myValidatorId;
struct _xmlDoc;
//<<
+/*!
+ * \class Config_WidgetAPI
+ * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets
+ */
class CONFIG_EXPORT Config_WidgetAPI
{
public:
#include <map>
#include <string>
+/*!
+ * \class Config_WidgetReader
+ * \brief Class that dumps xml definitions of widgets for
+ * further processing in the WidgetFactory
+ */
class Config_WidgetReader : public Config_XMLReader
{
public:
- CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);CONFIG_EXPORT virtual ~Config_WidgetReader();
+ CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);
+ CONFIG_EXPORT virtual ~Config_WidgetReader();
- CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);CONFIG_EXPORT std::string featureDescription(
- const std::string& theFeatureName);
+ CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);
+ CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName);
protected:
void processNode(xmlNodePtr theNode);
xmlFreeDoc(myXmlDoc);
}
-/*
+/*!
* Read all nodes in associated xml file,
* recursively if processChildren(xmlNode) is true for the xmlNode.
* For each read node the processNode will be called.
readRecursively(aRoot);
}
-/*
+/*!
* Allows to customize reader's behavior for a node. Virtual.
* The default impl does nothing. (In debug mode prints
* some info)
}
}
-/*
+/*!
* Defines which nodes should be processed recursively. Virtual.
* The default impl is to read all nodes.
*/
return true;
}
-/*
- *
+/*!
+ * Returns xmlNodePtr to the root of reader's document
+ * or NULL if not found
*/
xmlNodePtr Config_XMLReader::findRoot()
{
return aRoot;
}
-/*
+/*!
* Calls processNode() for each child (for some - recursively)
* of the given node.
* \sa ReadAll()
}
}
-/*
+/*!
* void* -> xmlNodePtr
*/
xmlNodePtr Config_XMLReader::node(void* theNode)
return static_cast<xmlNodePtr>(theNode);
}
+/*!
+ * Gets xml node name
+ */
std::string Config_XMLReader::getNodeName(xmlNodePtr theNode)
{
std::string result = "";
return result;
}
+/*!
+ * Retrieves all the necessary info from the validator node.
+ * Sends ValidatorLoaded event
+ */
void Config_XMLReader::processValidator(xmlNodePtr theNode)
{
Events_ID aValidatoEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
aEvLoop->send(aMessage);
}
+/*!
+ * Retrieves all the necessary info from the SelectionFilter node.
+ * Sends SelectionFilterLoaded event
+ */
void Config_XMLReader::processSelectionFilter(xmlNodePtr theNode)
{
Events_ID aFilterEvent = Events_Loop::eventByName(EVENT_SELFILTER_LOADED);
struct _xmlDoc;
//<<
-/*
- * Base class for all libxml readers. Provides high-level API
+/*!
+ * \class Config_XMLReader
+ * \brief Base class for all libxml readers. Provides high-level API
* for all xml operations.
- *
- */
+*/
class Config_XMLReader
{
public:
- CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);CONFIG_EXPORT virtual ~Config_XMLReader();
+ CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);
+ CONFIG_EXPORT virtual ~Config_XMLReader();
CONFIG_EXPORT void readAll();