IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.Parser Class Reference

Static Public Member Functions

static int SkipSeparator (string str, int startpos, char separator)
 
static int SkipSpaces (string str, int startpos)
 Returns index of the first non-whitespace character in str from the specified position pos (counted from 0). More...
 
static int ReadInteger (ref int number, string str, int startpos)
 Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number. More...
 
static int ReadInteger (ref int number, string str, int startpos, bool skipspaces)
 Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number. More...
 
static int ReadInteger (ref long number, string str, int startpos, bool skipspaces)
 Reads an integer from a string, starting at a specified position. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number. More...
 
static int ReadNumber (ref double number, string str, int startpos)
 Reads a number from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number. More...
 
static int ReadNumber (ref double number, string str, int startpos, bool skipspaces)
 Reads a number from a string, starting at a specified position. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number. More...
 
static int SkipInteger (string str, int beginpos, bool skipspaces, bool failiffloatingpoint)
 Returns index of the first character in str after the representation of an integer number. More...
 
static int SkipInteger (string str, int beginpos, bool skipspaces)
 Returns index of the first character in str after the representation of an integer number. Leading whitespace characters are ignored, i.e. number is looked for after all space characters. More...
 
static int SkipInteger (string str, int beginpos)
 Returns index of the first character in str after the representation of an integer number. Leading whitespace characters are ignored, i.e. number is looked for after all space characters. More...
 
static int SkipNumber (string str, int beginpos, bool skipspaces)
 Returns index of the first character in str after the representation of a number (either floating point or integer). More...
 
static int SkipNumber (string str, int beginpos)
 Returns index of the first character in str after the representation of a number (either floating point or integer). More...
 
static int SkipToCharacter (string str, int beginpos, char target)
 
static int ReadDoubleList (ref List< double > tab, string str, int startpos, char open, char close, char separator, bool skipspaces)
 Reads a list of numbers of type double from result stirng startng at specified position, and returns position after the list. Numbers must be separated by a specified separator (with spaces allowed between them) and embedded within specified brackets. More...
 
static int ReadDoubleList (ref List< List< double >> tab, string str, int startpos, char open, char close, char separator, bool skipspaces)
 Reads a list of lists of numbers of type double from result stirng startng at specified position, and returns position after the list. Numbers and sub-lists must be separated by a specified separator (with spaces allowed between them) and embedded within specified brackets. More...
 
static string ListToString (List< double > l)
 
static string ListToString (List< List< double >> l)
 
static void Examples ()
 

Private Member Functions

int SkipToBracketLevel (string str, int beginpos, char open, char close, int targetlevel)
 Returns position of the first character that has the specified nesting messagelevel with respect to open and close brackets and the current messagelevel. Nesting messagelevel begins with 0 and is increased with every open bracked and decreased with any closed bracket. More...
 

Static Private Member Functions

static int ReadInteger (ref long number, string str, int startpos)
 Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number. More...
 

Static Private Attributes

static int RetFailed = -1
 

Member Function Documentation

static int IG.Lib.Parser.SkipSeparator ( string  str,
int  startpos,
char  separator 
)
inlinestatic
static int IG.Lib.Parser.SkipSpaces ( string  str,
int  startpos 
)
inlinestatic

Returns index of the first non-whitespace character in str from the specified position pos (counted from 0).

Parameters
strString that is parsed.
startposPosition where search begins (counted from 0).
Returns
Index of the character that stops the search. If string is null or empty or searchstarted after the last character, -1 is returned.

Referenced by IG.Num.Scalar.Parse(), IG.Num.Counter.Parse(), IG.Num.Scalar.TryParse(), and IG.Num.Counter.TryParse().

static int IG.Lib.Parser.ReadInteger ( ref int  number,
string  str,
int  startpos 
)
inlinestatic

Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which the number is searched for.
Returns

Referenced by IG.Num.Counter.Read().

static int IG.Lib.Parser.ReadInteger ( ref int  number,
string  str,
int  startpos,
bool  skipspaces 
)
inlinestatic

Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which the number is searched for.
skipspacesWheather spaces should be skipped.
Returns
static int IG.Lib.Parser.ReadInteger ( ref long  number,
string  str,
int  startpos 
)
inlinestaticprivate

Reads an integer from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read integer (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which the number is searched for.
Returns
static int IG.Lib.Parser.ReadInteger ( ref long  number,
string  str,
int  startpos,
bool  skipspaces 
)
inlinestatic

Reads an integer from a string, starting at a specified position. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which number is searched for.
skipspacesIf true then leading spaces are ignored, otherwise operation fails if there is a whitespace at the starting position.
Returns
static int IG.Lib.Parser.ReadNumber ( ref double  number,
string  str,
int  startpos 
)
inlinestatic

Reads a number from a string, starting at a specified position and skipping eventual leading spaces. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which the number is searched for.
Returns

Referenced by IG.Num.Scalar.Read().

static int IG.Lib.Parser.ReadNumber ( ref double  number,
string  str,
int  startpos,
bool  skipspaces 
)
inlinestatic

Reads a number from a string, starting at a specified position. Returns the position of the first character after the read number (or -1 if reading failed) and outputs the read number.

Parameters
numberOutput parameter returning the number that was read.
strString from which the number is read.
startposStarting position from which number is searched for.
skipspacesIf true then leading spaces are ignored, otherwise operation fails if there is a whitespace at the starting position.
Returns
static int IG.Lib.Parser.SkipInteger ( string  str,
int  beginpos,
bool  skipspaces,
bool  failiffloatingpoint 
)
inlinestatic

Returns index of the first character in str after the representation of an integer number.

Parameters
strString that is parsed.
beginposPosition where search begins (counted from 0).
skipspacesIndicates whether to skip the eventual leading whitespaces.
failiffloatingpointIf true then method fails if there is a floating point number representation. If false then the position of the decimal point is returned.
Returns
Index of the first character in string after the integer number representation (count form 0). -1 is returned if string is empty, if initial position is out of range or if there is no integer number representation at the beginning of the string. if failiffloatingpoint is true then -1 is returned also if there is a floating point number representation.
static int IG.Lib.Parser.SkipInteger ( string  str,
int  beginpos,
bool  skipspaces 
)
inlinestatic

Returns index of the first character in str after the representation of an integer number. Leading whitespace characters are ignored, i.e. number is looked for after all space characters.

Parameters
strString that is parsed.
beginposPosition where search begins (counted from 0).
skipspacesIndicates whether to skip leading spaces.
Returns
Index of the first character in string after the integer number representation (count form 0). -1 is returned if string is empty, if initial position is out of range or if there is no number representation at the beginning of the string, or if there is a floating point number representation.
static int IG.Lib.Parser.SkipInteger ( string  str,
int  beginpos 
)
inlinestatic

Returns index of the first character in str after the representation of an integer number. Leading whitespace characters are ignored, i.e. number is looked for after all space characters.

Parameters
strString that is parsed.
beginposPosition where search begins.
Returns
Index of the first character in string after the integer number representation (count form 0). -1 is returned if string is empty, if initial position is out of range or if there is no number representation at the beginning of the string, or if there is a floating point number representation.
static int IG.Lib.Parser.SkipNumber ( string  str,
int  beginpos,
bool  skipspaces 
)
inlinestatic

Returns index of the first character in str after the representation of a number (either floating point or integer).

Parameters
strString that is parsed.
beginposPosition where search begins (counted from 0).
skipspacesIndicates whether to skip the eventual leading whitespaces.
Returns
Index of the first character in string after the number representation (count form 0). -1 is returned if string is empty, if initial position is out of range or if there is no number representation at the beginning of the string.
static int IG.Lib.Parser.SkipNumber ( string  str,
int  beginpos 
)
inlinestatic

Returns index of the first character in str after the representation of a number (either floating point or integer).

Parameters
strString that is parsed.
beginposPosition where search begins (counted from 0).
Returns
Index of the first character in string after the number representation (count form 0). -1 is returned if string is empty, if initial position is out of range or if there is no number representation at the beginning of the string (after leading spaces).
static int IG.Lib.Parser.SkipToCharacter ( string  str,
int  beginpos,
char  target 
)
inlinestatic
static int IG.Lib.Parser.ReadDoubleList ( ref List< double >  tab,
string  str,
int  startpos,
char  open,
char  close,
char  separator,
bool  skipspaces 
)
inlinestatic

Reads a list of numbers of type double from result stirng startng at specified position, and returns position after the list. Numbers must be separated by a specified separator (with spaces allowed between them) and embedded within specified brackets.

Parameters
tabOutput parameter where read-in list is written.
strString from which the list is read.
startposStarting positio nwhere reading begins.
openOpening bracket of the list.
closeClosing bracket of the list.
separatorSeparator that separates the numbers.
skipspacesIf true then leading spaces are skipped first, otherwise starting position must be exactly at the opening bracket of the list.
Returns
Returns position of the first character after the list.
static int IG.Lib.Parser.ReadDoubleList ( ref List< List< double >>  tab,
string  str,
int  startpos,
char  open,
char  close,
char  separator,
bool  skipspaces 
)
inlinestatic

Reads a list of lists of numbers of type double from result stirng startng at specified position, and returns position after the list. Numbers and sub-lists must be separated by a specified separator (with spaces allowed between them) and embedded within specified brackets.

Parameters
tabOutput parameter where read-in list is written.
strString from which the list is read.
startposStarting positio nwhere reading begins.
openOpening bracket of the list and sub-lists.
closeClosing bracket of the list and sub-lists.
separatorSeparator that separates the numbers and sub-lists.
skipspacesIf true then leading spaces are skipped first, otherwise starting position must be exactly at the opening bracket of the list.
Returns
Returns position of the first character after the list.
int IG.Lib.Parser.SkipToBracketLevel ( string  str,
int  beginpos,
char  open,
char  close,
int  targetlevel 
)
inlineprivate

Returns position of the first character that has the specified nesting messagelevel with respect to open and close brackets and the current messagelevel. Nesting messagelevel begins with 0 and is increased with every open bracked and decreased with any closed bracket.

Parameters
strString that is parsed.
beginposPosition where search begins (counted from 0).
openThe opening bracket.
closeThe closing bracket.
targetlevelLevel that must be reached. Can be either a positive or negative integer. If messagelevel is 0 then initial position is returned.
Returns
Positon of the first character from startpos (inclusively) with a given nesting messagelevel. Returns -1 if such character can not be found, if string is null or empty or if initial position is out of range.
static string IG.Lib.Parser.ListToString ( List< double >  l)
inlinestatic
static string IG.Lib.Parser.ListToString ( List< List< double >>  l)
inlinestatic
static void IG.Lib.Parser.Examples ( )
inlinestatic

Member Data Documentation

int IG.Lib.Parser.RetFailed = -1
staticprivate

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