added appropriate constness to Config::getOption functions
Previously the Config::getOption functions were not marked as const, This prevented them being called through a const Config * as I was attempting to do. I've marked them as const member functions as well as changed the iteration to use a const_iterator.
This commit is contained in:
parent
950d38e25d
commit
a8386f8c25
|
@ -395,9 +395,9 @@ Config::setOption(const std::string &name,
|
||||||
|
|
||||||
int
|
int
|
||||||
Config::getOption(const std::string &name,
|
Config::getOption(const std::string &name,
|
||||||
std::string *value)
|
std::string *value) const
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string>::iterator opt_i;
|
std::map<std::string, std::string>::const_iterator opt_i;
|
||||||
|
|
||||||
// confirm that the option exists
|
// confirm that the option exists
|
||||||
opt_i = _strOptMap.find(name);
|
opt_i = _strOptMap.find(name);
|
||||||
|
@ -412,9 +412,9 @@ Config::getOption(const std::string &name,
|
||||||
|
|
||||||
int
|
int
|
||||||
Config::getOption(const std::string &name,
|
Config::getOption(const std::string &name,
|
||||||
const char **value)
|
const char **value) const
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string>::iterator opt_i;
|
std::map<std::string, std::string>::const_iterator opt_i;
|
||||||
|
|
||||||
// confirm that the option exists
|
// confirm that the option exists
|
||||||
opt_i = _strOptMap.find(name);
|
opt_i = _strOptMap.find(name);
|
||||||
|
@ -429,9 +429,9 @@ Config::getOption(const std::string &name,
|
||||||
|
|
||||||
int
|
int
|
||||||
Config::getOption(const std::string &name,
|
Config::getOption(const std::string &name,
|
||||||
int *value)
|
int *value) const
|
||||||
{
|
{
|
||||||
std::map<std::string, int>::iterator opt_i;
|
std::map<std::string, int>::const_iterator opt_i;
|
||||||
|
|
||||||
// confirm that the option exists
|
// confirm that the option exists
|
||||||
opt_i = _intOptMap.find(name);
|
opt_i = _intOptMap.find(name);
|
||||||
|
@ -446,9 +446,9 @@ Config::getOption(const std::string &name,
|
||||||
|
|
||||||
int
|
int
|
||||||
Config::getOption(const std::string &name,
|
Config::getOption(const std::string &name,
|
||||||
double *value)
|
double *value) const
|
||||||
{
|
{
|
||||||
std::map<std::string, double>::iterator opt_i;
|
std::map<std::string, double>::const_iterator opt_i;
|
||||||
|
|
||||||
// confirm that the option exists
|
// confirm that the option exists
|
||||||
opt_i = _dblOptMap.find(name);
|
opt_i = _dblOptMap.find(name);
|
||||||
|
|
|
@ -66,10 +66,10 @@ public:
|
||||||
int setOption(const std::string &, double);
|
int setOption(const std::string &, double);
|
||||||
int setOption(const std::string &, void (*)(const std::string &));
|
int setOption(const std::string &, void (*)(const std::string &));
|
||||||
|
|
||||||
int getOption(const std::string &, std::string *);
|
int getOption(const std::string &, std::string *) const;
|
||||||
int getOption(const std::string &, const char **);
|
int getOption(const std::string &, const char **) const;
|
||||||
int getOption(const std::string &, int *);
|
int getOption(const std::string &, int *) const;
|
||||||
int getOption(const std::string &, double *);
|
int getOption(const std::string &, double *) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the arguments. Also read in the configuration file and
|
* Parse the arguments. Also read in the configuration file and
|
||||||
|
|
Loading…
Reference in New Issue