Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[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 //! Class wihich let to register properties
18 class Config_PropManager
19 {
20  public:
21
22   /** 
23    * Registers property parameters
24    * \param theOwnerId - name of owner (name of plugin for example)
25    * \param theSection - name of section (domain of using) of the property.
26    * \param theName - name (title) of the value.
27    * \param theType - type of the value.
28    * \param theDefValue - default and initial value of the property
29    * Returns True if the property succesfully registered
30    */
31   CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, const std::string& theName,
32     const std::string& theTitle, Config_Prop::PropType theType, const std::string& theDefValue = "");
33
34   CONFIG_EXPORT static Config_Prop* findProp(
35     const std::string& theSection, const std::string& theName);
36
37   CONFIG_EXPORT static Config_Properties getProperties();
38
39   //! Returns list of registered section names.
40   CONFIG_EXPORT static std::list<std::string> getSections();
41
42   //! Returns list of properties by its owner and section.
43   CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
44
45   //! Returns value of the property by its owner, section, and name
46   CONFIG_EXPORT static std::string string(
47     const std::string& theSection, const std::string& theName, const std::string& theDefault);
48   
49   CONFIG_EXPORT static std::vector<int> color(
50     const std::string& theSection, const std::string& theName, const std::string& theDefault);
51   
52   CONFIG_EXPORT static int integer(
53     const std::string& theSection, const std::string& theName, const std::string& theDefault);
54   
55   CONFIG_EXPORT static double real(
56     const std::string& theSection, const std::string& theName, const std::string& theDefault);
57
58  private:
59   CONFIG_EXPORT static Config_Properties myProps;
60 };
61
62 #endif