GCpp general purpose C++ library
version 1.0
|
#include <GOptionString.hh>
Public Member Functions | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
virtual GOptionString * | Clone () const |
virtual const char * | ClassName () const |
GOptionString (bool case_sens=false) | |
GOptionString (const string &s, bool case_sens=false) | |
GOptionString (const char *s, bool case_sens=false) | |
GOptionString (const GOptionString &s) | |
GOptionString & | operator= (const GOptionString &s) |
GOptionString & | operator= (const string &s) |
GOptionString & | operator= (const char *s) |
virtual | ~GOptionString () |
virtual void | SetArgumentDelimiter (char c) |
virtual void | SetArgumentSeparator (char c) |
virtual void | SetArgumentSeparator (const string &str) |
virtual void | SetCaseSensitive (bool case_sens=true) |
virtual bool | CheckOption (const char opt) const |
virtual bool | CheckOption (const string &opt) const |
virtual bool | CheckOption (const char opt, string &arg) const |
virtual bool | CheckOption (const string &opt, string &arg) const |
virtual bool | CheckOption (const char opt, int &arg, const int default_val=0) const |
virtual bool | CheckOption (const string &opt, int &arg, const int default_val=0) const |
virtual bool | CheckOption (const char opt, double &arg, const double default_val=0.) const |
virtual bool | CheckOption (const string &opt, double &arg, const double default_val=0.) const |
virtual bool | ExtractOption (const char opt) |
virtual bool | ExtractOption (const string &opt) |
virtual bool | ExtractOption (const char opt, string &arg) |
virtual bool | ExtractOption (const string &opt, string &arg) |
virtual bool | ExtractOption (const char opt, int &arg, const int default_val=0) |
virtual bool | ExtractOption (const string &opt, int &arg, const int default_val=0) |
virtual bool | ExtractOption (const char opt, double &arg, const double default_val=0.) |
virtual bool | ExtractOption (const string &opt, double &arg, const double default_val=0.) |
![]() | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
GString () | |
GString (const string &s) | |
GString (const char *s) | |
GString (const GString &s) | |
GString & | operator= (const GString &s) |
GString & | operator= (const string &s) |
GString & | operator= (const char *s) |
virtual | ~GString () |
virtual GString | ToLower () const |
virtual GString | ToUpper () const |
virtual GString | NoAccent () const |
virtual GString | NoPunct (const string &punct=",;:.!?", const char rep= ' ') const |
virtual GString | NoSpace (const string &spc=" \n\t\r") const |
virtual GString | NoEndSpace (const string &spc=" \n\t\r") const |
virtual GString | Fill (size_t len, const char c= ' ', bool trunc=false) const |
size_t | FindFirstOf (const string &s, size_t index=0) |
GString & | ReplaceChar (char c, char r, u_int n=0) |
GString & | ReplaceAll (const GString &s, const GString &r) |
virtual int | Compare (const GString &str) const |
virtual int | CompareDict (const GString &str) const |
virtual int | ReadInt (int default_val=0) const |
virtual float | ReadFloat (float default_val=0.) const |
virtual double | ReadDouble (double default_val=0.) const |
virtual int | ReadSubInt (size_t &ifirst, size_t &ilast, size_t index=0, int default_val=0, const string &separ=" \n\t\r") const |
virtual float | ReadSubFloat (size_t &ifirst, size_t &ilast, const size_t index=0, const float default_val=0., const string &separ=" \n\t\r") const |
virtual double | ReadSubDouble (size_t &ifirst, size_t &ilast, const size_t index=0, const double default_val=0., const string &separ=" \n\t\r") const |
virtual GString | GetSubstring (char first, char last, size_t &ifirst, size_t &ilast, size_t index=0, bool keep=true) const |
virtual GString | GetSubstring (char first, char last, size_t index=0, bool keep=true) const |
virtual GString | GetWord (size_t &ifirst, size_t &ilast, size_t index=0, const string &separ=" ,;:.!?'[]{}()=+-*&%$#\n\t\r") const |
virtual GString | GetWord (size_t index=0, const string &separ=" ,;:.!?'[]{}()=+-*&%$#\n\t\r") const |
virtual u_int | CountWords (const string &separ=" ,;:.!?'[]{}()=+-*&%$#\n\t\r") const |
virtual u_int | GetWords (string *table, const string &separ=" ,;:.!?'[]{}()=+-*&%$#\n\t\r") const |
virtual string * | CreateWordsTable (u_int &nw, const string &separ=" ,;:.!?'[]{}()=+-*&%$#\n\t\r") const |
virtual size_t | FindFormat (const char fmtc, size_t &fmtlen, size_t &len) |
virtual size_t | FindFormat (const char fmtc, size_t &fmtlen) |
virtual GString | ReplaceFormat (const char fmtc, const int val, const char spc= '0') |
Static Public Member Functions | |
static const char * | StaticClassName () |
![]() | |
static const char * | StaticClassName () |
Protected Member Functions | |
virtual size_t | OptPosition (const GString &opt) const |
virtual size_t | OptPosition (const GString &opt, size_t &end_pos) const |
virtual string | OptArgument (const size_t pos, size_t &end) const |
Protected Attributes | |
bool | case_flag |
Indicates if options are case sensitive. | |
Static Protected Attributes | |
static char | arg_begin = '(' |
Character for beginning of argument. | |
static char | arg_end = ')' |
Character for end of argument. | |
static string | arg_separ = ";, " |
Characters to separate options. | |
Class for options defined by text strings. Options may be searched for with or without additional numerical or text parameters.
The CheckOption() functions search for an option and return true if it is found in the string, that is let unchanged. The ExtractOption() functions do the same, but the corresponding text is removed from the string.
The search for options ignores spaces between options.
La recherche d'option ignore les espaces entre les options.
The option arguments can be defined with 2 froms:
|
inline |
Default constructor: empty option string.
case_sens | defines if case sensitive |
References case_flag.
Referenced by operator=().
|
inline |
Constructor from a C++ string..
s | original string |
case_sens | defines if case sensitive |
References case_flag.
|
inline |
Constructor from a C characters array.
s | original string |
case_sens | defines if case sensitive |
References case_flag.
|
inline |
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Check if option is included (1 character).
opt | option character searched |
Referenced by CheckOption().
|
virtual |
Check if an option string is present.
opt | option string to search for |
References OptPosition().
|
inlinevirtual |
Check if option is included (1 character), with text argument.
opt | option character searched |
arg | argument value |
References CheckOption().
|
virtual |
Check if an option string is present, with string argument.
opt | option string to search for |
arg | returned argument value |
References OptArgument(), and OptPosition().
|
inlinevirtual |
Check if option is included (1 character), with integer value argument.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References CheckOption().
|
virtual |
Check if an option string is present, with interger value argument.
opt | option string to search for |
arg | returned argument value |
default_val | default argument value if option is not defined |
References OptArgument(), OptPosition(), and GString::ReadInt().
|
inlinevirtual |
Check if option is included (1 character), with double value argument.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References CheckOption().
|
virtual |
Check if an option string is present, with double value argument.
opt | option string to search for |
arg | returned argument value |
default_val | default argument value if option is not defined |
References OptArgument(), OptPosition(), and GString::ReadDouble().
|
inlinevirtual |
Check if option is included (1 character). If found, the option is removed from the original string.
opt | option character searched |
Referenced by ExtractOption().
|
virtual |
Check if option is included (1 character). If found, the option is removed from the original string.
opt | option character searched |
References OptPosition().
|
inlinevirtual |
Check if option is included (1 character), with text argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
References ExtractOption().
|
virtual |
Check if option is included (1 character), with text argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
References OptArgument(), and OptPosition().
|
inlinevirtual |
Check if option is included (1 character), with integer value argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References ExtractOption().
|
virtual |
Check if option is included (1 character), with integer value argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References OptArgument(), OptPosition(), and GString::ReadInt().
|
inlinevirtual |
Check if option is included (1 character), with double value argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References ExtractOption().
|
virtual |
Check if option is included (1 character), with double value argument. If found, the option is removed from the original string.
opt | option character searched |
arg | argument value |
default_val | default argument value if option is not defined |
References OptArgument(), OptPosition(), and GString::ReadDouble().
|
inline |
Macro from GCpp library that defines the following functions:
|
inline |
Affectation operator.
s | option string |
|
inline |
Affectation operator.
s | option string |
|
inline |
|
protectedvirtual |
Extract an argument from a string: it is searched for with 2 possible forms (if delimiters are parenthesis):
pos | start position to search for argument |
end | returned position of the end of the argument |
References arg_begin, arg_end, and arg_separ.
Referenced by CheckOption(), and ExtractOption().
|
protectedvirtual |
Return the position of an option in the string: if option is not found; string::npos is returned.
opt | option to check |
References case_flag, and GString::ToUpper().
Referenced by CheckOption(), ExtractOption(), and OptPosition().
|
protectedvirtual |
Return the position of an option in the string: if option is not found; string::npos is returned. The end_pos argument variable returns the end position of the option.
opt | option to check |
end_pos | returned end of option position in the string |
References OptPosition().
|
virtual |
|
inlinevirtual |
Set the unique character defining argument separator.
c | selected character |
References arg_separ.
|
inlinevirtual |
Set a list of character defining accepted argument separators.
str | string of selected characters |
References arg_separ.
|
inlinevirtual |