C++ IP API  9.5.7
TCP & UDP for virtual user scripts
Facilita::Extractor Class Reference

A means to search and extract information from a string. More...

Inheritance diagram for Facilita::Extractor:
Collaboration diagram for Facilita::Extractor:

Public Methods

 Extractor ()
 
 Extractor (const string &data)
 
 Extractor (const string &path, int dummy)
 
 Extractor (const Extractor &other)
 
virtual ~Extractor ()
 
void advanceRewind ()
 
const string & data () const
 
string extract (ExtractionCursor &cursor, const string &before, const string &after, const string &defaultValue, bool caseSensitive=true)
 Extract a sub-string. More...
 
string extract (ExtractionCursor &cursor, const StringVector &before, const string &after, const string &defaultValue, bool caseSensitive=true)
 Extract a string after a list strings. More...
 
string extract (ExtractionCursor &cursor, const StringVector &before, const string &after, bool caseSensitive=true)
 Extract a string after a list strings. More...
 
string extract (ExtractionCursor &cursor, const string &before, const string &after, bool caseSensitive=true)
 Extract a string between two others. More...
 
string extractFromEnd (ExtractionCursor &cursor, const string &after, const string &before, const string &defaultValue, bool caseSensitive=true)
 
string extractFromEnd (ExtractionCursor &cursor, const StringVector &after, const string &before, const string &defaultValue, bool caseSensitive=true)
 
string extractFromEnd (ExtractionCursor &cursor, const StringVector &after, const string &before, bool caseSensitive=true)
 
string extractFromEnd (ExtractionCursor &cursor, const string &after, const string &before, bool caseSensitive=true)
 
virtual StringVector extractList (const string &before, const string &after, bool caseSensitive=true, int maxItems=-1)
 
virtual StringVector extractList (ExtractionCursor &cursor, const string &before, const string &after, const string &endAt="", bool caseSensitive=true, int maxItems=-1)
 
RegExpMatchList extractRegExp (ExtractionCursor &cursor, const string &regExp, bool caseSensitive=true)
 Extract a RegexMatchList. More...
 
string extractRegExp (ExtractionCursor &cursor, const string &beforeRegExp, const string &afterRegExp, bool caseSensitive=true)
 
string extractRegExpFromEnd (ExtractionCursor &cursor, const string &afterRegExp, const string &beforeRegExp, bool caseSensitive=true)
 
bool find (ExtractionCursor &cursor, const string &text, bool caseSensitive=true)
 Find a string searching forwards. More...
 
bool findPtr (int startPos, const StringVector &before, const char *pAfterString, bool casesensitive, char **pMatchedString, int &matchedStringPos, int &matchedStringlength)
 
int findString (int startPos, const string &str, bool caseSensitive=true)
 
int findString (int startPos, const char *pBeforeString, bool casesensitive)
 
int findStringCheck (int startPos, const char *str, const char checkChar)
 
int findStringCheckIc (int startPos, const char *string, const char checkChar, bool skipQuotes, int endPos=0)
 
virtual string getCharEncoding ()
 
const char * getContentPtr (void)
 
int getCurrentPosition () const
 
int & getCurrentPositionRef ()
 
const char * getKeywordValue (const char *keyword, int &valueLen, bool bRemoveQuotes)
 
void incrementCurrentPosition (int inc=1)
 
Extractoroperator= (const Extractor &other)
 
Extractoroperator= (const string &data)
 
const string path () const
 
void rewind ()
 
bool rfind (ExtractionCursor &cursor, const string &text, bool caseSensitive=true)
 Find a string searching backwards. More...
 
bool rfindPtr (int startPos, const StringVector &after, const char *pBeforeString, bool casesensitive, char **pMatchedString, int &matchedStringPos, int &matchedStringlength)
 
int rfindString (int startPos, const string &str, bool caseSensitive=true)
 
int rfindString (int startPos, const char *str)
 
int rfindStringIc (int startPos, const char *str)
 
virtual void setCharEncoding (const string &charEncoding)
 
void setCurrentPosition (int position)
 
void setEndSearch ()
 
void skipToStringIc (const char *pTag)
 
string stringAtCurrentPosition (int len) const
 
bool verifyContains (const string &text, bool caseSensitive=true)
 Verify does not contain the specfied string. More...
 

Detailed Description

A means to search and extract information from a string.

Constructors

Facilita::Extractor::Extractor ( )
Facilita::Extractor::Extractor ( const string &  data)
Facilita::Extractor::Extractor ( const string &  path,
int  dummy 
)
Facilita::Extractor::Extractor ( const Extractor other)
virtual Facilita::Extractor::~Extractor ( )
virtual

Methods

void Facilita::Extractor::advanceRewind ( )
const string& Facilita::Extractor::data ( ) const
Returns
A string reference to the data of this object.
string Facilita::Extractor::extract ( ExtractionCursor cursor,
const string &  before,
const string &  after,
const string &  defaultValue,
bool  caseSensitive = true 
)

Extract a sub-string.

From the current position search forwards for string in the data held in this object.

Parameters
cursorExtractionCursor holds the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is retained
beforeA string to find before the extracted string.
afterA string to find after the extracted string.
defaultValueA string returned if the search fails.
caseSensitiveIndicate if search is to be case sensitive.
Returns
The string found otherwise the default.
string Facilita::Extractor::extract ( ExtractionCursor cursor,
const StringVector &  before,
const string &  after,
const string &  defaultValue,
bool  caseSensitive = true 
)

Extract a string after a list strings.

From the current position search forwards for string in the data held in this object.

Parameters
cursorExtractionCursor holding the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is retained
beforeA vector of strings to find before the extraction.
afterA string of to text to find after the extracted string.
defaultValueA string returned if the search fails.
caseSensitiveIndicate if search is to be case sensitive.
Returns
The string found otherwise the default.
string Facilita::Extractor::extract ( ExtractionCursor cursor,
const StringVector &  before,
const string &  after,
bool  caseSensitive = true 
)

Extract a string after a list strings.

From the current position search forwards for string in the data held in this object.

Parameters
cursorExtractionCursor holds the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is retained
beforeA vector of strings to find before the extracted string.
afterA string to find after the extracted string.
caseSensitiveIndicate if search is to be case sensitive.
Returns
The string found or an empty string if the serach fails.
string Facilita::Extractor::extract ( ExtractionCursor cursor,
const string &  before,
const string &  after,
bool  caseSensitive = true 
)

Extract a string between two others.

From the current position search forwards for string in the data held in this object.

Parameters
cursorExtractionCursor holds the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is retained
beforeA string to find before the extracted string.
afterA string to find after the extracted string.
caseSensitiveIndicate if search is to be case sensitive.
Returns
The string found or an empty string if the serach fails.
string Facilita::Extractor::extractFromEnd ( ExtractionCursor cursor,
const string &  after,
const string &  before,
const string &  defaultValue,
bool  caseSensitive = true 
)
string Facilita::Extractor::extractFromEnd ( ExtractionCursor cursor,
const StringVector &  after,
const string &  before,
const string &  defaultValue,
bool  caseSensitive = true 
)
string Facilita::Extractor::extractFromEnd ( ExtractionCursor cursor,
const StringVector &  after,
const string &  before,
bool  caseSensitive = true 
)
string Facilita::Extractor::extractFromEnd ( ExtractionCursor cursor,
const string &  after,
const string &  before,
bool  caseSensitive = true 
)
virtual StringVector Facilita::Extractor::extractList ( const string &  before,
const string &  after,
bool  caseSensitive = true,
int  maxItems = -1 
)
virtual
virtual StringVector Facilita::Extractor::extractList ( ExtractionCursor cursor,
const string &  before,
const string &  after,
const string &  endAt = "",
bool  caseSensitive = true,
int  maxItems = -1 
)
virtual
RegExpMatchList Facilita::Extractor::extractRegExp ( ExtractionCursor cursor,
const string &  regExp,
bool  caseSensitive = true 
)

Extract a RegexMatchList.

Extract a RegexMatchList object starting from a position searching forwards in the data held in this object and determined by the Facilita::ExtractionCursor. On failure the associated Facilita::Action determines the action taken.

Parameters
cursorFacilita::ExtractionCursor defining the current position and state of search in the data. The cursor is updated as a result of a succesful extraction
regExpA string of to text in regular expression format.
caseSensitiveIndicate if search is to be case sensitive.
Returns
A Facilita::RegexMatchList object defining the result of the extraction.
string Facilita::Extractor::extractRegExp ( ExtractionCursor cursor,
const string &  beforeRegExp,
const string &  afterRegExp,
bool  caseSensitive = true 
)
string Facilita::Extractor::extractRegExpFromEnd ( ExtractionCursor cursor,
const string &  afterRegExp,
const string &  beforeRegExp,
bool  caseSensitive = true 
)
bool Facilita::Extractor::find ( ExtractionCursor cursor,
const string &  text,
bool  caseSensitive = true 
)

Find a string searching forwards.

From the current position search for string in the data held in this object.

Parameters
cursorExtractionCursor holds the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is maintained.
textThe string to find.
caseSensitiveIndicate if search is to be case sensitive.
Returns
True if the text is found false otherwise.
bool Facilita::Extractor::findPtr ( int  startPos,
const StringVector &  before,
const char *  pAfterString,
bool  casesensitive,
char **  pMatchedString,
int &  matchedStringPos,
int &  matchedStringlength 
)
int Facilita::Extractor::findString ( int  startPos,
const string &  str,
bool  caseSensitive = true 
)
int Facilita::Extractor::findString ( int  startPos,
const char *  pBeforeString,
bool  casesensitive 
)
int Facilita::Extractor::findStringCheck ( int  startPos,
const char *  str,
const char  checkChar 
)
int Facilita::Extractor::findStringCheckIc ( int  startPos,
const char *  string,
const char  checkChar,
bool  skipQuotes,
int  endPos = 0 
)
virtual string Facilita::Extractor::getCharEncoding ( )
virtual
const char* Facilita::Extractor::getContentPtr ( void  )
int Facilita::Extractor::getCurrentPosition ( ) const
int& Facilita::Extractor::getCurrentPositionRef ( )
const char* Facilita::Extractor::getKeywordValue ( const char *  keyword,
int &  valueLen,
bool  bRemoveQuotes 
)
void Facilita::Extractor::incrementCurrentPosition ( int  inc = 1)
Extractor& Facilita::Extractor::operator= ( const Extractor other)
Extractor& Facilita::Extractor::operator= ( const string &  data)
const string Facilita::Extractor::path ( ) const
Returns
A string to the path to the file containing the content of this object. An empty string is returned if the obect content is not derived from a file.
void Facilita::Extractor::rewind ( )
bool Facilita::Extractor::rfind ( ExtractionCursor cursor,
const string &  text,
bool  caseSensitive = true 
)

Find a string searching backwards.

From the current position search backwards for string in the data held in this object.

Parameters
cursorExtractionCursor holds the current position and state of search in the data. The cursor is updated as a result of a succesful search, otherwise the current position is retained
textThe string to find.
caseSensitiveIndicate if search is to be case sensitive.
Returns
True if the text is found false otherwise.
bool Facilita::Extractor::rfindPtr ( int  startPos,
const StringVector &  after,
const char *  pBeforeString,
bool  casesensitive,
char **  pMatchedString,
int &  matchedStringPos,
int &  matchedStringlength 
)
int Facilita::Extractor::rfindString ( int  startPos,
const string &  str,
bool  caseSensitive = true 
)
int Facilita::Extractor::rfindString ( int  startPos,
const char *  str 
)
int Facilita::Extractor::rfindStringIc ( int  startPos,
const char *  str 
)
virtual void Facilita::Extractor::setCharEncoding ( const string &  charEncoding)
virtual
void Facilita::Extractor::setCurrentPosition ( int  position)
void Facilita::Extractor::setEndSearch ( )
void Facilita::Extractor::skipToStringIc ( const char *  pTag)
string Facilita::Extractor::stringAtCurrentPosition ( int  len) const
bool Facilita::Extractor::verifyContains ( const string &  text,
bool  caseSensitive = true 
)

Verify does not contain the specfied string.

Parameters
textA string to search for.
caseSensitiveIndicate if search is to be case sensitive.
Returns
True if the Extractor does NOT contain the specified string, false if it does.

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