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
22
* @brief An Proxy Wrapper around options_description_easy_init
25
#ifndef DRIZZLED_MODULE_OPTION_CONTEXT_H
26
#define DRIZZLED_MODULE_OPTION_CONTEXT_H
28
#include "drizzled/visibility.h"
30
#include <boost/program_options.hpp>
39
namespace po=boost::program_options;
42
* Options proxy wrapper. Provides pre-pending of module name to each option
45
class DRIZZLED_API option_context
47
const std::string &module_name;
48
po::options_description_easy_init po_options;
50
std::string prepend_name(const char *name) const;
54
option_context(const std::string &module_name_in,
55
po::options_description_easy_init po_options_in);
57
option_context& operator()(const char* name,
58
const char* description);
60
option_context& operator()(const char* name,
61
const po::value_semantic* s);
63
option_context& operator()(const char* name,
64
const po::value_semantic* s,
65
const char* description);
70
* Don't allow default construction.
75
* Don't allow copying of objects.
77
option_context(const option_context &);
80
* Don't allow assignment of objects.
82
option_context& operator=(const option_context &);
88
inline std::string option_context::prepend_name(const char *name_in) const
90
std::string new_name(module_name);
91
new_name.push_back('.');
92
new_name.append(name_in);
96
} /* namespace module */
97
} /* namespace drizzled */
100
#endif /* DRIZZLED_MODULE_OPTION_CONTEXT_H */