/*
 * File automatically generated by
 * gengen 1.0 by Lorenzo Bettini 
 * http://www.gnu.org/software/gengen
 */

#ifndef ABSTRMETHOD_GEN_CLASS_H
#define ABSTRMETHOD_GEN_CLASS_H

#include <string>
#include <iostream>

using std::string;
using std::ostream;

class abstrmethod_gen_class
{
 protected:
  string name;

 public:
  abstrmethod_gen_class()
  {
  }
  
  abstrmethod_gen_class(const string &_name) :
    name (_name)
  {
  }

  static void
  generate_string(const string &s, ostream &stream, unsigned int indent)
  {
    if (!indent || s.find('\n') == string::npos)
      {
        stream << s;
        return;
      }

    string::size_type pos;
    string::size_type start = 0;
    string ind (indent, ' ');
    while ( (pos=s.find('\n', start)) != string::npos)
      {
        stream << s.substr (start, (pos+1)-start);
        start = pos+1;
        if (start+1 <= s.size ())
          stream << ind;
      }
    if (start+1 <= s.size ())
      stream << s.substr (start);
  }

  void set_name(const string &_name)
  {
    name = _name;
  }

  void generate_abstrmethod(ostream &stream, unsigned int indent = 0)
  {
    string indent_str (indent, ' ');
    indent = 0;
  
    stream << "virtual void generate_";
    generate_string (name, stream, indent + indent_str.length ());
    stream << "(ostream &stream, unsigned int indent) = 0;";
  }
};

#endif // ABSTRMETHOD_GEN_CLASS_H
