X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=utilities%2Fgengetopt%2Fskels%2Ffree_string.h;fp=utilities%2Fgengetopt%2Fskels%2Ffree_string.h;h=7622617988d52aa88d14bc07f3ea31229e99d25e;hb=79381bc54b9e0c85156460daa211fe5ac83da0a7;hp=0000000000000000000000000000000000000000;hpb=4454c06e212fb6af58d206f2d6f9b76778858967;p=clitk.git diff --git a/utilities/gengetopt/skels/free_string.h b/utilities/gengetopt/skels/free_string.h new file mode 100644 index 0000000..7622617 --- /dev/null +++ b/utilities/gengetopt/skels/free_string.h @@ -0,0 +1,76 @@ +/* + * File automatically generated by + * gengen 1.2 by Lorenzo Bettini + * http://www.gnu.org/software/gengen + */ + +#ifndef FREE_STRING_GEN_CLASS_H +#define FREE_STRING_GEN_CLASS_H + +#include +#include + +using std::string; +using std::ostream; + +class free_string_gen_class +{ + protected: + bool has_string_type; + string opt_var; + string structure; + + public: + free_string_gen_class() : + has_string_type (false) + { + } + + free_string_gen_class(bool _has_string_type, const string &_opt_var, const string &_structure) : + has_string_type (_has_string_type), opt_var (_opt_var), structure (_structure) + { + } + + 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_has_string_type(bool _has_string_type) + { + has_string_type = _has_string_type; + } + + void set_opt_var(const string &_opt_var) + { + opt_var = _opt_var; + } + + void set_structure(const string &_structure) + { + structure = _structure; + } + + void generate_free_string(ostream &stream, unsigned int indent = 0); + +}; + +#endif // FREE_STRING_GEN_CLASS_H