alaCarte Maps
Renderer for OpenStreetMap tiles
|
Represents a set of options accessible via strings. More...
#include <configuration.hpp>
Public Member Functions | |
Configuration ()=default | |
Configuration (boost::program_options::options_description &cmd_desc, boost::program_options::options_description &config_desc, boost::program_options::positional_options_description &pos_desc, int argc, char **argv) | |
This file is part of alaCarte. More... | |
bool | has (const string &key) |
Tests if a key was specified in the command line or in the config file. More... | |
template<typename T > | |
T | get (const string &key) |
Returns a value identified by a key. More... | |
template<typename T > | |
T | get (const string &key, const T &defaultValue) |
Returns a value identified by a key or a default value if the key does not exist. More... | |
void | printConfigToLog () |
Prints the given configurations to the log. More... | |
bool | usedConfigFile () const |
Returns true if the configuration was loaded form a file. More... | |
const std::vector< string > & | getSearchDirectories () const |
Returns a queue of strings. More... | |
Protected Member Functions | |
TESTABLE const boost::any & | getValueByKey (const string &key) const |
Protected Attributes | |
boost::program_options::variables_map | options |
Internal map holding the options. More... | |
bool | ConfigFileUsed |
std::vector< string > | searchDirectories |
Represents a set of options accessible via strings.
Definition at line 128 of file configuration.hpp.
|
default |
Configuration::Configuration | ( | boost::program_options::options_description & | cmd_desc, |
boost::program_options::options_description & | config_desc, | ||
boost::program_options::positional_options_description & | pos_desc, | ||
int | argc, | ||
char ** | argv | ||
) |
This file is part of alaCarte.
alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
alaCarte is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.
Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Tobias Kahlert Creates a new config and parses the command line and config file.
Parses the command line arguments and stores them internally. If a config file is specified, the file will be loaded and parsed. If options are specified in both ways, the command line argument will be taken. This function will search for the config file in different locations:
cmd_desc | Option descriptions for the command line parser |
config_desc | Option descriptions for the config file parser |
pos_desc | Description for relative arguments in the command line |
argc | Number of arguments |
argv | arguments |
Definition at line 45 of file configuration.cpp.
|
inline |
Returns a value identified by a key.
key | the key identifying the value |
Definition at line 146 of file configuration.hpp.
|
inline |
Returns a value identified by a key or a default value if the key does not exist.
key | the key identifying the value |
defaultValue | the value that is returned if key does not exist |
Definition at line 159 of file configuration.hpp.
const std::vector< string > & Configuration::getSearchDirectories | ( | ) | const |
Returns a queue of strings.
Each string is a folder in which we searched for a config file. If usedConfigFile() is true then the last entry is the folder in which we found the config file.
Definition at line 106 of file configuration.cpp.
|
protected |
Definition at line 151 of file configuration.cpp.
bool Configuration::has | ( | const string & | key | ) |
Tests if a key was specified in the command line or in the config file.
key | the key to test |
Definition at line 95 of file configuration.cpp.
void Configuration::printConfigToLog | ( | ) |
Prints the given configurations to the log.
Definition at line 114 of file configuration.cpp.
bool Configuration::usedConfigFile | ( | ) | const |
Returns true if the configuration was loaded form a file.
Definition at line 101 of file configuration.cpp.
|
protected |
Definition at line 185 of file configuration.hpp.
|
protected |
Internal map holding the options.
Definition at line 183 of file configuration.hpp.
|
protected |
Definition at line 186 of file configuration.hpp.