~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/context.cc

update

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include <config.h>
 
21
#include <boost/algorithm/string.hpp>
21
22
#include <drizzled/module/context.h>
22
23
#include <drizzled/module/option_map.h>
23
24
#include <drizzled/module/module.h>
24
25
#include <drizzled/drizzled.h>
25
26
#include <drizzled/sys_var.h>
26
27
 
27
 
namespace drizzled
28
 
{
29
 
 
30
 
namespace module
31
 
{
 
28
namespace drizzled {
 
29
namespace module {
32
30
 
33
31
module::option_map Context::getOptions()
34
32
{
42
40
  add_sys_var_to_list(var);
43
41
}
44
42
 
45
 
namespace
46
 
{
47
 
 
48
 
class SwapDashes
49
 
{
50
 
public:
51
 
  char operator()(char a) const
52
 
  {
53
 
    if (a == '-')
54
 
      return '_';
55
 
    return a;
56
 
  }
57
 
};
58
 
 
59
 
} /* namespace */
60
 
 
61
43
std::string Context::prepend_name(std::string module_name,
62
44
                                  const std::string &var_name)
63
45
{
64
46
  module_name.push_back('_');
65
47
  module_name.append(var_name);
66
 
  std::transform(module_name.begin(), module_name.end(),
67
 
                 module_name.begin(), SwapDashes());
68
 
  std::transform(module_name.begin(), module_name.end(),
69
 
                 module_name.begin(), ::tolower);
70
 
  return module_name;
 
48
  std::replace(module_name.begin(), module_name.end(), '-', '_');
 
49
  return boost::to_lower_copy(module_name);
71
50
}
72
51
 
73
 
 
74
52
} /* namespace module */
75
53
} /* namespace drizzled */