#include <options.hpp>
|
virtual | ~options () |
|
void | enumVals (std::ostream &out) const |
|
bool | hasVal (const std::string &key) const |
|
template<class T > |
T | getVal (const std::string &key) const |
| Retrieves an option. Throws if nonexistant. More...
|
|
template<class T > |
T | getVal (const std::string &key, const T &defaultval) const |
| Retrieves an option. Returns defaultval if nonexistant. More...
|
|
template<class T > |
options_ptr | setVal (const std::string &key, const T &value) |
| Adds or replaces an option. More...
|
|
template<class T > |
options_ptr | add (const std::string &key, const T &value) |
| Adds an option. Throws if the same name already exists. More...
|
|
void | filename (const std::string &val) |
|
std::string | filename () const |
|
void | extension (const std::string &val) |
|
std::string | extension () const |
|
void | filetype (const std::string &val) |
|
std::string | filetype () const |
|
void | exportType (const std::string &val) |
|
std::string | exportType () const |
|
Definition at line 10 of file options.hpp.
◆ options()
icedb::registry::options::options |
( |
| ) |
|
|
protected |
Definition at line 15 of file options.cpp.
16 p = std::shared_ptr<options_inner>(
new options_inner);
std::shared_ptr< options_inner > p
◆ ~options()
icedb::registry::options::~options |
( |
| ) |
|
|
virtual |
◆ add()
template<class T >
options_ptr icedb::registry::options::add |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
Adds an option. Throws if the same name already exists.
Definition at line 59 of file options.cpp.
References ICEDB_throw, and icedb::error::xKeyExists.
62 .add<std::string>(
"key", key)
63 .add<T>(
"newValue", value);
64 return this->setVal<T>(key, value);
bool hasVal(const std::string &key) const
◆ enumVals()
void icedb::registry::options::enumVals |
( |
std::ostream & |
out | ) |
const |
Definition at line 22 of file options.cpp.
24 for (
const auto &v :
p->_mapStr)
26 if (v.first !=
"password")
28 out <<
"\t" << v.first <<
":\t" << v.second << std::endl;
31 out <<
"\t" << v.first <<
":\t" <<
"********" << std::endl;
std::shared_ptr< options_inner > p
◆ exportType() [1/2]
void icedb::registry::options::exportType |
( |
const std::string & |
val | ) |
|
|
inline |
Definition at line 36 of file options.hpp.
36 { setVal<std::string>(
"exportType", val); }
◆ exportType() [2/2]
std::string icedb::registry::options::exportType |
( |
| ) |
const |
|
inline |
Definition at line 37 of file options.hpp.
37 {
return getVal<std::string>(
"exportType",
""); }
◆ extension() [1/2]
void icedb::registry::options::extension |
( |
const std::string & |
val | ) |
|
|
inline |
Definition at line 32 of file options.hpp.
32 { setVal<std::string>(
"extension", val); }
◆ extension() [2/2]
std::string icedb::registry::options::extension |
( |
| ) |
const |
|
inline |
Definition at line 33 of file options.hpp.
33 {
return getVal<std::string>(
"extension",
""); }
◆ filename() [1/2]
void icedb::registry::options::filename |
( |
const std::string & |
val | ) |
|
|
inline |
Definition at line 30 of file options.hpp.
30 { setVal<std::string>(
"filename", val); }
◆ filename() [2/2]
std::string icedb::registry::options::filename |
( |
| ) |
const |
|
inline |
Definition at line 31 of file options.hpp.
31 {
return getVal<std::string>(
"filename",
""); }
◆ filetype() [1/2]
void icedb::registry::options::filetype |
( |
const std::string & |
val | ) |
|
|
inline |
Definition at line 34 of file options.hpp.
34 { setVal<std::string>(
"filetype", val); }
◆ filetype() [2/2]
std::string icedb::registry::options::filetype |
( |
| ) |
const |
|
inline |
Definition at line 35 of file options.hpp.
35 {
return getVal<std::string>(
"filetype",
""); }
◆ generate()
std::shared_ptr< options > icedb::registry::options::generate |
( |
| ) |
|
|
static |
◆ getVal() [1/2]
template<class T >
T icedb::registry::options::getVal |
( |
const std::string & |
key | ) |
const |
Retrieves an option. Throws if nonexistant.
Definition at line 39 of file options.cpp.
41 if (!
hasVal(key))
return boost::lexical_cast<T>(std::string(
""));
44 std::string valS =
p->_mapStr.at(key);
45 T res = boost::lexical_cast<T>(valS);
bool hasVal(const std::string &key) const
std::shared_ptr< options_inner > p
◆ getVal() [2/2]
template<class T >
T icedb::registry::options::getVal |
( |
const std::string & |
key, |
|
|
const T & |
defaultval |
|
) |
| const |
Retrieves an option. Returns defaultval if nonexistant.
Definition at line 48 of file options.cpp.
50 if (!
hasVal(key))
return defaultval;
51 return getVal<T>(key);
bool hasVal(const std::string &key) const
◆ hasVal()
bool icedb::registry::options::hasVal |
( |
const std::string & |
key | ) |
const |
Definition at line 35 of file options.cpp.
36 if (
p->_mapStr.count(key))
return true;
std::shared_ptr< options_inner > p
◆ setVal()
template<class T >
options_ptr icedb::registry::options::setVal |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
Adds or replaces an option.
Definition at line 53 of file options.cpp.
55 std::string valS = boost::lexical_cast<std::string>(value);
56 p->_mapStr[key] = valS;
57 return this->shared_from_this();
std::shared_ptr< options_inner > p
The documentation for this class was generated from the following files: