~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/option_context.cc

  • Committer: Monty Taylor
  • Date: 2010-06-19 21:25:32 UTC
  • mfrom: (1627.2.5 build)
  • Revision ID: mordred@inaugust.com-20100619212532-2e4bd11tm4plya7q
Rollup patch featuring: boost::program_options support for plugins, a
valgrind fix, a bugfix for password processing and a few build fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
20
#include "config.h"
 
21
 
 
22
#include "option_context.h"
 
23
 
 
24
namespace drizzled
 
25
{
 
26
namespace module
 
27
{
 
28
 
 
29
 
 
30
option_context::option_context(const std::string &module_name_in,
 
31
                               po::options_description_easy_init po_options_in) :
 
32
  module_name(module_name_in),
 
33
  po_options(po_options_in)
 
34
{ }
 
35
 
 
36
option_context& option_context::operator()(const char* name,
 
37
                                           const char* description)
 
38
{
 
39
  const std::string new_name(prepend_name(name));
 
40
  po_options(new_name.c_str(), description);
 
41
  return *this;
 
42
}
 
43
 
 
44
 
 
45
option_context& option_context::operator()(const char* name,
 
46
                                           const po::value_semantic* s)
 
47
{
 
48
  const std::string new_name(prepend_name(name));
 
49
  po_options(new_name.c_str(), s);
 
50
  return *this;
 
51
}
 
52
 
 
53
 
 
54
option_context& option_context::operator()(const char* name,
 
55
                             const po::value_semantic* s,
 
56
                             const char* description)
 
57
{
 
58
  const std::string new_name(prepend_name(name));
 
59
  po_options(new_name.c_str(), s, description);
 
60
  return *this;
 
61
}
 
62
 
 
63
 
 
64
} /* namespace module */
 
65
} /* namespace drizzled */
 
66