Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / Config / Config_PropManager.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Config_PropManager.h
4 // Created:     13 Aug 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef Config_PropManager_H
8 #define Config_PropManager_H
9
10 #include "Config_def.h"
11 #include "Config_Prop.h"
12
13 #include <map>
14 #include <string>
15 #include <vector>
16
17 /**
18  * \class Config_PropManager
19  * \ingroup Config
20  * \brief Class which let to register properties
21  */
22 class Config_PropManager
23 {
24  public:
25
26   /** 
27    * Registers property parameters
28    * \param theSection - name of section (domain of using) of the property.
29    * \param theName - name (title) of the value.
30    * \param theTitle - title of the value.
31    * \param theType - type of the value.
32    * \param theDefValue - default and initial value of the property
33    * Returns True if the property succesfully registered
34    */
35   CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection,
36     const std::string& theName,
37     const std::string& theTitle, Config_Prop::PropType theType,
38     const std::string& theDefValue = "");
39   //! Finds property in the given section by the given name, if property not found returns NULL
40   CONFIG_EXPORT static Config_Prop* findProp(
41     const std::string& theSection, const std::string& theName);
42   //! Returns std::list of all existing properies
43   CONFIG_EXPORT static Config_Properties getProperties();
44   //! Returns list of registered section names.
45   CONFIG_EXPORT static std::list<std::string> getSections();
46   //! Returns list of properties by its owner and section.
47   CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
48
49   //! Returns value of the property by its owner, section, and name
50   CONFIG_EXPORT static std::string string(const std::string& theSection,
51                                           const std::string& theName,
52                                           const std::string& theDefault);
53   //! Returns color by given section and name as 3-element vector {r,g,b}.
54   CONFIG_EXPORT static std::vector<int> color(const std::string& theSection,
55                                               const std::string& theName,
56                                               const std::string& theDefault);
57   //! Returns integer by given section and name
58   CONFIG_EXPORT static int integer(const std::string& theSection,
59                                    const std::string& theName,
60                                    const std::string& theDefault);
61   //! Returns real by given section and name
62   CONFIG_EXPORT static double real(const std::string& theSection,
63                                    const std::string& theName,
64                                    const std::string& theDefault);
65   //! Returns boolean by given section and name
66   CONFIG_EXPORT static bool boolean(const std::string& theSection,
67                                    const std::string& theName,
68                                    const std::string& theDefault);
69
70  private:
71   CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties
72 };
73
74 #endif