Mania++
 All Classes Functions Variables Pages
Config.h
1 #ifndef CONFIG_H_
2 #define CONFIG_H_
3 
4 #include <string>
5 #include <iostream>
6 
7 #include <yaml-cpp/yaml.h>
8 
9 //* ServerConfig
16 {
17  std::string address;
18  int port;
19  std::string username;
20  std::string password;
21 };
22 
23 //* DatabaseConfig
30 {
31  std::string address;
32  int port;
33  std::string username;
34  std::string password;
35  std::string database;
36 };
37 
38 //* ProgramConfig
45 {
46  bool checkVersion = true;
47 };
48 
49 //* PluginConfig
56 {
57  std::string name;
58  std::map<std::string, std::string> settings;
59 };
60 
61 //* Config
65 class Config
66 {
67 public:
73  Config(std::string configFile);
74 
78  ~Config();
79 
83  std::map<std::string, PluginConfig>* Plugins;
85 private:
89  void parseConfig();
90 
96  void parsePlugins(YAML::Node plugins);
97 
98  std::string configFile;
99 };
100 
101 #endif // CONFIG_H_
Config(std::string configFile)
Calls parseConfig to parse the configuration file.
Definition: Config.cpp:3
ProgramConfig * Program
Instance of ProgramConfig which stores program settings.
Definition: Config.h:82
std::string password
Password with which to authenticate on the server.
Definition: Config.h:20
std::string name
Plugin name (directory name).
Definition: Config.h:57
int port
Server XML-RPC port.
Definition: Config.h:18
std::string configFile
Name of the configuration file, set by constructor.
Definition: Config.h:98
std::map< std::string, std::string > settings
Plugin settings.
Definition: Config.h:58
std::map< std::string, PluginConfig > * Plugins
List of plugin configurations.
Definition: Config.h:83
Reads and stores configuration information.
Definition: Config.h:65
int port
Database serverport.
Definition: Config.h:32
std::string username
Username with which to authenticate on the database server.
Definition: Config.h:33
std::string username
Username with which to authenticate on the server.
Definition: Config.h:19
void parseConfig()
Reads information from YAML file and puts this in configuration struct(s).
Definition: Config.cpp:17
Plugin settings.
Definition: Config.h:55
~Config()
Definition: Config.cpp:9
std::string address
Server address (either hostname or IP Address).
Definition: Config.h:17
std::string database
Name of the database that should be used.
Definition: Config.h:35
DatabaseConfig * Database
Instance of DatabaseConfig which stores the database server connection settings.
Definition: Config.h:81
void parsePlugins(YAML::Node plugins)
Reads plugin information from YAML file.
Definition: Config.cpp:46
Server connection settings.
Definition: Config.h:15
Database connection settings.
Definition: Config.h:29
std::string password
Password with which to authenticate on the database server.
Definition: Config.h:34
ServerConfig * Server
Instance of ServerConfig which stores the server connection settings.
Definition: Config.h:80
bool checkVersion
Check for updates on start-up.
Definition: Config.h:46
std::string address
Database address (either hostname or IP Address).
Definition: Config.h:31
Program settings.
Definition: Config.h:44