monotone

monotone Mtn Source Tree

Root/options.hh

1#ifndef __OPTIONS_HH__
2#define __OPTIONS_HH__
3
4#include <list>
5
6#include "option.hh"
7#include "paths.hh"
8#include "dates.hh"
9
10struct options
11{
12 options();
13
14 typedef boost::function<void()> reset_function;
15 typedef option::option<options> option_type;
16 typedef option::option_set<options> options_type;
17 typedef options_type const & (*static_options_fun)();
18
19 static std::map<static_options_fun, std::set<static_options_fun> > &children();
20 static std::map<static_options_fun, std::list<void(options::*)()> > &var_membership();
21
22 void reset_optset(static_options_fun opt);
23
24 struct opts
25 {
26 static options_type const & none ();
27 static options_type const & all_options ();
28# define OPTSET(name) \
29 static options_type const & name ();
30
31# define OPTVAR(optset, type, name, default_)
32
33#define OPTION(optset, name, hasarg, optstring, description) \
34 static options_type const & name ();
35
36# define OPTSET_REL(parent, child)
37
38# include "options_list.hh"
39
40# undef OPTSET
41# undef OPTVAR
42# undef OPTION
43# undef OPTSET_REL
44 };
45
46# define OPTSET(name)\
47 private:\
48 void reset_optset_ ## name ();
49
50# define OPTVAR(optset, type, name, default_)\
51 public:\
52 type name;\
53 void reset_ ## name ();
54
55#define OPTION(optset, name, hasarg, optstring, description) \
56 public: \
57 bool name ## _given; \
58private: \
59 void set_ ## name (std::string arg); \
60 void real_set_ ## name (std::string arg); \
61 void reset_opt_ ## name ();
62
63# define OPTSET_REL(parent, child)
64
65# include "options_list.hh"
66
67# undef OPTSET
68# undef OPTVAR
69# undef OPTION
70# undef OPTSET_REL
71};
72
73option::option_set<options>
74operator | (option::option_set<options> const & opts,
75 option::option_set<options> const & (*fun)());
76
77#endif
78
79// Local Variables:
80// mode: C++
81// fill-column: 76
82// c-file-style: "gnu"
83// indent-tabs-mode: nil
84// End:
85// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status