1626.2.1
by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2010 Monty Taylor
|
|
5 |
*
|
|
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.
|
|
9 |
*
|
|
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.
|
|
14 |
*
|
|
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
|
|
18 |
*/
|
|
19 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <config.h> |
2207.6.4
by Olaf van der Spek
Refactor |
21 |
#include <boost/algorithm/string.hpp> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
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> |
|
1626.2.1
by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of |
27 |
|
2207.6.4
by Olaf van der Spek
Refactor |
28 |
namespace drizzled { |
29 |
namespace module { |
|
1626.2.1
by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of |
30 |
|
31 |
module::option_map Context::getOptions() |
|
32 |
{
|
|
1635.1.1
by Monty Taylor
Moved actual parsing of plugin program_options to drizzled.cc so that we do |
33 |
return module::option_map(module->getName(), getVariablesMap()); |
1626.2.1
by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of |
34 |
}
|
35 |
||
1857.3.1
by Monty Taylor
Added support for registering regular sys_var instances via module::Context. |
36 |
void Context::registerVariable(sys_var *var) |
37 |
{
|
|
38 |
var->setName(prepend_name(module->getName(), var->getName())); |
|
1857.3.4
by Monty Taylor
Track lifecycle of sys_var different form plugin_sysvar |
39 |
module->addMySysVar(var); |
1857.3.1
by Monty Taylor
Added support for registering regular sys_var instances via module::Context. |
40 |
add_sys_var_to_list(var); |
41 |
}
|
|
42 |
||
43 |
std::string Context::prepend_name(std::string module_name, |
|
44 |
const std::string &var_name) |
|
45 |
{
|
|
46 |
module_name.push_back('_'); |
|
47 |
module_name.append(var_name); |
|
2207.6.4
by Olaf van der Spek
Refactor |
48 |
std::replace(module_name.begin(), module_name.end(), '-', '_'); |
49 |
return boost::to_lower_copy(module_name); |
|
1857.3.1
by Monty Taylor
Added support for registering regular sys_var instances via module::Context. |
50 |
}
|
51 |
||
1626.2.1
by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of |
52 |
} /* namespace module */ |
53 |
} /* namespace drizzled */ |