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,
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);
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 //! Returns color by given section and name as 3-element vector {r,g,b}.
53 CONFIG_EXPORT static std::vector<int> color(const std::string& theSection,
54 const std::string& theName);
55 //! Returns integer by given section and name
56 CONFIG_EXPORT static int integer(const std::string& theSection,
57 const std::string& theName);
58 //! Returns real by given section and name
59 CONFIG_EXPORT static double real(const std::string& theSection,
60 const std::string& theName);
61 //! Returns boolean by given section and name
62 CONFIG_EXPORT static bool boolean(const std::string& theSection,
63 const std::string& theName);
66 CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties