| IGLib 1.4 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | Private Attributes

# IG::Lib::StringParser Class Reference

Parsig data from character arrays. Provides various parsing and writing utilities on character buffers. $A Igor Feb09;. More...

Inheritance diagram for IG::Lib::StringParser:
[legend]
Collaboration diagram for IG::Lib::StringParser:
[legend]

List of all members.

## Classes
class | LocalizationExample
## Public Member Functions
| StringParser ()
| StringParser (String str)
| StringParser (StringBuilder sb)
void | EnsureCapacity (int capacity)
| Ensures that the buffer has at least the specified capacity.
void | AddEscapeSequence (char code, char character)
| Adds a new escape sequence definition to the parser.
void | RemoveEscapeSequence (char code, char character)
| Removes the specified escape sequence from the parser.
void | AddCharacterReferences (string code, char character)
| Adds a new character reference definition to the parser.
void | RemoveEscapeSequence (string code, char character)
| Removes the specified character reference from the parser.
int | getChar (int from, int to, bool useEscape, ref char value)
| Returns position rightr after the character that resides at position from and the value of that character as output argument. If the character can not be obtained (e.g. because of overflow, etc.), -1 is returned.
int | getPosAfterExponent (int startPos)
bool | isSpace (char c)
| Whether the specified character represents a space for the current parser.
bool | isOpenBracket (char c)
| Whether the specified character represents an open bracket for the current parser.
void | Set (String str)
void | Set (StringBuilder sb)
## Static Public Attributes
static StringParser | _global = null
## Protected Member Functions
void | initEscapeSequences ()
| Initializes data structures used for escape sequences.
void | initCharacterReferences ()
| Initializes data structures used for character references.
int | getCharFromReferenceNoCheck (int from, int to, ref char value)
| Gets a character represented by a character reference at the specified position. If character references are not defined on the current parser. WARNING: Does not check consistency of input parameters!
int | getCharFromEscapeNoCheck (int from, int to, ref char value)
| Gets a character represented by an escape sequence at the specified position. If character references are not defined on the current parser. Does not check input parameters, tries to convert an escape sequence to character even if internal parameters specify that there are no escape sequences. TODO: implement this method!
bool | isCloseBracket (char c)
| Whether the specified character represents a closed bracket for the current parser.
int | bracketIndex (char c)
| Index of the specified character among open or closed brackets, or 0 if the character does not represent neither open nor closed bracket.
## Protected Attributes
ICharacterBuffer | _buffer
int | _pos = 0
List< char > | _spaces
List< char > | _openBrackets
List< char > | _closedBrackets
char | _decimalPoint = '.'
char | _thousandSeparator = ','
List< char > | _exponentChars = null
List< String > | _exponentStrings = null
char | _escapeChar = '\\'
List< KeyValueSortable< char, char > > | _escapeSequences
List< KeyValueSortable< char, char > > | _inverseEscapeSequences
## Properties
ICharacterBuffer | Buffer`[get, set]`
object | Lock`[get]`
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
object | InternalLock`[get]`
| Used internally for locking access to internal fields.
int | Position`[get, set]`
| Current position.
int | Length`[get]`
| Current length of the buffer.
virtual Boolean | UseThousandSeparator`[get, set]`
virtual char | EscapeCharacter`[get, set]`
| Returns the escape character of the current string parser.
bool | UseEscapeSeuences`[get, set]`
| Whether or not escape characters are used. Evaluates to true only if the appropriate flag is set and also any escape seuences are defined (setter just sets the flag). With escape characters, a combination of the escape character and another character substitutes a special character.
bool | UseCharacterReferences`[get, set]`
| Whether or not character references are used. Evaluates to true only if the appropriate flag is set and also any character replacements are defined (setter just sets the flag). With escape characters, a combination of the escape character and another character substitutes a special character.
bool | UseCharacterReplacement`[get]`
static StringParser | Global`[get]`
## Private Attributes
object | _mainLock = new object()
object | _internalLock = new object()
char[] | _expC = { 'e', 'E', 'g', 'G' }
String[] | _expS = {"*10^"}
bool | _useEscapeSequences = false
bool | _useCharacterReferences = false
List< KeyValueSortable< string, char > > | _characterReferences
List< KeyValueSortable< string, char > > | _inverseCharacterReferences

## Detailed Description

Parsig data from character arrays. Provides various parsing and writing utilities on character buffers. $A Igor Feb09;.

## Constructor & Destructor Documentation

IG::Lib::StringParser::StringParser | ( |  | ) | `[inline]`

IG::Lib::StringParser::StringParser | ( | String | str | ) | `[inline]`

IG::Lib::StringParser::StringParser | ( | StringBuilder | sb | ) | `[inline]`

## Member Function Documentation

void IG::Lib::StringParser::EnsureCapacity | ( | int | capacity | ) | `[inline]`

Ensures that the buffer has at least the specified capacity.

Parameters:

  capacity |

void IG::Lib::StringParser::initEscapeSequences | ( |  | ) | `[inline, protected]`

Initializes data structures used for escape sequences.

void IG::Lib::StringParser::AddEscapeSequence | ( | char | code,
|  | char | character
| ) |  | `[inline]`

Adds a new escape sequence definition to the parser.

void IG::Lib::StringParser::RemoveEscapeSequence | ( | char | code,
|  | char | character
| ) |  | `[inline]`

Removes the specified escape sequence from the parser.

void IG::Lib::StringParser::initCharacterReferences | ( |  | ) | `[inline, protected]`

Initializes data structures used for character references.

void IG::Lib::StringParser::AddCharacterReferences | ( | string | code,
|  | char | character
| ) |  | `[inline]`

Adds a new character reference definition to the parser.

void IG::Lib::StringParser::RemoveEscapeSequence | ( | string | code,
|  | char | character
| ) |  | `[inline]`

Removes the specified character reference from the parser.

int IG::Lib::StringParser::getCharFromReferenceNoCheck | ( | int | from,
|  | int | to,
|  | ref char | value
| ) |  | `[inline, protected]`

Gets a character represented by a character reference at the specified position. If character references are not defined on the current parser. WARNING: Does not check consistency of input parameters!

Parameters:

  from | Position at which character reference is obtained.
  to | Last position until which the character reference can last.
  value | Character represented by the character reference.

Returns:
  Position right after the character reference, or -1 if not found.

int IG::Lib::StringParser::getCharFromEscapeNoCheck | ( | int | from,
|  | int | to,
|  | ref char | value
| ) |  | `[inline, protected]`

Gets a character represented by an escape sequence at the specified position. If character references are not defined on the current parser. Does not check input parameters, tries to convert an escape sequence to character even if internal parameters specify that there are no escape sequences. TODO: implement this method!

Parameters:

  from | Position at which character reference is obtained.
  to | Last position until which the character reference can last.
  value | Character represented by the character reference.

Returns:
  Position right after the character reference, or -1 if not found.

int IG::Lib::StringParser::getChar | ( | int | from,
|  | int | to,
|  | bool | useEscape,
|  | ref char | value
| ) |  | `[inline]`

Returns position rightr after the character that resides at position from and the value of that character as output argument. If the character can not be obtained (e.g. because of overflow, etc.), -1 is returned.

Parameters:

  from | Position at which character is seen.
  to | Position until which (inclusively) character is parsed in case that character references or escape sequences are used.
  useEscape | Whether to use character replacement (escape sequences and character references). Whether the flag actually has effect depends also on internal settings of the string parser.
  value | Returns value of the character at the specified position (if a valid value can be obtained).

Returns:
  Position of the first character after the obtained character.

int IG::Lib::StringParser::getPosAfterExponent | ( | int | startPos | ) | `[inline]`

bool IG::Lib::StringParser::isSpace | ( | char | c | ) | `[inline]`

Whether the specified character represents a space for the current parser.

bool IG::Lib::StringParser::isOpenBracket | ( | char | c | ) | `[inline]`

Whether the specified character represents an open bracket for the current parser.

bool IG::Lib::StringParser::isCloseBracket | ( | char | c | ) | `[inline, protected]`

Whether the specified character represents a closed bracket for the current parser.

int IG::Lib::StringParser::bracketIndex | ( | char | c | ) | `[inline, protected]`

Index of the specified character among open or closed brackets, or 0 if the character does not represent neither open nor closed bracket.

void IG::Lib::StringParser::Set | ( | String | str | ) | `[inline]`

void IG::Lib::StringParser::Set | ( | StringBuilder | sb | ) | `[inline]`

## Member Data Documentation

ICharacterBuffer IG::Lib::StringParser::_buffer`[protected]`

int IG::Lib::StringParser::_pos = 0`[protected]`

object IG::Lib::StringParser::_mainLock = new object()`[private]`

object IG::Lib::StringParser::_internalLock = new object()`[private]`

List<char> IG::Lib::StringParser::_spaces`[protected]`

List<char> IG::Lib::StringParser::_openBrackets`[protected]`

List<char> IG::Lib::StringParser::_closedBrackets`[protected]`

char IG::Lib::StringParser::_decimalPoint = '.'`[protected]`

char IG::Lib::StringParser::_thousandSeparator = ','`[protected]`

char [] IG::Lib::StringParser::_expC = { 'e', 'E', 'g', 'G' }`[private]`

String [] IG::Lib::StringParser::_expS = {"*10^"}`[private]`

List<char> IG::Lib::StringParser::_exponentChars = null`[protected]`

List<String> IG::Lib::StringParser::_exponentStrings = null`[protected]`

bool IG::Lib::StringParser::_useEscapeSequences = false`[private]`

bool IG::Lib::StringParser::_useCharacterReferences = false`[private]`

char IG::Lib::StringParser::_escapeChar = '\\'`[protected]`

List<KeyValueSortable<char, char> > IG::Lib::StringParser::_escapeSequences`[protected]`

List<KeyValueSortable<char, char> > IG::Lib::StringParser::_inverseEscapeSequences`[protected]`

List<KeyValueSortable<string, char> > IG::Lib::StringParser::_characterReferences`[private]`

List<KeyValueSortable<string, char> > IG::Lib::StringParser::_inverseCharacterReferences`[private]`

StringParser IG::Lib::StringParser::_global = null`[static]`

## Property Documentation

ICharacterBuffer IG::Lib::StringParser::Buffer`[get, set, protected]`

object IG::Lib::StringParser::Lock`[get]`

This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.

object IG::Lib::StringParser::InternalLock`[get, protected]`

Used internally for locking access to internal fields.

int IG::Lib::StringParser::Position`[get, set]`

Current position.

int IG::Lib::StringParser::Length`[get]`

Current length of the buffer.

virtual Boolean IG::Lib::StringParser::UseThousandSeparator`[get, set]`

virtual char IG::Lib::StringParser::EscapeCharacter`[get, set]`

Returns the escape character of the current string parser.

bool IG::Lib::StringParser::UseEscapeSeuences`[get, set]`

Whether or not escape characters are used. Evaluates to true only if the appropriate flag is set and also any escape seuences are defined (setter just sets the flag). With escape characters, a combination of the escape character and another character substitutes a special character.

bool IG::Lib::StringParser::UseCharacterReferences`[get, set]`

Whether or not character references are used. Evaluates to true only if the appropriate flag is set and also any character replacements are defined (setter just sets the flag). With escape characters, a combination of the escape character and another character substitutes a special character.

bool IG::Lib::StringParser::UseCharacterReplacement`[get]`

StringParser IG::Lib::StringParser::Global`[static, get]`

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

- StringParser.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events