~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/option_context.h

  • Committer: Brian Aker
  • Date: 2010-02-14 01:56:51 UTC
  • mto: (1273.16.5 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: brian@gaz-20100214015651-ror9j0xu7dccz0ct
Two fixes for "make dist"

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 */