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"
17 //! Class which let to register properties
18 class Config_PropManager
23 * Registers property parameters
24 * \param theSection - name of section (domain of using) of the property.
25 * \param theName - name (title) of the value.
26 * \param theType - type of the value.
27 * \param theDefValue - default and initial value of the property
28 * Returns True if the property succesfully registered
30 CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, const std::string& theName,
31 const std::string& theTitle, Config_Prop::PropType theType, const std::string& theDefValue = "");
32 //! Finds property in the given section by the given name, if property not found returns NULL
33 CONFIG_EXPORT static Config_Prop* findProp(
34 const std::string& theSection, const std::string& theName);
35 //! Returns std::list of all existing properies
36 CONFIG_EXPORT static Config_Properties getProperties();
37 //! Returns list of registered section names.
38 CONFIG_EXPORT static std::list<std::string> getSections();
39 //! Returns list of properties by its owner and section.
40 CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
42 //! Returns value of the property by its owner, section, and name
43 CONFIG_EXPORT static std::string string(const std::string& theSection,
44 const std::string& theName,
45 const std::string& theDefault);
46 //! Returns color by given section and name as 3-element vector {r,g,b}.
47 CONFIG_EXPORT static std::vector<int> color(const std::string& theSection,
48 const std::string& theName,
49 const std::string& theDefault);
50 //! Returns integer by given section and name
51 CONFIG_EXPORT static int integer(const std::string& theSection,
52 const std::string& theName,
53 const std::string& theDefault);
54 //! Returns real by given section and name
55 CONFIG_EXPORT static double real(const std::string& theSection,
56 const std::string& theName,
57 const std::string& theDefault);
60 CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties