Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

stringutil


Defines

#define _STRINGUTILDEFAULTPRINTERROR   true
 default values for stringutilprinterror
See also:
stringutilprinterror.
More...


#define _STRINGUTILDEFAULTTHROWEXCEPTION   false
 defaultvalues for stringutilthrowexception
See also:
stringutilthrowexception.
More...


#define _STRINGUTILSTRDELIMITER   '\"'
 default string delimiter char specification. More...

#define _STRINGUTILSCAPECHAR   '\\'
 default scape char specification. More...

#define _STRINGUTILCOMMENTCHAR   '#'
 default comment char specification. More...

#define _STRINGUTILCOLUMNSEPARATOR   '\t'
 default column separator. More...

#define _STRINGUTILCNTRLMARK   '^'
 specificator for cntrl char. More...

#define _STRINGUTILHEXAMARK   'X'
 specificator for hexadecimal. More...

#define _STRINGUTILCHARTABLE
 the spceial characters specification table. More...


Functions

bool stringutilprinterror ()
 print error message default value is _STRINGUTILDEFAULTPRINTERROR;
See also:
stringutilthrowexception, _STRINGUTILDEFAULTPRINTERROR.
More...


bool stringutilprinterror (bool status)
bool stringutilthrowexception ()
 throw exception default value is _STRINGUTILDEFAULTTHROWEXCEPTION
See also:
stringutilprinterror, _STRINGUTILDEFAULTPRINTERROR.
More...


bool stringutilthrowexception (bool status)
bool isextended (char c)
bool iswhite (char c)
 white char detection, used by string util and dataio. More...

char tocntrl (char c)
unsigned stringcasefind (string const &s1, string const &s2, unsigned pos=0)
 case insensive version of string::find(). More...

unsigned stringcasefind_last_of (string const &s1, string const &s2, unsigned pos=0)
 case insensive version of string::find_last_of() does not used by dataio. More...

string& parsestring (string &s, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 clear extra spaces and parse delimited string of s the sequence of iswhite() is replaced by single space, except inside of delimited string (inside delimiters, the sequence of two delimiters is assumed one delimiters). More...

vector<string>& parsestring (vector< string > &strlist, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 for each element of list, clear extra spaces and parse delimited string. More...

string& reverseparsestring (string &s, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 translate s to delimited string (is delimiter is found, substitute by double of one). More...

vector<string>& reverseparsestring (vector< string > &strlist, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 for each element of list, convert to delimited string. More...

unsigned findstringdelimiterclose (string const &s, unsigned pos=0, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 return the position of string delimiter to close, started in the position pos. case delimiter='\0', force that delimiter is s[pos] otherwise: if s[pos] is not delimiter, assume that first delimiter is to open, and start closer findding. return ~0U if not found. return s.size() if delimiter do not occur in the s (starting the pos) CAUTION: This routine will change in future in way to support C/C++ like cher specification. More...

bool stringdelimiterbalanced (string const &s, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR, unsigned pos1=0, unsigned pos2=(~0U))
 return true, if string delimiter is closed correctly between [pos1, pos2). More...

bool needdelimiter (string const &s, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR)
 return true, if string delimiters is required if contain two adjacent iswhite() or string delimiters. More...

istream& gettextline (istream &f, string &line, char comment=_STRINGUTILCOMMENTCHAR, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR, char newlinedelimiter='\0')
 getline() that can read text file of ansi, DOS, windows (newline == '\r
'), UNIX (newline=='n') and VAX/VMS (newline=='r') withouth specification. if (newline == '\0'), auto detect new line format. otherwise, work as getline() Unless (newline == EOF), assume end of file if EOF character is found or fisical eof occur It is necessary, because some text editor write EOF character at end of file If (newline == EOF), read EOF char into memory, if found.
More...


istream& getline (istream &f, vector< string > &dataline, char separator=_STRINGUTILCOLUMNSEPARATOR, char comment=_STRINGUTILCOMMENTCHAR, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR, char newline='\0')
 vectorized getline get vector <string> (one line separated as colmns) from istream does not used by dataio newline=='\0' is autodetect mode. More...

istream& getlines (istream &f, vector< vector< string > > &datalist, char separator=_STRINGUTILCOLUMNSEPARATOR, char comment=_STRINGUTILCOMMENTCHAR, char strdelimiter=_STRINGUTILSTRDELIMITER, char scapechar=_STRINGUTILSCAPECHAR, char newline='\0')
 vectorized getlines newline=='\0' is auto detect mode. More...

ostream& putline (ostream &f, vector< string > &dataline, char separator=_STRINGUTILCOLUMNSEPARATOR, char newline='\0')
 put the vector<string> to ostream dataio use it, only if _DATAIODEBUG_ is defined newline=='\0' is system newline. More...

ostream& putlines (ostream &f, vector< vector< string > > &datalist, char separator=_STRINGUTILCOLUMNSEPARATOR, char newline='\0')
 vectorized putlines newline=='\0' is system new lines. More...

vector<vector <string> >& transpose (vector< vector< string > > &data)
 transpose the vector<vector <string> > data array (replace row and column). More...


Define Documentation

#define _STRINGUTILCHARTABLE
 

Value:

                      { \
                      \
                      \
                      \
                  {'a', '\a'},    \
                  {'b', '\b'},    \
                  {'e', '\e'},     \
                  {'f', '\f'},     \
                  {'n', '\n'},    \
                  {'r', '\r'},     \
                  {'t', '\t'},    \
                  {'v', '\v'},    \
                  {'\0', '\0'},   \
                  }
the spceial characters specification table.

Definition at line 107 of file stringutil.h.

#define _STRINGUTILCNTRLMARK   '^'
 

specificator for cntrl char.

Definition at line 102 of file stringutil.h.

#define _STRINGUTILCOLUMNSEPARATOR   '\t'
 

default column separator.

Definition at line 100 of file stringutil.h.

#define _STRINGUTILCOMMENTCHAR   '#'
 

default comment char specification.

Definition at line 98 of file stringutil.h.

#define _STRINGUTILDEFAULTPRINTERROR   true
 

default values for stringutilprinterror

See also:
stringutilprinterror.

Definition at line 88 of file stringutil.h.

#define _STRINGUTILDEFAULTTHROWEXCEPTION   false
 

defaultvalues for stringutilthrowexception

See also:
stringutilthrowexception.

Definition at line 91 of file stringutil.h.

#define _STRINGUTILHEXAMARK   'X'
 

specificator for hexadecimal.

Definition at line 104 of file stringutil.h.

#define _STRINGUTILSCAPECHAR   '\\'
 

default scape char specification.

Definition at line 96 of file stringutil.h.

#define _STRINGUTILSTRDELIMITER   '\"'
 

default string delimiter char specification.

Definition at line 94 of file stringutil.h.


Function Documentation

unsigned findstringdelimiterclose ( string const & s,
unsigned pos = 0,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

return the position of string delimiter to close, started in the position pos. case delimiter='\0', force that delimiter is s[pos] otherwise: if s[pos] is not delimiter, assume that first delimiter is to open, and start closer findding. return ~0U if not found. return s.size() if delimiter do not occur in the s (starting the pos) CAUTION: This routine will change in future in way to support C/C++ like cher specification.

istream & getline ( istream & f,
vector< string > & dataline,
char separator = _STRINGUTILCOLUMNSEPARATOR,
char comment = _STRINGUTILCOMMENTCHAR,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR,
char newline = '\0' )
 

vectorized getline get vector <string> (one line separated as colmns) from istream does not used by dataio newline=='\0' is autodetect mode.

istream & getlines ( istream & f,
vector< vector< string > > & datalist,
char separator = _STRINGUTILCOLUMNSEPARATOR,
char comment = _STRINGUTILCOMMENTCHAR,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR,
char newline = '\0' )
 

vectorized getlines newline=='\0' is auto detect mode.

Examples:
samptablewithoutdataio.cpp.

istream & gettextline ( istream & f,
string & line,
char comment = _STRINGUTILCOMMENTCHAR,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR,
char newlinedelimiter = '\0' )
 

getline() that can read text file of ansi, DOS, windows (newline == '\r
'), UNIX (newline=='n') and VAX/VMS (newline=='r') withouth specification. if (newline == '\0'), auto detect new line format. otherwise, work as getline() Unless (newline == EOF), assume end of file if EOF character is found or fisical eof occur It is necessary, because some text editor write EOF character at end of file If (newline == EOF), read EOF char into memory, if found.

\\

bool isextended ( char c ) [inline]
 

Definition at line 141 of file stringutil.h.

Referenced by iswhite().

bool iswhite ( char c ) [inline]
 

white char detection, used by string util and dataio.

Definition at line 153 of file stringutil.h.

bool needdelimiter ( string const & s,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

return true, if string delimiters is required if contain two adjacent iswhite() or string delimiters.

vector< string > & parsestring<string> ( vector< string > & strlist,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

for each element of list, clear extra spaces and parse delimited string.

Referenced by dataio::add(), dataio::addnamed(), dataio::commentclose(), dataio::commentline(), and dataio::linewrap().

string & parsestring ( string & s,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

clear extra spaces and parse delimited string of s the sequence of iswhite() is replaced by single space, except inside of delimited string (inside delimiters, the sequence of two delimiters is assumed one delimiters).

ostream & putline ( ostream & f,
vector< string > & dataline,
char separator = _STRINGUTILCOLUMNSEPARATOR,
char newline = '\0' )
 

put the vector<string> to ostream dataio use it, only if _DATAIODEBUG_ is defined newline=='\0' is system newline.

Examples:
sampbinrec.cpp, samprec.cpp, sampreclist.cpp, and samptablewithoutdataio.cpp.

ostream & putlines ( ostream & f,
vector< vector< string > > & datalist,
char separator = _STRINGUTILCOLUMNSEPARATOR,
char newline = '\0' )
 

vectorized putlines newline=='\0' is system new lines.

vector< string > & reverseparsestring<string> ( vector< string > & strlist,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

for each element of list, convert to delimited string.

string & reverseparsestring ( string & s,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR )
 

translate s to delimited string (is delimiter is found, substitute by double of one).

unsigned stringcasefind ( string const & s1,
string const & s2,
unsigned pos = 0 )
 

case insensive version of string::find().

unsigned stringcasefind_last_of ( string const & s1,
string const & s2,
unsigned pos = 0 )
 

case insensive version of string::find_last_of() does not used by dataio.

bool stringdelimiterbalanced ( string const & s,
char strdelimiter = _STRINGUTILSTRDELIMITER,
char scapechar = _STRINGUTILSCAPECHAR,
unsigned pos1 = 0,
unsigned pos2 = (~0U) )
 

return true, if string delimiter is closed correctly between [pos1, pos2).

bool stringutilprinterror ( bool status )
 

bool stringutilprinterror ( )
 

print error message default value is _STRINGUTILDEFAULTPRINTERROR;

See also:
stringutilthrowexception, _STRINGUTILDEFAULTPRINTERROR.

bool stringutilthrowexception ( bool status )
 

bool stringutilthrowexception ( )
 

throw exception default value is _STRINGUTILDEFAULTTHROWEXCEPTION

See also:
stringutilprinterror, _STRINGUTILDEFAULTPRINTERROR.

char tocntrl ( char c ) [inline]
 

Definition at line 158 of file stringutil.h.

vector< vector< string > > & transpose<vector <string> > ( vector< vector< string > > & data )
 

transpose the vector<vector <string> > data array (replace row and column).

Examples:
samptablewithoutdataio.cpp.


Generated at Thu Sep 6 13:45:43 2001 for dataio by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001