~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/context.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
21
 
#include <boost/algorithm/string.hpp>
22
 
#include <drizzled/module/context.h>
23
 
#include <drizzled/module/option_map.h>
24
 
#include <drizzled/module/module.h>
25
 
#include <drizzled/drizzled.h>
26
 
#include <drizzled/sys_var.h>
27
 
 
28
 
namespace drizzled {
29
 
namespace module {
 
20
#include "config.h"
 
21
#include "drizzled/module/context.h"
 
22
#include "drizzled/module/option_map.h"
 
23
#include "drizzled/module/module.h"
 
24
#include "drizzled/drizzled.h"
 
25
#include "drizzled/sys_var.h"
 
26
 
 
27
namespace drizzled
 
28
{
 
29
 
 
30
namespace module
 
31
{
30
32
 
31
33
module::option_map Context::getOptions()
32
34
{
40
42
  add_sys_var_to_list(var);
41
43
}
42
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
 
43
61
std::string Context::prepend_name(std::string module_name,
44
62
                                  const std::string &var_name)
45
63
{
46
64
  module_name.push_back('_');
47
65
  module_name.append(var_name);
48
 
  std::replace(module_name.begin(), module_name.end(), '-', '_');
49
 
  return boost::to_lower_copy(module_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;
50
71
}
51
72
 
 
73
 
52
74
} /* namespace module */
53
75
} /* namespace drizzled */