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

« back to all changes in this revision

Viewing changes to src/skels/multiple_opt_struct.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_OPT_STRUCT_GEN_CLASS_H
8
 
#define MULTIPLE_OPT_STRUCT_GEN_CLASS_H
9
 
 
10
 
#include <string>
11
 
#include <iostream>
12
 
 
13
 
using std::string;
14
 
using std::ostream;
15
 
 
16
 
class multiple_opt_struct_gen_class
17
 
{
18
 
 protected:
19
 
  string list_name;
20
 
  string type;
21
 
 
22
 
 public:
23
 
  multiple_opt_struct_gen_class()
24
 
  {
25
 
  }
26
 
  
27
 
  multiple_opt_struct_gen_class(const string &_list_name, const string &_type) :
28
 
    list_name (_list_name), type (_type)
29
 
  {
30
 
  }
31
 
 
32
 
  static void
33
 
  generate_string(const string &s, ostream &stream, unsigned int indent)
34
 
  {
35
 
    if (!indent || s.find('\n') == string::npos)
36
 
      {
37
 
        stream << s;
38
 
        return;
39
 
      }
40
 
 
41
 
    string::size_type pos;
42
 
    string::size_type start = 0;
43
 
    string ind (indent, ' ');
44
 
    while ( (pos=s.find('\n', start)) != string::npos)
45
 
      {
46
 
        stream << s.substr (start, (pos+1)-start);
47
 
        start = pos+1;
48
 
        if (start+1 <= s.size ())
49
 
          stream << ind;
50
 
      }
51
 
    if (start+1 <= s.size ())
52
 
      stream << s.substr (start);
53
 
  }
54
 
 
55
 
  void set_list_name(const string &_list_name)
56
 
  {
57
 
    list_name = _list_name;
58
 
  }
59
 
 
60
 
  void set_type(const string &_type)
61
 
  {
62
 
    type = _type;
63
 
  }
64
 
 
65
 
  void generate_multiple_opt_struct(ostream &stream, unsigned int indent = 0);
66
 
  
67
 
};
68
 
 
69
 
#endif // MULTIPLE_OPT_STRUCT_GEN_CLASS_H