~ubuntu-branches/ubuntu/hardy/gengetopt/hardy

« back to all changes in this revision

Viewing changes to src/skels/multiple_option.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-01-29 14:55:40 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080129145540-bkah1bl330gpelmh
Tags: 2.22-1ubuntu1
* Merge with Debian; remaining changes:
  - Fix build failures with g++-4.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * File automatically generated by
3
 
 * gengen 1.1 by Lorenzo Bettini 
4
 
 * http://www.gnu.org/software/gengen
5
 
 */
6
 
 
7
 
#ifndef MULTIPLE_OPTION_GEN_CLASS_H
8
 
#define MULTIPLE_OPTION_GEN_CLASS_H
9
 
 
10
 
#include <string>
11
 
#include <iostream>
12
 
 
13
 
using std::string;
14
 
using std::ostream;
15
 
 
16
 
class multiple_option_gen_class
17
 
{
18
 
 protected:
19
 
  string defaultval;
20
 
  string gen_else;
21
 
  string group_var_name;
22
 
  bool has_short_option;
23
 
  string long_option;
24
 
  string option_comment;
25
 
  bool option_has_group;
26
 
  bool option_has_type;
27
 
  bool option_has_values;
28
 
  string option_values;
29
 
  string option_var_name;
30
 
  string package_var_name;
31
 
  string short_option;
32
 
  string type;
33
 
  string update_arg;
34
 
 
35
 
 public:
36
 
  multiple_option_gen_class() :
37
 
    has_short_option (false), option_has_group (false), option_has_type (false), option_has_values (false)
38
 
  {
39
 
  }
40
 
  
41
 
  multiple_option_gen_class(const string &_defaultval, const string &_gen_else, const string &_group_var_name, bool _has_short_option, const string &_long_option, const string &_option_comment, bool _option_has_group, bool _option_has_type, bool _option_has_values, const string &_option_values, const string &_option_var_name, const string &_package_var_name, const string &_short_option, const string &_type, const string &_update_arg) :
42
 
    defaultval (_defaultval), gen_else (_gen_else), group_var_name (_group_var_name), has_short_option (_has_short_option), long_option (_long_option), option_comment (_option_comment), option_has_group (_option_has_group), option_has_type (_option_has_type), option_has_values (_option_has_values), option_values (_option_values), option_var_name (_option_var_name), package_var_name (_package_var_name), short_option (_short_option), type (_type), update_arg (_update_arg)
43
 
  {
44
 
  }
45
 
 
46
 
  static void
47
 
  generate_string(const string &s, ostream &stream, unsigned int indent)
48
 
  {
49
 
    if (!indent || s.find('\n') == string::npos)
50
 
      {
51
 
        stream << s;
52
 
        return;
53
 
      }
54
 
 
55
 
    string::size_type pos;
56
 
    string::size_type start = 0;
57
 
    string ind (indent, ' ');
58
 
    while ( (pos=s.find('\n', start)) != string::npos)
59
 
      {
60
 
        stream << s.substr (start, (pos+1)-start);
61
 
        start = pos+1;
62
 
        if (start+1 <= s.size ())
63
 
          stream << ind;
64
 
      }
65
 
    if (start+1 <= s.size ())
66
 
      stream << s.substr (start);
67
 
  }
68
 
 
69
 
  void set_defaultval(const string &_defaultval)
70
 
  {
71
 
    defaultval = _defaultval;
72
 
  }
73
 
 
74
 
  void set_gen_else(const string &_gen_else)
75
 
  {
76
 
    gen_else = _gen_else;
77
 
  }
78
 
 
79
 
  void set_group_var_name(const string &_group_var_name)
80
 
  {
81
 
    group_var_name = _group_var_name;
82
 
  }
83
 
 
84
 
  void set_has_short_option(bool _has_short_option)
85
 
  {
86
 
    has_short_option = _has_short_option;
87
 
  }
88
 
 
89
 
  void set_long_option(const string &_long_option)
90
 
  {
91
 
    long_option = _long_option;
92
 
  }
93
 
 
94
 
  void set_option_comment(const string &_option_comment)
95
 
  {
96
 
    option_comment = _option_comment;
97
 
  }
98
 
 
99
 
  void set_option_has_group(bool _option_has_group)
100
 
  {
101
 
    option_has_group = _option_has_group;
102
 
  }
103
 
 
104
 
  void set_option_has_type(bool _option_has_type)
105
 
  {
106
 
    option_has_type = _option_has_type;
107
 
  }
108
 
 
109
 
  void set_option_has_values(bool _option_has_values)
110
 
  {
111
 
    option_has_values = _option_has_values;
112
 
  }
113
 
 
114
 
  void set_option_values(const string &_option_values)
115
 
  {
116
 
    option_values = _option_values;
117
 
  }
118
 
 
119
 
  void set_option_var_name(const string &_option_var_name)
120
 
  {
121
 
    option_var_name = _option_var_name;
122
 
  }
123
 
 
124
 
  void set_package_var_name(const string &_package_var_name)
125
 
  {
126
 
    package_var_name = _package_var_name;
127
 
  }
128
 
 
129
 
  void set_short_option(const string &_short_option)
130
 
  {
131
 
    short_option = _short_option;
132
 
  }
133
 
 
134
 
  void set_type(const string &_type)
135
 
  {
136
 
    type = _type;
137
 
  }
138
 
 
139
 
  void set_update_arg(const string &_update_arg)
140
 
  {
141
 
    update_arg = _update_arg;
142
 
  }
143
 
 
144
 
  void generate_multiple_option(ostream &stream, unsigned int indent = 0);
145
 
  
146
 
};
147
 
 
148
 
#endif // MULTIPLE_OPTION_GEN_CLASS_H