~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/option_context.h

Merged vcol stuff.

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
 
/**
21
 
 * @file
22
 
 * @brief An Proxy Wrapper around options_description_easy_init
23
 
 */
24
 
 
25
 
#ifndef DRIZZLED_MODULE_OPTION_CONTEXT_H
26
 
#define DRIZZLED_MODULE_OPTION_CONTEXT_H
27
 
 
28
 
#include "drizzled/visibility.h"
29
 
 
30
 
#include <boost/program_options.hpp>
31
 
 
32
 
#include <string>
33
 
 
34
 
#include "drizzled/visibility.h"
35
 
 
36
 
namespace drizzled
37
 
{
38
 
namespace module
39
 
{
40
 
 
41
 
namespace po=boost::program_options;
42
 
 
43
 
/**
44
 
 * Options proxy wrapper. Provides pre-pending of module name to each option
45
 
 * which is added.
46
 
 */
47
 
class DRIZZLED_API option_context
48
 
{
49
 
  const std::string &module_name;
50
 
  po::options_description_easy_init po_options;
51
 
 
52
 
public:
53
 
 
54
 
  option_context(const std::string &module_name_in,
55
 
                 po::options_description_easy_init po_options_in);
56
 
 
57
 
  option_context& operator()(const char* name,
58
 
                             const char* description);
59
 
 
60
 
  option_context& operator()(const char* name,
61
 
                             const po::value_semantic* s);
62
 
 
63
 
  option_context& operator()(const char* name,
64
 
                             const po::value_semantic* s,
65
 
                             const char* description);
66
 
 
67
 
  static std::string prepend_name(std::string module_name_in,
68
 
                                  const char *name);
69
 
 
70
 
private:
71
 
  
72
 
  /**
73
 
   * Don't allow default construction.
74
 
   */
75
 
  option_context();
76
 
 
77
 
  /**
78
 
   * Don't allow copying of objects.
79
 
   */
80
 
  option_context(const option_context &);
81
 
 
82
 
  /**
83
 
   * Don't allow assignment of objects.
84
 
   */
85
 
  option_context& operator=(const option_context &);
86
 
};
87
 
 
88
 
} /* namespace module */
89
 
} /* namespace drizzled */
90
 
 
91
 
 
92
 
#endif /* DRIZZLED_MODULE_OPTION_CONTEXT_H */