00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021 #include <boost/algorithm/string.hpp>
00022 #include <drizzled/module/context.h>
00023 #include <drizzled/module/option_map.h>
00024 #include <drizzled/module/module.h>
00025 #include <drizzled/drizzled.h>
00026 #include <drizzled/sys_var.h>
00027
00028 namespace drizzled {
00029 namespace module {
00030
00031 module::option_map Context::getOptions()
00032 {
00033 return module::option_map(module->getName(), getVariablesMap());
00034 }
00035
00036 void Context::registerVariable(sys_var *var)
00037 {
00038 var->setName(prepend_name(module->getName(), var->getName()));
00039 module->addMySysVar(var);
00040 add_sys_var_to_list(var);
00041 }
00042
00043 std::string Context::prepend_name(std::string module_name,
00044 const std::string &var_name)
00045 {
00046 module_name.push_back('_');
00047 module_name.append(var_name);
00048 std::replace(module_name.begin(), module_name.end(), '-', '_');
00049 return boost::to_lower_copy(module_name);
00050 }
00051
00052 }
00053 }