X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_PropManager.h;h=00dd75b738ef4162cd9c7ed09df20f9b1e9c34e1;hb=2e60d80d7d0b998fded953311cc8d2931ef5bb4b;hp=d650b0e387c6b54dfeacde5d01b2828d5b4a1cae;hpb=1b587c92a6855e2bd217a65bb0295d0fd720e77d;p=modules%2Fshaper.git diff --git a/src/Config/Config_PropManager.h b/src/Config/Config_PropManager.h index d650b0e38..00dd75b73 100644 --- a/src/Config/Config_PropManager.h +++ b/src/Config/Config_PropManager.h @@ -1,6 +1,22 @@ -// File: Config_PropManager.h -// Created: 13 Aug 2014 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef Config_PropManager_H #define Config_PropManager_H @@ -12,54 +28,70 @@ #include #include -//! Class wihich let to register properties -class CONFIG_EXPORT Config_PropManager +/** + * \class Config_PropManager + * \ingroup Config + * \brief Class which let to register properties + */ +class Config_PropManager { -public: + public: /** - * Registers property parameters - * \param theOwnerId - name of owner (name of plugin for example) - * \param theSection - name of section (domain of using) of the property. - * \param theName - name (title) of the value. - * \param theType - type of the value. - * \param theValue - initial value of the property - * Returns True if the property succesfully registered - */ - static bool registerProp(const std::string& theSection, - const std::string& theName, - const std::string& theTitle, - Config_Prop::PropType theType, - const std::string& theValue); + * Registers property parameters + * \param theSection - name of section (domain of using) of the property. + * \param theName - name (title) of the value. + * \param theTitle - title of the value. + * \param theType - type of the value. + * \param theDefValue - default and initial value of the property + * \param theMin - minimal value + * \param theMax - minimal value + * Returns True if the property succesfully registered + */ + CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, + const std::string& theName, + const std::string& theTitle, Config_Prop::PropType theType, + const std::string& theDefValue = "", + const std::string& theMin = "", + const std::string& theMax = ""); - static Config_Prop* findProp(const std::string& theSection, - const std::string& theName); + //! Finds property in the given section by the given name, if property not found returns NULL + CONFIG_EXPORT static Config_Prop* findProp( + const std::string& theSection, const std::string& theName); - static Config_Properties getProperties(); + //! Returns std::list of all existing properies + CONFIG_EXPORT static Config_Properties getProperties(); //! Returns list of registered section names. - static std::list getSections(); + CONFIG_EXPORT static std::list getSections(); //! Returns list of properties by its owner and section. - static Config_Properties getProperties(const std::string& theSection); + CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection); //! Returns value of the property by its owner, section, and name - static std::string string(const std::string& theSection, - const std::string& theName, - const std::string& theDefault); - static std::vector color(const std::string& theSection, - const std::string& theName, - const std::string& theDefault); - static int integer(const std::string& theSection, - const std::string& theName, - const std::string& theDefault); - static double real(const std::string& theSection, - const std::string& theName, - const std::string& theDefault); + CONFIG_EXPORT static std::string string(const std::string& theSection, + const std::string& theName); + //! Returns color by given section and name as 3-element vector {r,g,b}. + CONFIG_EXPORT static std::vector color(const std::string& theSection, + const std::string& theName); + //! Returns integer by given section and name + CONFIG_EXPORT static int integer(const std::string& theSection, + const std::string& theName); + //! Returns real by given section and name + CONFIG_EXPORT static double real(const std::string& theSection, + const std::string& theName); + //! Returns boolean by given section and name + CONFIG_EXPORT static bool boolean(const std::string& theSection, + const std::string& theName); -private: - static Config_Properties myProps; -}; + //! Returns convertion of the string to double value. Temporary changes locale to process + //! values contained "," or "." separator. + //! \param theDouble a value to be converted + //! \return double result or zero + CONFIG_EXPORT static double stringToDouble(const std::string& theDouble); + private: + CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties +}; -#endif \ No newline at end of file +#endif