20
20
#include <config.h>
21
#include <boost/algorithm/string.hpp>
22
22
#include "option_context.h"
30
27
option_context::option_context(const std::string &module_name_in,
31
28
po::options_description_easy_init po_options_in) :
32
29
module_name(module_name_in),
33
30
po_options(po_options_in)
36
option_context& option_context::operator()(const char* name,
37
const char* description)
39
const std::string new_name(prepend_name(module_name, name));
40
po_options(new_name.c_str(), description);
45
option_context& option_context::operator()(const char* name,
46
const po::value_semantic* s)
48
const std::string new_name(prepend_name(module_name, name));
49
po_options(new_name.c_str(), s);
54
option_context& option_context::operator()(const char* name,
55
const po::value_semantic* s,
56
const char* description)
58
const std::string new_name(prepend_name(module_name, name));
59
po_options(new_name.c_str(), s, description);
69
char operator()(char a) const
82
std::string option_context::prepend_name(std::string in_module_name,
33
option_context& option_context::operator()(const char* name, const char* description)
35
po_options(prepend_name(module_name, name).c_str(), description);
39
option_context& option_context::operator()(const char* name, const po::value_semantic* s)
41
po_options(prepend_name(module_name, name).c_str(), s);
45
option_context& option_context::operator()(const char* name, const po::value_semantic* s, const char* description)
47
po_options(prepend_name(module_name, name).c_str(), s, description);
51
std::string option_context::prepend_name(std::string in_module_name, const char *name_in)
85
53
in_module_name.push_back('.');
86
std::transform(in_module_name.begin(), in_module_name.end(),
87
in_module_name.begin(), SwapUnderscores());
88
std::transform(in_module_name.begin(), in_module_name.end(),
89
in_module_name.begin(), ::tolower);
54
std::replace(in_module_name.begin(), in_module_name.end(), '_', '-');
55
boost::to_lower(in_module_name);
90
56
in_module_name.append(name_in);
91
57
return in_module_name;
95
60
} /* namespace module */
96
61
} /* namespace drizzled */