~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/option_context.h

  • Committer: Stewart Smith
  • Date: 2010-11-03 03:27:09 UTC
  • mto: (1902.1.1 build) (1910.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: stewart@flamingspork.com-20101103032709-oyvfrc6eb8fzj0mr
fix docs warning: docs/unlock.rst:2: (WARNING/2) Title underline too short.

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