Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / Config / Config_PropManager.h
1 // File:        Config_PropManager.h
2 // Created:     13 Aug 2014
3 // Author:      Vitaly SMETANNIKOV
4
5 #ifndef Config_PropManager_H
6 #define Config_PropManager_H
7
8 #include "Config_def.h"
9 #include "Config_Prop.h"
10
11 #include <map>
12 #include <string>
13 #include <vector>
14
15 //! Class wihich let to register properties
16 class CONFIG_EXPORT Config_PropManager
17 {
18 public:
19
20   /** 
21   * Registers property parameters
22   * \param theOwnerId - name of owner (name of plugin for example)
23   * \param theSection - name of section (domain of using) of the property.
24   * \param theName - name (title) of the value.
25   * \param theType - type of the value.
26   * \param theValue - initial value of the property
27   * Returns True if the property succesfully registered
28   */
29   static bool registerProp(const std::string& theOwnerId, 
30                            const std::string& theSection,
31                            const std::string& theName,
32                            const std::string& theTitle,
33                            Config_Prop::PropType theType,
34                            const std::string& theValue);
35
36   //! Returns list of registered owners.
37   static std::list<std::string> getOwners();
38
39   //! Returns list of properties by its owner.
40   static Config_Properties getProperties(const std::string& theOwnerId);
41
42   //! Returns list of registered section names.
43   static std::list<std::string> getSections(const std::string& theOwnerId);
44
45   //! Returns list of properties by its owner and section.
46   static Config_Properties getProperties(const std::string& theOwnerId, const std::string& theSection);
47
48   //! Returns value of the property by its owner, section, and name
49   static std::string value(const std::string& theOwnerId, 
50                            const std::string& theSection, 
51                            const std::string& theName,
52                            const std::string& theDefault);              
53
54 private:
55
56   /** 
57   * Registers property parameters
58   * \param theOwnerId - name of owner (name of plugin for example)
59   * \param theProp - the Property object.
60   * Returns True if the property succesfully registered
61   */
62   static bool registerProp(const std::string& theOwnerId, 
63                            Config_Prop* theProp);
64
65   static std::map<std::string, Config_Properties> myPropMap;
66 };
67
68
69 CONFIG_EXPORT std::vector<int> stringToRGB(const std::string& theColor);
70
71 #endif