X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetAPI.h;h=2c2cd9c7165015879a397dc73dceac73e74aa717;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=c98888f12339d66b223378151118d86268d4e099;hpb=cf6ecce56482c1e15c6381d76b553004f87d3dd3;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index c98888f12..2c2cd9c71 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * Config_WidgetAPI.h * @@ -8,7 +10,7 @@ #ifndef CONFIG_WIDGETAPI_H_ #define CONFIG_WIDGETAPI_H_ -#include +#include #include #include @@ -25,32 +27,48 @@ typedef xmlDoc *xmlDocPtr; struct _xmlDoc; //<< - +/*! + * \class Config_WidgetAPI + * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets + */ class CONFIG_EXPORT Config_WidgetAPI { -public: - Config_WidgetAPI(std::string theRawXml); + public: virtual ~Config_WidgetAPI(); - void reset(); - bool nextWidget(); + std::string widgetType() const; + bool isContainerWidget() const; + bool isPagedWidget() const; + + std::string widgetId() const; + std::string widgetIcon() const; + std::string widgetLabel() const; + std::string widgetTooltip() const; - std::string widgetType(); + std::string getProperty(const char* thePropName) const; - std::string widgetId(); - std::string widgetIcon(); - std::string widgetLabel(); - std::string widgetTooltip(); + /// Checks if the XML representation of widget has given attribute, + /// if yes - returns it's bool value, if no, or if the value can not + /// be converted to bool - returns theDefault. + /// \param theAttributeName attribute to check + /// \param theDefault default value on bad data + /// \return the boolean result + bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const; - std::string getProperty(const char* thePropName); + bool isComputedDefault() const; -protected: - bool isNode(xmlNodePtr theNode, const char* name, ...); + protected: + /// These fields are accessible for ModuleBase_WidgetFactory only + Config_WidgetAPI(std::string theRawXml); + bool toNextWidget(); + bool toChildWidget(); + bool toParentWidget(); -private: + private: xmlDocPtr myDoc; xmlNodePtr myCurrentNode; + friend class ModuleBase_WidgetFactory; }; #endif /* CONFIG_WIDGETAPI_H_ */