/* * File automatically generated by * gengen 1.0 by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef GENERIC_OPTION_GEN_CLASS_H #define GENERIC_OPTION_GEN_CLASS_H #include #include using std::string; using std::ostream; class generic_option_gen_class { protected: string defaultval; string gen_else; bool has_short_option; string long_option; string option_comment; bool option_has_values; string option_values; string option_var_name; string package_var_name; string short_option; string update_arg; string update_group_count; public: generic_option_gen_class() : has_short_option (false), option_has_values (false) { } generic_option_gen_class(const string &_defaultval, const string &_gen_else, bool _has_short_option, const string &_long_option, const string &_option_comment, bool _option_has_values, const string &_option_values, const string &_option_var_name, const string &_package_var_name, const string &_short_option, const string &_update_arg, const string &_update_group_count) : defaultval (_defaultval), gen_else (_gen_else), has_short_option (_has_short_option), long_option (_long_option), option_comment (_option_comment), 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), update_arg (_update_arg), update_group_count (_update_group_count) { } 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_defaultval(const string &_defaultval) { defaultval = _defaultval; } void set_gen_else(const string &_gen_else) { gen_else = _gen_else; } void set_has_short_option(bool _has_short_option) { has_short_option = _has_short_option; } void set_long_option(const string &_long_option) { long_option = _long_option; } void set_option_comment(const string &_option_comment) { option_comment = _option_comment; } void set_option_has_values(bool _option_has_values) { option_has_values = _option_has_values; } void set_option_values(const string &_option_values) { option_values = _option_values; } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void set_short_option(const string &_short_option) { short_option = _short_option; } void set_update_arg(const string &_update_arg) { update_arg = _update_arg; } void set_update_group_count(const string &_update_group_count) { update_group_count = _update_group_count; } void generate_generic_option(ostream &stream, unsigned int indent = 0); }; #endif // GENERIC_OPTION_GEN_CLASS_H