1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Config_PropManager.h
4 // Created: 13 Aug 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef Config_PropManager_H
8 #define Config_PropManager_H
10 #include "Config_def.h"
11 #include "Config_Prop.h"
18 * \class Config_PropManager
20 * \brief Class which let to register properties
22 class Config_PropManager
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
35 CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, const std::string& theName,
36 const std::string& theTitle, Config_Prop::PropType theType, const std::string& theDefValue = "");
37 //! Finds property in the given section by the given name, if property not found returns NULL
38 CONFIG_EXPORT static Config_Prop* findProp(
39 const std::string& theSection, const std::string& theName);
40 //! Returns std::list of all existing properies
41 CONFIG_EXPORT static Config_Properties getProperties();
42 //! Returns list of registered section names.
43 CONFIG_EXPORT static std::list<std::string> getSections();
44 //! Returns list of properties by its owner and section.
45 CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
47 //! Returns value of the property by its owner, section, and name
48 CONFIG_EXPORT static std::string string(const std::string& theSection,
49 const std::string& theName,
50 const std::string& theDefault);
51 //! Returns color by given section and name as 3-element vector {r,g,b}.
52 CONFIG_EXPORT static std::vector<int> color(const std::string& theSection,
53 const std::string& theName,
54 const std::string& theDefault);
55 //! Returns integer by given section and name
56 CONFIG_EXPORT static int integer(const std::string& theSection,
57 const std::string& theName,
58 const std::string& theDefault);
59 //! Returns real by given section and name
60 CONFIG_EXPORT static double real(const std::string& theSection,
61 const std::string& theName,
62 const std::string& theDefault);
63 //! Returns boolean by given section and name
64 CONFIG_EXPORT static bool boolean(const std::string& theSection,
65 const std::string& theName,
66 const std::string& theDefault);
69 CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties