~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/context.cc

  • Committer: Patrick Crews
  • Date: 2010-09-14 20:21:03 UTC
  • mto: (1771.1.1 pcrews)
  • mto: This revision was merged to the branch mainline in revision 1772.
  • Revision ID: gleebix@gmail.com-20100914202103-1db2n0bshzafep19
Moved transaction_log tests into updated non-publisher-based tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "drizzled/module/option_map.h"
23
23
#include "drizzled/module/module.h"
24
24
#include "drizzled/drizzled.h"
25
 
#include "drizzled/sys_var.h"
26
25
 
27
26
namespace drizzled
28
27
{
35
34
  return module::option_map(module->getName(), getVariablesMap());
36
35
}
37
36
 
38
 
void Context::registerVariable(sys_var *var)
39
 
{
40
 
  var->setName(prepend_name(module->getName(), var->getName()));
41
 
  module->addMySysVar(var);
42
 
  add_sys_var_to_list(var);
43
 
}
44
 
 
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
 
std::string Context::prepend_name(std::string module_name,
62
 
                                  const std::string &var_name)
63
 
{
64
 
  module_name.push_back('_');
65
 
  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;
71
 
}
72
 
 
73
 
 
74
37
} /* namespace module */
75
38
} /* namespace drizzled */