1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Monty Taylor
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#include "drizzled/module/context.h"
22
#include "drizzled/module/option_map.h"
23
#include "drizzled/module/module.h"
24
#include "drizzled/drizzled.h"
32
module::option_map Context::getOptions()
34
return module::option_map(module->getName(), getVariablesMap());
37
void Context::registerVariable(sys_var *var)
39
var->setName(prepend_name(module->getName(), var->getName()));
40
add_sys_var_to_list(var);
49
char operator()(char a) const
59
std::string Context::prepend_name(std::string module_name,
60
const std::string &var_name)
62
module_name.push_back('_');
63
module_name.append(var_name);
64
std::transform(module_name.begin(), module_name.end(),
65
module_name.begin(), SwapDashes());
66
std::transform(module_name.begin(), module_name.end(),
67
module_name.begin(), ::tolower);
72
} /* namespace module */
73
} /* namespace drizzled */