Relacs  0.9.8
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Str Class Reference

#include <str.h>

Inheritance diagram for Str:
Inheritance graph
[legend]
Collaboration diagram for Str:
Collaboration graph
[legend]

Public Member Functions

 Str (void)
 
 Str (const Str &s)
 
 Str (const string &s)
 
 Str (const char *s)
 
 Str (char c)
 
 Str (const string &s, int width, char pad=Pad)
 
 Str (const char *s, int width, char pad=Pad)
 
 Str (char c, int len)
 
 Str (double val, int width=Width, int precision=Precision, char format=DoubleFormat, char pad=Pad)
 
 Str (signed long val, int width=Width, char pad=Pad)
 
 Str (unsigned long val, int width=Width, char pad=Pad)
 
 Str (signed int val, int width=Width, char pad=Pad)
 
 Str (unsigned int val, int width=Width, char pad=Pad)
 
 Str (signed short val, int width=Width, char pad=Pad)
 
 Str (unsigned short val, int width=Width, char pad=Pad)
 
 Str (long long val, int width=Width, char pad=Pad)
 
 Str (bool b, int width=Width, char format=BoolFormat, char pad=Pad)
 
 Str (const string &s, const char *format)
 
 Str (const char *s, const char *format)
 
 Str (char c, const char *format)
 
 Str (double val, const char *format)
 
 Str (signed long val, const char *format)
 
 Str (unsigned long val, const char *format)
 
 Str (signed int val, const char *format)
 
 Str (unsigned int val, const char *format)
 
 Str (signed short val, const char *format)
 
 Str (unsigned short val, const char *format)
 
 Str (long long val, const char *format)
 
 Str (const string &s, const string &format)
 
 Str (const char *s, const string &format)
 
 Str (char c, const string &format)
 
 Str (double val, const string &format)
 
 Str (signed long val, const string &format)
 
 Str (unsigned long val, const string &format)
 
 Str (signed int val, const string &format)
 
 Str (unsigned int val, const string &format)
 
 Str (signed short val, const string &format)
 
 Str (unsigned short val, const string &format)
 
 Str (long long val, const string &format)
 
Stroperator= (const string &s)
 
Stroperator= (const char *s)
 
Stroperator= (char c)
 
const Strassign (const string &s, int width=Width, char pad=Pad)
 
const Strassign (const char *s, int width=Width, char pad=Pad)
 
const Strassign (char c, int len=CharRepeat)
 
const Strassign (double val, int width=Width, int precision=Precision, char format=DoubleFormat, char pad=Pad)
 
const Strassign (signed long val, int width=Width, char pad=Pad)
 
const Strassign (unsigned long val, int width=Width, char pad=Pad)
 
const Strassign (signed int val, int width=Width, char pad=Pad)
 
const Strassign (unsigned int val, int width=Width, char pad=Pad)
 
const Strassign (signed short val, int width=Width, char pad=Pad)
 
const Strassign (unsigned short val, int width=Width, char pad=Pad)
 
const Strassign (long long val, int width=Width, char pad=Pad)
 
const Strassign (bool b, int width=Width, char format=BoolFormat, char pad=Pad)
 
const Strassign (const string &s, const char *format)
 
const Strassign (const char *s, const char *format)
 
const Strassign (char c, const char *format)
 
const Strassign (double val, const char *format)
 
const Strassign (signed long val, const char *format)
 
const Strassign (unsigned long val, const char *format)
 
const Strassign (signed int val, const char *format)
 
const Strassign (unsigned int val, const char *format)
 
const Strassign (signed short val, const char *format)
 
const Strassign (unsigned short val, const char *format)
 
const Strassign (long long val, const char *format)
 
const Strassign (const string &s, const string &format)
 
const Strassign (const char *s, const string &format)
 
const Strassign (char c, const string &format)
 
const Strassign (double val, const string &format)
 
const Strassign (signed long val, const string &format)
 
const Strassign (unsigned long val, const string &format)
 
const Strassign (signed int val, const string &format)
 
const Strassign (unsigned int val, const string &format)
 
const Strassign (signed short val, const string &format)
 
const Strassign (unsigned short val, const string &format)
 
const Strassign (long long val, const string &format)
 
const Strappend (const string &s, int width=Width, char pad=Pad)
 
const Strappend (const char *s, int width=Width, char pad=Pad)
 
const Strappend (char c, int len=CharRepeat)
 
const Strappend (double val, int width=Width, int precision=Precision, char format=DoubleFormat, char pad=Pad)
 
const Strappend (signed long val, int width=Width, char pad=Pad)
 
const Strappend (unsigned long val, int width=Width, char pad=Pad)
 
const Strappend (signed int val, int width=Width, char pad=Pad)
 
const Strappend (unsigned int val, int width=Width, char pad=Pad)
 
const Strappend (signed short val, int width=Width, char pad=Pad)
 
const Strappend (unsigned short val, int width=Width, char pad=Pad)
 
const Strappend (long long val, int width=Width, char pad=Pad)
 
const Strappend (bool b, int width=Width, char format=BoolFormat, char pad=Pad)
 
const Strappend (const string &s, const char *format)
 
const Strappend (const char *s, const char *format)
 
const Strappend (char c, const char *format)
 
const Strappend (double val, const char *format)
 
const Strappend (signed long val, const char *format)
 
const Strappend (unsigned long val, const char *format)
 
const Strappend (signed int val, const char *format)
 
const Strappend (unsigned int val, const char *format)
 
const Strappend (signed short val, const char *format)
 
const Strappend (unsigned short val, const char *format)
 
const Strappend (long long val, const char *format)
 
const Strappend (const string &s, const string &format)
 
const Strappend (const char *s, const string &format)
 
const Strappend (char c, const string &format)
 
const Strappend (double val, const string &format)
 
const Strappend (signed long val, const string &format)
 
const Strappend (unsigned long val, const string &format)
 
const Strappend (signed int val, const string &format)
 
const Strappend (unsigned int val, const string &format)
 
const Strappend (signed short val, const string &format)
 
const Strappend (unsigned short val, const string &format)
 
const Strappend (long long val, const string &format)
 
int size (void) const
 
int readFormat (int pos, int &width, int &precision, char &type, char &pad)
 
int formatWidth (int pos=0) const
 
int totalWidth (void) const
 
int format (const string &s, char type='s', int pos=0)
 
int format (const char *s, char type='s', int pos=0)
 
int format (char c, char type='c', int pos=0)
 
int format (double number, char type, char ftype=' ', int pos=0)
 
int format (double number, const string &type="fge", const string &ftype="", int pos=0)
 
int format (long number, char type='d', char ftype=' ', int pos=0)
 
int format (signed int number, char type='d', char ftype=' ', int pos=0)
 
int format (unsigned int number, char type='u', char ftype=' ', int pos=0)
 
int format (signed short number, char type='d', char ftype=' ', int pos=0)
 
int format (unsigned short number, char type='u', char ftype=' ', int pos=0)
 
Strformat (int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0)
 
Strformat (const struct tm *time)
 
double number (double dflt=0.0, int index=0, int *next=0, const string &space=Space) const
 
double number (double &error, double dflt=0.0, int index=0, int *next=0, const string &space=Space) const
 
double number (double &error, string &unit, double dflt=0.0, int index=0, int *next=0, const string &space=Space) const
 
double error (double dflt=0.0, int index=0, int *next=0, const string &space=Space) const
 
Str unit (const string &dflt="", int index=0, int *next=0, const string &space=Space) const
 
Str ident (int index=0, const string &a=":=", const string &space=Space) const
 
Str value (int index=0, const string &a=":=", const string &space=Space) const
 
int date (int &year, int &month, int &day) const
 
int time (int &hour, int &minutes, int &seconds, int &milliseconds) const
 
int time (int &hour, int &minutes, int &seconds) const
 
int ident (const string &search, const string &space=Space) const
 
int value (const string &search, const string &space=Space) const
 
Str text (const string &search, const string &dflt, const string &space=Space) const
 
double number (const string &search, double dflt=0.0, const string &space=Space) const
 
double error (const string &search, double dflt=0.0, const string &space=Space) const
 
Str unit (const string &search, const string &dflt="", const string &space=Space) const
 
void range (vector< int > &ri, const string &sep=",", const string &r="..") const
 
void range (vector< double > &rd, const string &sep=",", const string &r="..") const
 
int find (const string &s, int index=0, bool cs=true, int word=0, const string &space=Space) const
 
int find (const char *s, int index=0, bool cs=true, int word=0, const string &space=Space) const
 
int find (char c, int index=0, bool cs=true, int word=0, const string &space=Space) const
 
int rfind (const string &s, int index=-2, bool cs=true, int word=0, const string &space=Space) const
 
int rfind (const char *s, int index=-2, bool cs=true, int word=0, const string &space=Space) const
 
int rfind (char c, int index=-2, bool cs=true, int word=0, const string &space=Space) const
 
int findFirst (const string &s, int index=0) const
 
int findFirst (const char *s, int index=0) const
 
int findFirst (char c, int index=0) const
 
int findFirstNot (const string &s, int index=0) const
 
int findFirstNot (const char *s, int index=0) const
 
int findFirstNot (char c, int index=0) const
 
int findLast (const string &s, int index=-2) const
 
int findLast (const char *s, int index=-2) const
 
int findLast (char c, int index=-2) const
 
int findLastNot (const string &s, int index=-2) const
 
int findLastNot (const char *s, int index=-2) const
 
int findLastNot (char c, int index=-2) const
 
int contains (const string &s, int index=0, bool cs=true, int word=0, const string &space=Space, const string &comment=Comment) const
 
int contains (const char *s, int index=0, bool cs=true, int word=0, const string &space=Space, const string &comment=Comment) const
 
int contains (char ch, int index=0, bool cs=true, int word=0, const string &space=Space, const string &comment=Comment) const
 
int findBracket (int index=0, const string &brackets=Bracket, const string &comment=Comment) const
 
StrstripBracket (const string &brackets=Bracket, const string &comment=Comment)
 
Str strippedBracket (const string &brackets=Bracket, const string &comment=Comment) const
 
Strtruncate (int len)
 
Strresize (int len)
 
Strresize (int len, char ch)
 
Str left (int len) const
 
Str right (int len) const
 
Str mid (int pos, int upto=-1) const
 
Str substr (int pos, int len=-1) const
 
Strerase (int pos, int n=-1)
 
int erase (const string &s)
 
Str erased (const string &s) const
 
int erase (const string &s, int index, bool cs=true, int word=0, const string &space=Space)
 
bool eraseFirst (const string &s)
 
Str erasedFirst (const string &s) const
 
bool eraseFirst (const string &s, int index, bool cs=true, int word=0, const string &space=Space)
 
Strreplace (int pos, int n, const string &rs)
 
int replace (const string &s, const string &rs)
 
int replace (const string &s, const string &rs, int index, bool cs=true, int word=0, const string &space=Space)
 
Str replaced (const string &s, const string &rs) const
 
int eraseMarkup (void)
 
Str erasedMarkup (void) const
 
StrpreventFirst (char c)
 
Str preventedFirst (char c) const
 
StrpreventFirst (const char *s)
 
Str preventedFirst (const char *s) const
 
StrpreventFirst (const string &s)
 
Str preventedFirst (const string &s) const
 
StrpreventLast (char c)
 
Str preventedLast (char c) const
 
StrpreventLast (const char *s)
 
Str preventedLast (const char *s) const
 
StrpreventLast (const string &s)
 
Str preventedLast (const string &s) const
 
StrprovideFirst (char c)
 
Str providedFirst (char c) const
 
StrprovideFirst (const char *s)
 
Str providedFirst (const char *s) const
 
StrprovideFirst (const string &s)
 
Str providedFirst (const string &s) const
 
StrprovideLast (char c)
 
Str providedLast (char c) const
 
StrprovideLast (const char *s)
 
Str providedLast (const char *s) const
 
StrprovideLast (const string &s)
 
Str providedLast (const string &s) const
 
Strupper (void)
 
Str up (void) const
 
Strlower (void)
 
Str low (void) const
 
StrleftJustify (int width=Width, char pad=Pad)
 
Str leftJustified (int width=Width, char pad=Pad) const
 
StrrightJustify (int width=Width, char pad=Pad)
 
Str rightJustified (int width=Width, char pad=Pad) const
 
StrcenterJustify (int width=Width, char pad=Pad)
 
Str centerJustified (int width=Width, char pad=Pad) const
 
StrgoldenJustify (int width=Width, char pad=Pad)
 
Str goldenJustified (int width=Width, char pad=Pad) const
 
bool empty (const string &space=Space, const string &comment=Comment) const
 
Strstrip (const string &space=Space, const string &comment=Comment)
 
Strstrip (char space, const string &comment=Comment)
 
Str stripped (const string &space=Space, const string &comment=Comment) const
 
Str stripped (char space, const string &comment=Comment) const
 
Strsimplify (const string &space=Space, const string &comment=Comment)
 
Strsimplify (char space, const string &comment=Comment)
 
Str simplified (const string &space=Space, const string &comment=Comment) const
 
Str simplified (char space, const string &comment=Comment) const
 
StrstripComment (const string &comment=Comment)
 
Str strippedComment (const string &comment=Comment) const
 
int first (const string &space=Space) const
 
int nextWord (int &index, const string &space=Space, const string &comment=Comment) const
 
Str wordAt (int &index, const string &space=Space, const string &comment=Comment) const
 
Str word (int n, const string &space=Space, const string &comment=Comment) const
 
int words (const string &space=Space, const string &comment=Comment) const
 
int nextField (int &index, const string &space=Space, const string &comment=Comment) const
 
int findSeparator (int index=0, const string &separator=Separator, const string &brackets=Bracket, const string &comment=Comment) const
 
Str field (int n, const string &separator=Separator, const string &brackets=Bracket, const string &comment=Comment) const
 
StrstripWorkingPath (int maxlevel=10, char dirsep=DirSep)
 
Str dir (char dirsep=DirSep) const
 
Str notdir (char dirsep=DirSep) const
 
Str name (char dirsep=DirSep, char extsep=ExtSep) const
 
Str longName (char dirsep=DirSep, char extsep=ExtSep) const
 
Str extension (char dirsep=DirSep, char extsep=ExtSep) const
 
Str suffix (char dirsep=DirSep, char extsep=ExtSep) const
 
Str basename (char dirsep=DirSep, char extsep=ExtSep) const
 
StrstripDir (char dirsep=DirSep)
 
StrstripNotdir (char dirsep=DirSep)
 
StrstripExtension (char dirsep=DirSep, char extsep=ExtSep)
 
StrstripSuffix (char dirsep=DirSep, char extsep=ExtSep)
 
StrstripBasename (char dirsep=DirSep, char extsep=ExtSep)
 
StrpreventSlash (char dirsep=DirSep)
 
Str preventedSlash (char dirsep=DirSep) const
 
StrprovideSlash (char dirsep=DirSep)
 
Str providedSlash (char dirsep=DirSep) const
 
StrpreventPeriod (char extsep=ExtSep)
 
Str preventedPeriod (char extsep=ExtSep) const
 
StrprovidePeriod (char extsep=ExtSep)
 
Str providedPeriod (char extsep=ExtSep) const
 
StrexpandHome (char dirsep=DirSep, char homechr=HomeChr)
 
Str expandedHome (char dirsep=DirSep, char homechr=HomeChr) const
 
StrremoveWorking (char dirsep=DirSep)
 
Str removedWorking (char dirsep=DirSep) const
 
StraddWorking (const string &dir="", char dirsep=DirSep)
 
Str addedWorking (const string &dir="", char dirsep=DirSep) const
 
StrexpandParent (char dirsep=DirSep)
 
Str expandedParent (char dirsep=DirSep) const
 
StrexpandPath (const string &dir="", char dirsep=DirSep, char homechr=HomeChr)
 
Str expandedPath (const string &dir="", char dirsep=DirSep, char homechr=HomeChr) const
 
StraddExtension (const string &extension, char extsep=ExtSep)
 
Str addedExtension (const string &extension, char extsep=ExtSep) const
 
StrprovideExtension (const string &extension, char dirsep=DirSep, char extsep=ExtSep)
 
Str providedExtension (const string &extension, char dirsep=DirSep, char extsep=ExtSep) const
 
Strenvironment (const string &env)
 
Str latex (void) const
 
Str latexNum (void) const
 
Str latexUnit (void) const
 
Str html (void) const
 
Str htmlUnit (void) const
 

Static Public Member Functions

static const string & bracket (void)
 
static void setBracket (const string &bracket)
 
static const string & space (void)
 
static void setSpace (const string &space)
 
static string comment (void)
 
static void setComment (const string &comment)
 
static const string & separator (void)
 
static void setSeparator (const string &separator)
 
static char dirSep (void)
 
static void setDirSep (char dirsep)
 
static char extSep (void)
 
static void setExtSep (char extsep)
 
static char homeChr (void)
 
static void setHomeChr (char homechr)
 
static string & homeEnv (void)
 
static void setHomeEnv (const string &homeenv)
 
static Str homePath (char dirsep=DirSep)
 
static string & workingEnv (void)
 
static void setWorkingEnv (const string &workingenv)
 
static Str workingPath (char dirsep=DirSep)
 
static Str getEnvironment (const string &env)
 
static int width (void)
 
static void setWidth (int width)
 
static int precision (void)
 
static void setPrecision (int precision)
 
static int repeats (void)
 
static void setRepeats (int repeats)
 
static char doubleFormat (void)
 
static void setDoubleFormat (char format)
 
static char boolFormat (void)
 
static void setBoolFormat (char format)
 
static char pad (void)
 
static void setPad (char pad)
 
static void setDefault (void)
 

Static Public Attributes

static const Str WhiteSpace = " \t\n\r\v\f"
 
static const Str DoubleWhiteSpace = " \t\n\r\v\f"
 
static const Str BlankSpace = " \t"
 
static const Str DoubleBlankSpace = " \t"
 
static const Str WordSpace = " \t\n\r\v\f`'\",.:;?!"
 
static const Str DoubleWordSpace = " \t\n\r\v\f`'\",.:;?!"
 
static const Str FirstNumber = "0123456789+-"
 
static const Str Number = "0123456789.+-eE"
 
static const Str Digit = "0123456789"
 
static const Str LeftBracket = "([{<`"
 
static const Str RightBracket = ")]}>'"
 

Detailed Description

Advanced string manipulation.

Author
Jan Benda
Version
1.0
Bug:
check all find, find_first_of, etc for usage with empty search strings!!!
Todo:

Str( long, width, pad ), format( long ): missing type flag (u,d,x,...)

generalize the double blank concept for spaces and separators to any character.

Do we need each function with comments? Cant we just use stripComment before?

Constructor & Destructor Documentation

Str ( void  )

Constructs an empty string.

Referenced by Str::find(), Str::format(), Str::getEnvironment(), and Str::rfind().

Str ( const Str s)

Constructs a copy of s.

Str ( const string &  s)

Constructs a copy of s.

Str ( const char *  s)

Constructs a copy of s.

Str ( char  c)

Constructs a string containing the single character c.

Str ( const string &  s,
int  width,
char  pad = Pad 
)

Constructs a string of size width containing a copy of s. If width is positive, s is right justified, otherwise s is left justified. pad is used as the character that is filled in. If s is longer than width, it is truncated. If width equals zero, the whole string s is copied tothis.

Str ( const char *  s,
int  width,
char  pad = Pad 
)

Constructs a string of size width containing a copy of s. If width is positive, s is right justified, otherwise s is left justified. pad is used as the character that is filled in. If s is longer than width, it is truncated. If width equals zero, the whole string s is copied tothis.

Str ( char  c,
int  len 
)

Constructs a string containing len copies of c.

Str ( double  val,
int  width = Width,
int  precision = Precision,
char  format = DoubleFormat,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( signed long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( unsigned long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( signed int  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( unsigned int  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( signed short  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( unsigned short  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( long long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width. If width is positive, the number is right justified, otherwise the number is left justified.

Str ( bool  b,
int  width = Width,
char  format = BoolFormat,
char  pad = Pad 
)

Convert b into a string of size width. Depending on format the resulting string is true or false (format equals t or f), yes or no (format equals y or n) 1 or 0 (otherwise). If width is positive, the resulting string is right justified, otherwise the resulting string is left justified.

Str ( const string &  s,
const char *  format 
)

Constructs a string containing s according to the C-printf-style format string format.

Str ( const char *  s,
const char *  format 
)

Constructs a string containing s according to the C-printf-style format string format.

Str ( char  c,
const char *  format 
)

Constructs a string containing c according to the C-printf-style format string format.

Str ( double  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed long  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned long  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed int  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned int  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed short  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned short  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( long long  val,
const char *  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( const string &  s,
const string &  format 
)

Constructs a string containing s according to the C-printf-style format string format.

Str ( const char *  s,
const string &  format 
)

Constructs a string containing s according to the C-printf-style format string format.

Str ( char  c,
const string &  format 
)

Constructs a string containing c according to the C-printf-style format string format.

Str ( double  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed long  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned long  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed int  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned int  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( signed short  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( unsigned short  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Str ( long long  val,
const string &  format 
)

Converts val to this string according to the C-printf-style format string format.

Member Function Documentation

Str & operator= ( const string &  s)

Assign s to this.

Str & operator= ( const char *  s)

Assign s to this.

Str & operator= ( char  c)

Assign c to this.

const Str & assign ( const string &  s,
int  width = Width,
char  pad = Pad 
)

Assigns a string of size width containing a copy of s. If width is positive, s is right justified, otherwise s is left justified. pad is used as the character that is filled in. If s is longer than width, it is truncated. If width equals zero, the whole string s is copied tothis.

const Str & assign ( const char *  s,
int  width = Width,
char  pad = Pad 
)

Assigns a string of size width containing a copy of s. If width is positive, s is right justified, otherwise s is left justified. pad is used as the character that is filled in. If s is longer than width, it is truncated. If width equals zero, the whole string s is copied tothis.

const Str & assign ( char  c,
int  len = CharRepeat 
)

Assigns a string containing len copies of c.

const Str & assign ( double  val,
int  width = Width,
int  precision = Precision,
char  format = DoubleFormat,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( signed long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( unsigned long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( signed int  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( unsigned int  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( signed short  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( unsigned short  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( long long  val,
int  width = Width,
char  pad = Pad 
)

Convert val into a string of size width and assign it to this. If width is positive, the number is right justified, otherwise the number is left justified.

const Str & assign ( bool  b,
int  width = Width,
char  format = BoolFormat,
char  pad = Pad 
)

Convert b into a string of size width and assign it to this. Depending on format the resulting string is true or false (format equals t or f), yes or no (format equals y or n) 1 or 0 (otherwise). If width is positive, the resulting string is right justified, otherwise the resulting string is left justified.

const Str & assign ( const string &  s,
const char *  format 
)

Assigns a string containing s according to the C-printf-style format string format to this.

const Str & assign ( const char *  s,
const char *  format 
)

Assigns a string containing s according to the C-printf-style format string format to this.

const Str & assign ( char  c,
const char *  format 
)

Assigns a string containing c according to the C-printf-style format string format to this.

const Str & assign ( double  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed long  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned long  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed int  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned int  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed short  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned short  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( long long  val,
const char *  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( const string &  s,
const string &  format 
)

Assigns a string containing s according to the C-printf-style format string format to this.

const Str & assign ( const char *  s,
const string &  format 
)

Assigns a string containing s according to the C-printf-style format string format to this.

const Str & assign ( char  c,
const string &  format 
)

Assigns a string containing c according to the C-printf-style format string format to this.

const Str & assign ( double  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed long  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned long  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed int  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned int  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( signed short  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( unsigned short  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & assign ( long long  val,
const string &  format 
)

Converts val to a string according to the C-printf-style format string format and assign it to this.

const Str & append ( const string &  s,
int  width = Width,
char  pad = Pad 
)
const Str & append ( const char *  s,
int  width = Width,
char  pad = Pad 
)
const Str & append ( char  c,
int  len = CharRepeat 
)
const Str & append ( double  val,
int  width = Width,
int  precision = Precision,
char  format = DoubleFormat,
char  pad = Pad 
)
const Str & append ( signed long  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( unsigned long  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( signed int  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( unsigned int  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( signed short  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( unsigned short  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( long long  val,
int  width = Width,
char  pad = Pad 
)
const Str & append ( bool  b,
int  width = Width,
char  format = BoolFormat,
char  pad = Pad 
)
const Str & append ( const string &  s,
const char *  format 
)
const Str& append ( const char *  s,
const char *  format 
)
inline
const Str& append ( char  c,
const char *  format 
)
inline
const Str& append ( double  val,
const char *  format 
)
inline
const Str& append ( signed long  val,
const char *  format 
)
inline
const Str& append ( unsigned long  val,
const char *  format 
)
inline
const Str& append ( signed int  val,
const char *  format 
)
inline
const Str& append ( unsigned int  val,
const char *  format 
)
inline
const Str& append ( signed short  val,
const char *  format 
)
inline
const Str& append ( unsigned short  val,
const char *  format 
)
inline
const Str& append ( long long  val,
const char *  format 
)
inline
const Str & append ( const string &  s,
const string &  format 
)
const Str& append ( const char *  s,
const string &  format 
)
inline
const Str& append ( char  c,
const string &  format 
)
inline
const Str& append ( double  val,
const string &  format 
)
inline
const Str& append ( signed long  val,
const string &  format 
)
inline
const Str& append ( unsigned long  val,
const string &  format 
)
inline
const Str& append ( signed int  val,
const string &  format 
)
inline
const Str& append ( unsigned int  val,
const string &  format 
)
inline
const Str& append ( signed short  val,
const string &  format 
)
inline
const Str& append ( unsigned short  val,
const string &  format 
)
inline
const Str& append ( long long  val,
const string &  format 
)
inline
int size ( void  ) const
inline
int readFormat ( int  pos,
int &  width,
int &  precision,
char &  type,
char &  pad 
)

Analyse the format string beginning at pos and returns the specified width width, precision precision, the format type type, and the padding character pad. The index behind the last read character is returned.

References Str::left(), Str::pad(), Str::size(), and Str::width().

Referenced by Str::format(), and DoubleSpinBox::setFormat().

int formatWidth ( int  pos = 0) const

Returns the width specified by the ANSI-C like format string where pos points to.

References Str::size().

int totalWidth ( void  ) const

Returns the width of the string taking expanded ANSI-C like format strings into account.

References Str::width().

Referenced by Parameter::formatWidth().

int format ( const string &  s,
char  type = 's',
int  pos = 0 
)

Replaces the first format specifier with type type by the formatted string s. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( s, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

Referenced by Parameter::defaultText(), Options::format(), Str::format(), SaveFiles::pathName(), RePro::reproTimeStr(), Options::save(), Session::sessionTimeStr(), RELACSPlugin::sessionTimeStr(), SaveFiles::setPathTemplate(), Parameter::testActivation(), and Parameter::text().

int format ( const char *  s,
char  type = 's',
int  pos = 0 
)

Replaces the first format specifier with type type by the formatted string s. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( s, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

int format ( char  c,
char  type = 'c',
int  pos = 0 
)

Replaces the first format specifier with type type by the character c. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( c, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

int format ( double  number,
char  type,
char  ftype = ' ',
int  pos = 0 
)

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

int format ( double  number,
const string &  type = "fge",
const string &  ftype = "",
int  pos = 0 
)

Replaces the first format specifier with type equal to one of the charactert of type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

int format ( long  number,
char  type = 'd',
char  ftype = ' ',
int  pos = 0 
)

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.

References Str::readFormat(), Str::size(), and Str::Str().

int format ( signed int  number,
char  type = 'd',
char  ftype = ' ',
int  pos = 0 
)
inline

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.
int format ( unsigned int  number,
char  type = 'u',
char  ftype = ' ',
int  pos = 0 
)
inline

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.
int format ( signed short  number,
char  type = 'd',
char  ftype = ' ',
int  pos = 0 
)
inline

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.
int format ( unsigned short  number,
char  type = 'u',
char  ftype = ' ',
int  pos = 0 
)
inline

Replaces the first format specifier with type type by the formatted number number using type ftype. Returns the position of the character following the replacement. If nothing was replaced, pos is returned.

Warning
format() does not return the formatted string! Use the constructor Str( number, formatstring ) instead.
Str & format ( int  year,
int  month,
int  day,
int  hour = 0,
int  minute = 0,
int  second = 0,
int  millisecond = 0 
)

Format the string using the time given by year, month, day, hour, minute, second, millisecond. The following format specifiers are recognized: Z: millisecond (0..999) S: second (0..59) M: minute (0..59) H: hour (0..23) d: day of month (1..31) m: month (1..12) y: last two digits of year (0..99) Y: year (1970...) Width and padding character may also be specified, e.g. %02d produces 01, 02, 03, ... 10, 11, ... 31.

References Str::readFormat(), Str::size(), and Str::Str().

Str & format ( const struct tm *  time)

Format the string using the time given by time. See format( int year, int month, int day, int hour, int minute, int second, int millisecond ) for details.

References Str::format().

double number ( double  dflt = 0.0,
int  index = 0,
int *  next = 0,
const string &  space = Space 
) const

Returns the value of the first number in the string. The number may be preceeded by white space and a single opening bracket. If there is no number or an error occured during conversion, dflt is returned and next is set to index. Search for a number is started at the index -th character. The index of the character following the number is retuned in next if next is not 0.

References Str::Digit, Str::find(), Str::findFirst(), Str::findFirstNot(), Str::FirstNumber, Str::LeftBracket, Str::mid(), and Str::size().

Referenced by Parameter::addActivation(), Parameter::addDefaultNumber(), Parameter::addNumber(), Parameter::changeUnit(), FilterDetectors::createTracesEvents(), DeviceList< T, PluginID >::device(), Str::error(), Macro::expandParameter(), MacroCommand::MacroCommand(), AudioMonitor::notify(), Str::number(), Str::range(), DataFile::scanDataLine(), and relacs::translate().

double number ( double &  error,
double  dflt = 0.0,
int  index = 0,
int *  next = 0,
const string &  space = Space 
) const

Returns the value of the first number in the string. The number may be preceeded by white space and a single opening bracket. In error the error value following the number is returned. error is only set at success. If there is no number or an error occured during conversion, dflt is returned and next is set to index. Search for a number is started at the index -th character. The index of the character following the number is retuned in next if next is not 0.

References Str::Digit, Str::find(), Str::findFirst(), Str::findFirstNot(), Str::FirstNumber, Str::LeftBracket, Str::mid(), Str::size(), and Str::value().

double number ( double &  error,
string &  unit,
double  dflt = 0.0,
int  index = 0,
int *  next = 0,
const string &  space = Space 
) const

Returns the value of the first number in the string. The number may be preceeded by white space and a single opening bracket. In error the error value following the number is returned. In unit the unit string following the number (and error value) is returned. error and unit are only set at success. If there is no number or an error occured during conversion, dflt is returned and next is set to index. Search for a number is started at the index -th character. The index of the character following the number is retuned in next if next is not 0.

References Str::Digit, Str::find(), Str::findFirst(), Str::findFirstNot(), Str::FirstNumber, Str::LeftBracket, Str::mid(), Str::RightBracket, Str::size(), Str::substr(), and Str::value().

double error ( double  dflt = 0.0,
int  index = 0,
int *  next = 0,
const string &  space = Space 
) const

Returns the value of error following the first number in the string. The number and its error are separated by '+/-' or '+-'. The number may be preceeded by white space and a single opening bracket. If there is no error value or an error occured during conversion, dflt is returned and next is set to index. Search for a number is started at the index -th character. The index of the character following the error is retuned in next if next is not 0.

References Str::Digit, Str::find(), Str::findFirst(), Str::mid(), Str::number(), and Str::size().

Referenced by Str::error(), and Str::unit().

Str unit ( const string &  dflt = "",
int  index = 0,
int *  next = 0,
const string &  space = Space 
) const

Returns the unit following the first number in the string. The number and its possible error value error are separated by '+/-' or '+-'. The number may NOT be preceeded by any non-numerical characters. If the string does not start directly with a number, it is treated as a unit. If there is no unit string, dflt is returned and next is set to index. Search for a number is started at the index -th character. The index of the character following the unit is retuned in next if next is not 0.

References Str::Digit, Str::error(), Str::find(), Str::findFirst(), Str::findFirstNot(), Str::FirstNumber, Str::LeftBracket, Str::mid(), Str::RightBracket, Str::size(), and Str::substr().

Referenced by Parameter::addActivation(), Parameter::changeUnit(), Str::unit(), and Options::unit().

Str ident ( int  index = 0,
const string &  a = ":=",
const string &  space = Space 
) const

Returns the stripped() string befor the first occurence of one of the characters specified in a after position index.

References Str::findFirst(), Str::findFirstNot(), Str::findLastNot(), Str::size(), and Str::substr().

Referenced by FilterDetectors::filter(), FilterDetectors::init(), Parameter::read(), and Str::value().

Str value ( int  index = 0,
const string &  a = ":=",
const string &  space = Space 
) const

Returns the stripped() string right behind the first occurence of one of the characters specified in a after position index.

References Str::findFirst(), Str::findFirstNot(), Str::findLastNot(), and Str::substr().

Referenced by Str::error(), Str::number(), Parameter::read(), Str::text(), and Str::unit().

int date ( int &  year,
int &  month,
int &  day 
) const

Reads the year, month, and day of a date string. The string should be formatted as "YYYY-MM-DD", "MM/DD/YYYY" or "MMM DD, YYYY"

Returns
0 on success
-1 the string is not a date
-2 invalid year
-4 invalid month
-8 invalid day

Referenced by Parameter::assign(), Parameter::setDate(), and Parameter::setDefaultDate().

int time ( int &  hour,
int &  minutes,
int &  seconds,
int &  milliseconds 
) const

Reads the hour, minutes, seconds, and milliseconds of a time string. The string should be formatted as "HH:MM:SS.UU".

Returns
0 on success
-1 the string is not a time
-2 invalid hour
-4 invalid minutes
-8 invalid seconds
-16 invalid milliseconds

Referenced by Parameter::assign(), Parameter::setDefaultTime(), Parameter::setTime(), and Str::time().

int time ( int &  hour,
int &  minutes,
int &  seconds 
) const

Reads the hour, minutes, and seconds of a time string. The string should be formatted as "HH:MM:SS.UU".

Returns
0 on success
-1 the string is not a time
-2 invalid hour
-4 invalid minutes
-8 invalid seconds

References Str::time().

int ident ( const string &  search,
const string &  space = Space 
) const

Searches for the string search. Returns index to the found search string or -1 if it wasn't found. Additional control characters in the search string are supportet (they can be combined): ^aaa: search is case sensitive, !aaa: aaa has to be the beginning of a word, !!aaa: aaa is the first text appearing in the string, aaa!: aaa has to be the end of a word, !aaa!: aaa has to be a word.

References Str::find(), Str::first(), relacs::line(), SampleData< T >::size(), and Str::word().

int value ( const string &  search,
const string &  space = Space 
) const

Searches for the string search. Returns an index to the text following the first ':' or '=' after the found search string or -1 if search wasn't found. Additional control characters in the search string are supportet (they can be combined): ^aaa: search is case sensitive, !aaa: aaa has to be the beginning of a word, !!aaa: aaa is the first text appearing in the string, aaa!: aaa has to be the end of a word, !aaa!: aaa has to be a word.

References Str::findFirst(), Str::findFirstNot(), and Str::ident().

Str text ( const string &  search,
const string &  dflt = "",
const string &  space = Space 
) const

Returns the text following the first ':' or '=' after the found search string search or dflt if search wasn't found or there isn't any number. ident() is used for searching.

References Str::findFirst(), Str::size(), Str::substr(), and Str::value().

Referenced by Options::text(), and relacs::translate().

double number ( const string &  search,
double  dflt = 0.0,
const string &  space = Space 
) const

Returns the value of the number following the first ':' or '=' after the found search string search or dflt if search wasn't found or there isn't any number. ident() is used for searching.

References Str::number(), and Str::value().

double error ( const string &  search,
double  dflt = 0.0,
const string &  space = Space 
) const

Returns the error of the number following the first ':' or '=' after the found search string search or dflt if search wasn't found or there isn't any error. ident() is used for searching.

References Str::error(), and Str::value().

Str unit ( const string &  search,
const string &  dflt = "",
const string &  space = Space 
) const

Returns the unit of the number following the first ':' or '=' after the found search string search or dflt if search wasn't found or there isn't any number. ident() is used for searching.

References Str::unit(), and Str::value().

void range ( vector< int > &  ri,
const string &  sep = ",",
const string &  r = ".." 
) const

Extracts a list of integer numbers from the content of the string. Individual numbers are separated by sep, ranges of numbers are indicated by r. Example: "1,-3,6..8,10,20..32..3" results in 1,-3,6,7,8,10,20,23,26,29,32

References Str::number(), Str::space(), and Str::substr().

void range ( vector< double > &  rd,
const string &  sep = ",",
const string &  r = ".." 
) const

Extracts a list of floating point numbers from the content of the string. Individual numbers are separated by sep, ranges of numbers are indicated by r. Example: "1.2,-3,6.5..8,10,20..32..3" results in 1.2,-3,6.5,7.5,10,20,23,26,29,32

References Str::BlankSpace, Str::number(), Str::space(), and Str::substr().

int find ( const string &  s,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int find ( const char *  s,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int find ( char  c,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int rfind ( const string &  s,
int  index = -2,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int rfind ( const char *  s,
int  index = -2,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int rfind ( char  c,
int  index = -2,
bool  cs = true,
int  word = 0,
const string &  space = Space 
) const
int findFirst ( const string &  s,
int  index = 0 
) const
int findFirst ( const char *  s,
int  index = 0 
) const
int findFirst ( char  c,
int  index = 0 
) const
int findFirstNot ( const string &  s,
int  index = 0 
) const
int findFirstNot ( const char *  s,
int  index = 0 
) const

References Str::size().

int findFirstNot ( char  c,
int  index = 0 
) const
int findLast ( const string &  s,
int  index = -2 
) const

References Str::size().

int findLast ( const char *  s,
int  index = -2 
) const

References Str::size().

int findLast ( char  c,
int  index = -2 
) const

References Str::size().

int findLastNot ( const string &  s,
int  index = -2 
) const
int findLastNot ( const char *  s,
int  index = -2 
) const

References Str::size().

int findLastNot ( char  c,
int  index = -2 
) const

References Str::size().

int contains ( const string &  s,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space,
const string &  comment = Comment 
) const

References Str::find(), and Str::size().

int contains ( const char *  s,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space,
const string &  comment = Comment 
) const

References Str::find(), and Str::size().

int contains ( char  ch,
int  index = 0,
bool  cs = true,
int  word = 0,
const string &  space = Space,
const string &  comment = Comment 
) const

References Str::find(), and Str::size().

static const string& bracket ( void  )
inlinestatic
static void setBracket ( const string &  bracket)
inlinestatic
int findBracket ( int  index = 0,
const string &  brackets = Bracket,
const string &  comment = Comment 
) const

Find corresponding closing bracket for the one at position index. The opening brackets are the ones contained in brackets. The corresponding closing brackets are retrieved from RightBracket using LeftBracket. If the opening bracket is not contained in LeftBracket, the closing bracket is assumed to be the same as the opening bracket.

Returns
the index of the closing bracket, or -1 if not found.
See Also
stripBracket(), strippedBracket()

References Str::find(), Str::findFirst(), Str::LeftBracket, Str::RightBracket, and Str::size().

Referenced by Macro::check(), MacroCommand::execute(), Str::findSeparator(), Str::stripBracket(), and relacs::translate().

Str & stripBracket ( const string &  brackets = Bracket,
const string &  comment = Comment 
)

Remove everything from the string except the characters between the first opening bracket from brackets and the corresponding closing bracket.

See Also
findBracket(), strippedBracket()

References Str::find(), Str::findBracket(), Str::findFirst(), and Str::size().

Referenced by Str::strippedBracket().

Str strippedBracket ( const string &  brackets = Bracket,
const string &  comment = Comment 
) const

Returns the string between the first opening bracket from brackets and the corresponding closing bracket.

See Also
findBracket(), stripBracket()

References Str::stripBracket().

Str& truncate ( int  len)
inline
Str& resize ( int  len)
inline
Str& resize ( int  len,
char  ch 
)
inline
Str left ( int  len) const
Returns
the first len characters of the string or the complete string if len < 0 .
See Also
right(), mid(), substr()

Referenced by Str::readFormat(), and RePro::reproPath().

Str right ( int  len) const
Returns
the last len characters of the string or the complete string if len < 0 .
See Also
left(), mid(), substr()

References Str::size().

Str mid ( int  pos,
int  upto = -1 
) const
Returns
the characters between index pos and index upto inclusively. upto is set to the index of the last character in the string if upto < 0. If pos < 0, or pos is larger than size() or pos > upto an empty string is returned.
See Also
left(), right(), substr()

References Str::size().

Referenced by MacroCommand::addMenu(), StrQueue::append(), Macro::check(), Str::error(), Options::load(), Str::number(), Parameter::Parameter(), Options::read(), DataFile::splitLine(), Str::unit(), and Str::wordAt().

Str substr ( int  pos,
int  len = -1 
) const
Returns
the len characters starting at index pos. If len < 0 all characters up to the end of the string are returned. If pos < 0, or pos is larger than size() an empty string is returned.
See Also
left(), right(), mid()

References Str::size().

Referenced by MacroCommand::acceptDialog(), Str::addedExtension(), MacroCommand::addMenu(), DataFile::dataLine(), MacroCommand::execute(), Macro::expandParameter(), Str::field(), Str::ident(), Macro::Macro(), MacroCommand::MacroCommand(), DataFile::metaLine(), Str::number(), Str::range(), ConfigureClasses::read(), Str::strippedComment(), Str::text(), relacs::translate(), Str::unit(), Str::value(), and Str::word().

Str & erase ( int  pos,
int  n = -1 
)

Erase substring at pos with length n. If pos < 0, nothing is erased. If len < 0 (default), all characters from index pos to the end of the string are erased.

References Str::size().

Referenced by MacroCommand::addMenu(), Str::erased(), Str::erasedFirst(), Str::erasedMarkup(), Str::eraseMarkup(), Macro::expandParameter(), Macros::load(), MacroFileReader::load(), Options::load(), Macro::Macro(), MacroCommand::MacroCommand(), Parameter::Parameter(), Options::read(), and Str::stripWorkingPath().

int erase ( const string &  s)

Remove all sequences in the string which equal s. Returns the number of removed sequences.

Str erased ( const string &  s) const

Returns the string with all sequences which equal s removed.

References Str::erase().

int erase ( const string &  s,
int  index,
bool  cs = true,
int  word = 0,
const string &  space = Space 
)

Remove all sequences in the string which equal s. Finding the sequences is started at index index. It is case sensitive if cs equals true. If bit one in word is set s has to be preceeded by at least one character given in space. If bit two in word is set s has to be succeeded by at least one character given in space. Returns the number of removed sequences.

References Str::find().

bool eraseFirst ( const string &  s)

Remove s from the string if it is found at the beginning. Returns true if s was removed from the string.

Referenced by DataOverviewModel::data(), MacroCommand::MacroCommand(), and SaveFiles::writeStimulus().

Str erasedFirst ( const string &  s) const

Returns the string with s removed it s was found at the beginning of the string.

References Str::erase().

bool eraseFirst ( const string &  s,
int  index,
bool  cs = true,
int  word = 0,
const string &  space = Space 
)

Remove s from the string if s is found at the position of the first character not in space. Finding s is started at index index. It is case sensitive if cs equals true. If bit two in word is set s has to be succeeded by at least one character given in space. Returns true if s was found and removed.

References Str::find(), and Str::findFirstNot().

Str& replace ( int  pos,
int  n,
const string &  rs 
)
inline

Replace substring at pos with length n by rs.

Referenced by Macro::check(), Str::erasedMarkup(), Str::eraseMarkup(), MacroCommand::execute(), Str::replaced(), and Parameter::text().

int replace ( const string &  s,
const string &  rs 
)

Replace all sequences in the string which equal s by rs. Returns the number of replaced sequences.

References Str::size().

int replace ( const string &  s,
const string &  rs,
int  index,
bool  cs = true,
int  word = 0,
const string &  space = Space 
)

Replace all sequences in the string which equal s by rs. Finding the sequences is started at index index. It is case sensitive if cs equals true. If bit one in word is set s has to be preceeded by at least one character given in space. If bit two in word is set s has to be succeeded by at least one character given in space. Returns the number of replaced sequences.

References Str::find(), and Str::size().

Str replaced ( const string &  s,
const string &  rs 
) const

Returns the string with all sequences which equal s replaced by rs.

References Str::replace(), and Str::size().

int eraseMarkup ( void  )

Removes all markup sequences in the string. That is everything inside sharp braces "<>".

Warning
This is not yet properly implemented. Currently only , , and
are removed.

References Str::erase(), and Str::replace().

Referenced by MacroCommand::addMenu(), MacroCommand::execute(), RELACSPlugin::info(), RePros::message(), Macros::warning(), and RELACSPlugin::warning().

Str erasedMarkup ( void  ) const

Retruns the string with all markup sequences removed. That is everything inside sharp braces "<>".

Warning
This is not yet properly implemented. Currently only , , and
are removed.

References Str::erase(), and Str::replace().

Referenced by RELACSWidget::RELACSWidget(), RELACSWidget::startFirstAcquisition(), and RELACSWidget::updateData().

Str & preventFirst ( char  c)

Remove the first character of the string if it equals c.

References Str::size().

Referenced by Parameter::addDefaultText(), Parameter::addText(), Options::load(), Options::read(), Parameter::selectText(), and SaveFiles::writeStimulus().

Str preventedFirst ( char  c) const

Returns the string with its first character removed if it equals c.

References Str::size().

Str & preventFirst ( const char *  s)

Remove the initial part of the string if it equals s.

Str preventedFirst ( const char *  s) const

Returns the string with its initial part removed if it equals s.

References Str::size().

Str & preventFirst ( const string &  s)

Remove the initial part of the string if it equals s.

References Str::size().

Str preventedFirst ( const string &  s) const

Returns the string with its initial part removed if it equals s.

References Str::size().

Str & preventLast ( char  c)

Remove the last character of the string if it equals c.

References Str::size().

Referenced by Parameter::addDefaultText(), Parameter::addText(), Macro::expandParameter(), Options::load(), Options::read(), and Parameter::selectText().

Str preventedLast ( char  c) const

Returns the string with its last character removed if it equals c.

References Str::size().

Referenced by MacroCommand::addMenu().

Str & preventLast ( const char *  s)

Remove the end of the string if it equals s.

References Str::size().

Str preventedLast ( const char *  s) const

Returns the string with its end removed if it equals s.

References Str::size().

Str & preventLast ( const string &  s)

Remove the end of the string if it equals s.

References Str::size().

Str preventedLast ( const string &  s) const

Returns the string with its end removed if it equals s.

References Str::size().

Str & provideFirst ( char  c)

Insert c at the beginning of the string if the strings first character does not equal c.

References Str::size().

Str providedFirst ( char  c) const

Returns the string with c inserted at the beginning if the strings first character does not equal c.

References Str::size().

Str & provideFirst ( const char *  s)

Insert s at the beginning of the string if the strings first characters do not equal s.

References Str::size().

Str providedFirst ( const char *  s) const

Returns the string with s inserted at the beginning if the strings first characters do not equal s.

References Str::size().

Str & provideFirst ( const string &  s)

Insert s at the beginning of the string if the strings first characters do not equal s.

References Str::size().

Str providedFirst ( const string &  s) const

Returns the string with s inserted at the beginning if the strings first characters do not equal s.

References Str::size().

Str & provideLast ( char  c)

Add c to the string if the strings last character does not equal c.

References Str::size().

Referenced by MacroCommand::addParameter(), and Str::provideSlash().

Str providedLast ( char  c) const

Returns the string with c added if the strings last character does not equal c.

References Str::size().

Referenced by Str::providedSlash().

Str & provideLast ( const char *  s)

Add s to the string if the strings last characters do not equal s.

References Str::size().

Str providedLast ( const char *  s) const

Returns the string with s added if the strings last characters do not equal s.

References Str::size().

Str & provideLast ( const string &  s)

Add s to the string if the strings last characters do not equal s.

References Str::size().

Str providedLast ( const string &  s) const

Returns the string with s added if the strings last characters do not equal s.

References Str::size().

Str & upper ( void  )

Referenced by SaveFiles::pathName().

Str up ( void  ) const

References Str::append().

Referenced by Parameter::save().

Str & lower ( void  )
Str low ( void  ) const

References Str::append().

Referenced by OptWidget::tabLabel().

Str & leftJustify ( int  width = Width,
char  pad = Pad 
)

justify:

References relacs::abs(), Str::size(), and Str::strip().

Str leftJustified ( int  width = Width,
char  pad = Pad 
) const
inline

References relacs::abs().

Str & rightJustify ( int  width = Width,
char  pad = Pad 
)
Str rightJustified ( int  width = Width,
char  pad = Pad 
) const
inline

References relacs::abs().

Str & centerJustify ( int  width = Width,
char  pad = Pad 
)
Str centerJustified ( int  width = Width,
char  pad = Pad 
) const

References relacs::abs(), and Str::stripped().

Str & goldenJustify ( int  width = Width,
char  pad = Pad 
)
Str goldenJustified ( int  width = Width,
char  pad = Pad 
) const

References relacs::abs(), and Str::stripped().

static const string& space ( void  )
inlinestatic
static void setSpace ( const string &  space)
inlinestatic
static string comment ( void  )
inlinestatic
static void setComment ( const string &  comment)
inlinestatic
bool empty ( const string &  space = Space,
const string &  comment = Comment 
) const

References Str::find(), and Str::findFirstNot().

Referenced by MacroCommand::acceptDialog(), Options::addBoolean(), Options::addDate(), Parameter::addDefaultNumber(), Options::addFlags(), Options::addInteger(), MacroCommand::addMenu(), Parameter::addNumber(), Options::addNumber(), MacroCommand::addParameter(), Options::addStyle(), Options::addText(), Options::addTime(), Options::allText(), Options::assign(), Parameter::assign(), Options::boolean(), Options::booleans(), Options::changed(), Options::changeUnit(), Macros::check(), Parameter::clear(), Options::clearFlags(), DeviceList< T, PluginID >::create(), Options::date(), Options::defaultBoolean(), Options::defaultDate(), Options::defaultInteger(), Options::defaultNumber(), Parameter::defaultText(), Options::defaultText(), Options::defaultTime(), Options::delFlags(), Options::delStyle(), Parameter::empty(), DataFile::emptyLine(), Options::error(), Options::errors(), MacroCommand::execute(), Str::expandedHome(), Str::expandHome(), Options::flags(), Options::format(), Options::formatWidth(), Str::homePath(), Options::index(), Options::insertBoolean(), Options::insertDate(), Options::insertInteger(), Options::insertNumber(), Options::insertText(), Options::insertTime(), Options::integer(), Options::integers(), Macros::load(), Macro::load(), MacroFileReader::load(), Options::load(), Options::maximum(), Options::minimum(), Options::newSection(), Options::number(), Options::numbers(), Plugins::openPath(), Options::outUnit(), Parameter::Parameter(), Str::providedSlash(), Str::provideSlash(), Options::pushInteger(), Options::pushNumber(), Options::pushText(), ConfigureClasses::read(), Options::read(), Options::readAppend(), RELACSWidget::RELACSWidget(), Options::request(), TableKey::save(), TableKey::saveData(), TableKey::saveKeyHTML(), TableKey::saveKeyLaTeX(), Options::selectText(), Options::setBoolean(), Options::setCurrentDate(), Options::setCurrentTime(), Options::setDate(), Options::setDefault(), Options::setDefaultBoolean(), Options::setDefaultDate(), Options::setDefaultInteger(), Options::setDefaultNumber(), Options::setDefaultText(), Options::setDefaultTime(), Options::setFlags(), Options::setFormat(), Options::setInteger(), Options::setMinMax(), Options::setNumber(), Options::setOutUnit(), Options::setRequest(), Options::setStep(), Options::setStyle(), Options::setText(), Options::setTime(), Options::setToDefault(), Options::setUnit(), Options::setValueType(), Options::size(), RELACSWidget::startFirstAcquisition(), Options::step(), Str::stripWorkingPath(), Options::style(), Parameter::text(), Options::text(), Options::texts(), Options::time(), relacs::translate(), Options::unit(), RELACSWidget::updateData(), Options::valueType(), Macros::warning(), and SaveFiles::writeStimulus().

Str & strip ( const string &  space = Space,
const string &  comment = Comment 
)
Str & strip ( char  space,
const string &  comment = Comment 
)

References Str::size().

Str stripped ( const string &  space = Space,
const string &  comment = Comment 
) const
Str stripped ( char  space,
const string &  comment = Comment 
) const

References Str::size().

Str & simplify ( const string &  space = Space,
const string &  comment = Comment 
)

References Str::size(), and Str::strip().

Str & simplify ( char  space,
const string &  comment = Comment 
)
Str simplified ( const string &  space = Space,
const string &  comment = Comment 
) const
Str simplified ( char  space,
const string &  comment = Comment 
) const
Str & stripComment ( const string &  comment = Comment)

Removes comments from the string. If comment is set to 'XXX' everything behind 'XXX' inclusively is erased from the string. If comment is set to '-XXX' everything before 'XXX' inclusively is erased from the string.

Referenced by Options::load(), and Options::read().

Str strippedComment ( const string &  comment = Comment) const

Returns the string with comments removed. If comment is set to 'XXX' everything behind 'XXX' inclusively is erased from the string. If comment is set to '-XXX' everything before 'XXX' inclusively is erased from the string.

References Str::substr().

int first ( const string &  space = Space) const
inline
int nextWord ( int &  index,
const string &  space = Space,
const string &  comment = Comment 
) const

Returns the index of the next word following position index. In index the position of the first character following the word is returned. Words are separated by arbitrary many characters specified in space.

References Str::find(), Str::findFirst(), Str::findFirstNot(), and Str::size().

Referenced by DataFile::scanDataLine(), DataFile::splitLine(), Str::word(), Str::wordAt(), and Str::words().

Str wordAt ( int &  index,
const string &  space = Space,
const string &  comment = Comment 
) const

Returns the word following position index. In index the position of the first character following the word is returned. Words are separated by arbitrary many characters specified in space.

References Str::mid(), and Str::nextWord().

Referenced by TableKey::loadKey().

Str word ( int  n,
const string &  space = Space,
const string &  comment = Comment 
) const

References Str::nextWord(), and Str::substr().

Referenced by Str::ident().

int words ( const string &  space = Space,
const string &  comment = Comment 
) const

Returns the number of words contained in the string separated by space before a comment comment.

References Str::nextWord().

Referenced by DataFile::scanDataLine().

int nextField ( int &  index,
const string &  space = Space,
const string &  comment = Comment 
) const

Returns the index of the next field following position index. In index the position of the first character of the following field is returned. Fields are separated by single characters specified in space.

References Str::find(), Str::findFirst(), and Str::size().

Referenced by StrQueue::append().

static const string& separator ( void  )
inlinestatic
static void setSeparator ( const string &  separator)
inlinestatic
int findSeparator ( int  index = 0,
const string &  separator = Separator,
const string &  brackets = Bracket,
const string &  comment = Comment 
) const

Find first separator following position index.

References Str::findBracket(), Str::findFirst(), Str::findFirstNot(), and Str::size().

Referenced by StrQueue::append(), Str::field(), Options::load(), and Options::read().

Str field ( int  n,
const string &  separator = Separator,
const string &  brackets = Bracket,
const string &  comment = Comment 
) const
static char dirSep ( void  )
inlinestatic

The character which is used to separate directories in a file name. By default it is a slash '/'.

static void setDirSep ( char  dirsep)
inlinestatic

Set the character which is used to separate directories in a file name to dirsep.

static char extSep ( void  )
inlinestatic

The character which is used to separate the extension of a file name. By default it is a period.

static void setExtSep ( char  extsep)
inlinestatic

Set the character which is used to separate the extension of a file name to extsep.

static char homeChr ( void  )
inlinestatic

The character which specifies the home directoy of a file name. By default it is a tilde.

static void setHomeChr ( char  homechr)
inlinestatic

Set the character which specifies the home directory of a file name to homechr.

static string& homeEnv ( void  )
inlinestatic

The environment variable which specifies the home directoy. By default it is "HOME".

static void setHomeEnv ( const string &  homeenv)
inlinestatic

Set the name of the environment variable which specifies the home directory to homeenv.

Str homePath ( char  dirsep = DirSep)
static

The home directory with a slash(dirsep) at the end. It is the path specified by the environment variable specified by HomeEnv. If this environment variable does not exist, dirsep (a slash) is returned.

References Str::empty(), Str::getEnvironment(), and Str::provideSlash().

static string& workingEnv ( void  )
inlinestatic

The environment variable which specifies the current working directoy. By default it is "PWD".

static void setWorkingEnv ( const string &  workingenv)
inlinestatic

Set the name of the environment variable which specifies the current working directory to home.

Str workingPath ( char  dirsep = DirSep)
static

The current working directory with a slash(dirsep) at the end. It is the path specified by the environment variable specified by WorkingEnv. If this environment variable does not exist, an empty string is returned.

References Str::getEnvironment(), and Str::provideSlash().

Referenced by Str::addedWorking(), Str::addWorking(), and Str::stripWorkingPath().

Str & stripWorkingPath ( int  maxlevel = 10,
char  dirsep = DirSep 
)

If the string contains an absolute path (beginning with dirsep) then convert the path to a path relative to the current working directory. Only do this for at maximum maxlevel levels below the current working directory.

References Str::empty(), Str::erase(), Str::find(), Str::rfind(), Str::size(), and Str::workingPath().

Referenced by OptWidgetText::doBrowse().

Str dir ( char  dirsep = DirSep) const

Returns the directory part of a file name. This is everything upto and including the last character dirsep (defaults to a slash) found in the string. If no dirsep is found, an empty string is returned. For example: If the string is example/data.txt.gz, example/ is returned.

Referenced by Str::addedWorking(), Str::addWorking(), OptWidgetText::browse(), DataOverviewModel::data(), Parameter::defaultText(), MacroCommand::execute(), DataIndex::DataItem::loadCell(), Plugins::openPath(), and Parameter::text().

Str notdir ( char  dirsep = DirSep) const

Returns everything except the directory part of a file name. This is everything behind the last character dirsep (defaults to a slash) found in the string. If no dirsep is found, the whole string is returned. For example: If the string is example/data.txt.gz, data.txt.gz is returned.

Referenced by Parameter::defaultText(), MacroCommand::execute(), Plugins::openPath(), and Parameter::text().

Str name ( char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Returns everything except the directory part and all extensions of a file name. This is everything behind the last character dirsep (defaults to a slash) found in the string and before the following first character extsep (defaults to a period). For example: If the string is example/data.txt.gz, data is returned.

Referenced by AudioMonitor::AudioMonitor(), Macros::check(), SaveFiles::ODMLFiles::close(), DataOverviewModel::data(), DataDescriptionModel::data(), Parameter::defaultText(), Options::nameWidth(), SaveFiles::ODMLFiles::open(), SaveFiles::save(), Parameter::text(), MetaData::update(), and SaveFiles::writeStimulus().

Str longName ( char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Returns everything except the directory part and the last extension of a file name. This is everything behind the last character dirsep (defaults to a slash) found in the string and before the last character extsep (defaults to a period). For example: If the string is example/data.txt.gz, data.txt is returned.

Str extension ( char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Returns all extensions of a file name including their period. For example: If the string is example/data.txt.gz, .txt.gz is returned.

Referenced by Str::addedExtension(), Parameter::defaultText(), OutData::load(), Plugins::openPath(), Str::providedExtension(), Str::provideExtension(), and Parameter::text().

Str suffix ( char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Returns the last extension of a file name including its period. For example: If the string is example/data.txt.gz, .gz is returned.

Str basename ( char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Returns everything exept of all extensions of a file name. For example: If the string is example/data.txt.gz, example/data is returned.

Str & stripDir ( char  dirsep = DirSep)

Remove the directory part of a file name. This is everything upto and including the last character dirsep (defaults to a slash) found in the string. If no dirsep is found, nothing is done. For example: If the string is example/data.txt.gz, data.txt.gz remains.

Str & stripNotdir ( char  dirsep = DirSep)

Removes everything except the directory part of a file name. This is everything behind the last character dirsep (defaults to a slash) found in the string. If no dirsep is found, the string is cleared. For example: If the string is example/data.txt.gz, example/ remains.

Referenced by Str::expandedHome(), and Str::expandHome().

Str & stripExtension ( char  dirsep = DirSep,
char  extsep = ExtSep 
)

Remove all extensions of a file name including their period. For example: If the string is example/data.txt.gz, example/data remains.

Str & stripSuffix ( char  dirsep = DirSep,
char  extsep = ExtSep 
)

Remove the last extension of a file name including its period. For example: If the string is example/data.txt.gz, example/data.txt remains.

Str & stripBasename ( char  dirsep = DirSep,
char  extsep = ExtSep 
)

Removes everything exept of all extensions of a file name. For example: If the string is example/data.txt.gz, .txt.gz remains.

Str& preventSlash ( char  dirsep = DirSep)
inline

Remove the last character of the string if it equals dirsep (defaults to a slash).

Referenced by OptWidgetText::browse(), Str::expandedHome(), Str::expandHome(), and RELACSWidget::RELACSWidget().

Str preventedSlash ( char  dirsep = DirSep) const
inline

Returns the string with its last character removed if it equals dirsep (defaults to a slash).

Referenced by SaveFiles::ODMLFiles::close(), DataOverviewModel::data(), SaveFiles::ODMLFiles::open(), and SaveFiles::save().

Str & provideSlash ( char  dirsep = DirSep)

Add dirsep to the string if its last character does not equal dirsep (defaults to a slash) and the string is not empty.

References Str::empty(), and Str::provideLast().

Referenced by Str::addedWorking(), Str::addWorking(), OptWidgetText::doBrowse(), Str::homePath(), Settings::notify(), RePro::reproPath(), and Str::workingPath().

Str providedSlash ( char  dirsep = DirSep) const

Returns the string with dirsep added if its last character does not equal dirsep (defaults to a slash) and the string is not empty.

References Str::empty(), and Str::providedLast().

Str& preventPeriod ( char  extsep = ExtSep)
inline

Remove the last character of the string if it equals extsep (defaults to a period).

Str preventedPeriod ( char  extsep = ExtSep) const
inline

Returns the string with its last character removed if it equals extsep (defaults to a period).

Str& providePeriod ( char  extsep = ExtSep)
inline

Add extsep to the string if its last character does not equal extsep (defaults to a period).

Referenced by Str::addExtension(), and Plugins::openPath().

Str providedPeriod ( char  extsep = ExtSep) const
inline

Returns the string with extsep added if its last character does not equal extsep (defaults to a period).

Referenced by Str::addedExtension().

Str & expandHome ( char  dirsep = DirSep,
char  homechr = HomeChr 
)

Expands a leading homechr (defaults to a tilde) to the home directoy which is obtained from the environment variable HOME. The default for homechr can be changed by setHomeChr(), the name of the environment variable used to get the home directory can be changed by setHome().

References Str::empty(), Str::getEnvironment(), Str::preventSlash(), Str::size(), and Str::stripNotdir().

Referenced by Str::expandPath().

Str expandedHome ( char  dirsep = DirSep,
char  homechr = HomeChr 
) const

Returns the string with a leading homechr (defaults to a tilde) expanded to the home directoy which is obtained from the environment variable HOME. The default for homechr can be changed by setHomeChr(), the name of the environment variable used to get the home directory can be changed by setHome().

References Str::empty(), Str::getEnvironment(), Str::preventSlash(), Str::size(), and Str::stripNotdir().

Referenced by Str::expandedPath().

Str & removeWorking ( char  dirsep = DirSep)

Remove all '.' directories from the string.

References Str::size().

Referenced by Str::expandedPath(), and Str::expandPath().

Str removedWorking ( char  dirsep = DirSep) const

Return the string with all '.' directories removed.

References Str::size().

Str & addWorking ( const string &  dir = "",
char  dirsep = DirSep 
)

Prepends the directory dir to the string if it does not begin with a slash (dirsep). It is ensured that between the current content of the Str and dir there is slash (dirsep). If dir is not specified, then the current working directory is obtained from the environment variable specified by setWorkingEnv(), which defaults to PWD.

References Str::dir(), Str::provideSlash(), Str::size(), and Str::workingPath().

Referenced by OptWidgetText::browse(), Str::expandedPath(), and Str::expandPath().

Str addedWorking ( const string &  dir = "",
char  dirsep = DirSep 
) const

Return the string with the directory dir prepended if it does not begin with a slash (dirsep). It is ensured that between the current content of the Str and dir there is slash (dirsep). If dir is not specified, then the current working directory is obtained from the environment variable specified by setWorkingEnv(), which defaults to PWD.

References Str::append(), Str::dir(), Str::provideSlash(), Str::size(), and Str::workingPath().

Str & expandParent ( char  dirsep = DirSep)

Expand all '..' directories in the string.

References Str::resize(), and Str::size().

Referenced by Str::expandedPath(), and Str::expandPath().

Str expandedParent ( char  dirsep = DirSep) const

Return the string with all '..' directories expanded.

References Str::size().

Str & expandPath ( const string &  dir = "",
char  dirsep = DirSep,
char  homechr = HomeChr 
)

Expands the string to a complete file name. All special characters (~, ./, and /..) are processed. First a leading tilde (homechr) is expanded to the current home directory (see expandHome() for details. Then all references to the current directory ("./") are removed from the string (see removeWorking() for details). If the string does not begin with a slash (dirsep) dir is prepended to the string. If dir is empty, the current working directory is used (see addWorking() for details). Finally all "/.." are expanded (see expandParent() for details.

References Str::addWorking(), Str::expandHome(), Str::expandParent(), and Str::removeWorking().

Referenced by MacroCommand::execute().

Str expandedPath ( const string &  dir = "",
char  dirsep = DirSep,
char  homechr = HomeChr 
) const

Returns the string expanded to a complete file name. All special characters (~, ./, and /..) are processed. First a leading tilde (homechr) is expanded to the current home directory (see expandHome() for details. Then all references to the current directory ("./") are removed from the string (see removeWorking() for details). If the string does not begin with a slash (dirsep) dir is prepended to the string. If dir is empty, the current working directory is used (see addWorking() for details). Finally all "/.." are expanded (see expandParent() for details.

References Str::addWorking(), Str::expandedHome(), Str::expandParent(), and Str::removeWorking().

Referenced by MetaData::update().

Str & addExtension ( const string &  extension,
char  extsep = ExtSep 
)

Add the extension extension to the string. A period (extsep) is inserted if necessary.

References Str::providePeriod().

Referenced by Str::provideExtension().

Str addedExtension ( const string &  extension,
char  extsep = ExtSep 
) const

Return the string with the extension extension added. A period (extsep) is inserted if necessary.

References Str::extension(), Str::providedPeriod(), and Str::substr().

Referenced by Str::providedExtension().

Str & provideExtension ( const string &  extension,
char  dirsep = DirSep,
char  extsep = ExtSep 
)

Add the extension extension to the string provided there is no extension. A period (extsep) is inserted if necessary.

References Str::addExtension(), Str::extension(), and Str::size().

Str providedExtension ( const string &  extension,
char  dirsep = DirSep,
char  extsep = ExtSep 
) const

Return the string with the extension extension added provided there is no extension. A period (extsep) is inserted if necessary.

References Str::addedExtension(), Str::extension(), and Str::size().

Str getEnvironment ( const string &  env)
static

Returns the content of the environment variable specified by env. If the environment variable env does not exist, an empty string is returned.

References Str::Str().

Referenced by Str::expandedHome(), Str::expandHome(), Str::homePath(), and Str::workingPath().

Str & environment ( const string &  env)

Set the string to the content of the environment variable specified by env. If the environment variable env does not exist, the string is emptied.

Str latex ( void  ) const

References Str::append().

Referenced by TableKey::saveKeyLaTeX().

Str latexNum ( void  ) const

References Str::append().

Str latexUnit ( void  ) const

References Str::append().

Str html ( void  ) const
Str htmlUnit ( void  ) const
static int width ( void  )
inlinestatic

Referenced by Str::readFormat(), and Str::totalWidth().

static void setWidth ( int  width)
inlinestatic
static int precision ( void  )
inlinestatic
static void setPrecision ( int  precision)
inlinestatic
static int repeats ( void  )
inlinestatic
static void setRepeats ( int  repeats)
inlinestatic
static char doubleFormat ( void  )
inlinestatic
static void setDoubleFormat ( char  format)
inlinestatic
static char boolFormat ( void  )
inlinestatic
static void setBoolFormat ( char  format)
inlinestatic
static char pad ( void  )
inlinestatic

Referenced by Str::readFormat().

static void setPad ( char  pad)
inlinestatic
void setDefault ( void  )
static

Referenced by Options::setDefaults().

Member Data Documentation

const Str WhiteSpace = " \t\n\r\v\f"
static
const Str DoubleWhiteSpace = " \t\n\r\v\f"
static
const Str BlankSpace = " \t"
static

Referenced by Str::range().

const Str DoubleBlankSpace = " \t"
static
const Str WordSpace = " \t\n\r\v\f`'\",.:;?!"
static

Referenced by Macro::Macro().

const Str DoubleWordSpace = " \t\n\r\v\f`'\",.:;?!"
static
const Str FirstNumber = "0123456789+-"
static
const Str Number = "0123456789.+-eE"
static
const Str Digit = "0123456789"
static
const Str LeftBracket = "([{<`"
static
const Str RightBracket = ")]}>'"
static

The documentation for this class was generated from the following files: