vrecko
virtual reality framework
|
#include <longstring.h>
Public Member Functions | |
LongString (unsigned int length=1048576) | |
LongString (const LongString &c) | |
LongString & | operator= (const LongString &c) |
~LongString () | |
void | convertFromString (std::string *str, unsigned int &=ZERO, const char= '\0') |
template<class T > | |
void | append (T par) |
void | append (const char ch) |
void | append (const char *data, int length) |
void | append (LongString *ls) |
template<class T > | |
bool | getParameters (unsigned int &pos, T *pParams, int ¶msCnt) |
char * | getData () |
char * | getData (unsigned int &pos, unsigned int &length, char delimiter) |
char * | getSymbol (unsigned int &pos) |
int | matchRight (char ch, int pos, const std::string *ignore=NULL, const std::string *consider=NULL) |
int | matchLeft (char ch, int pos, const std::string *ignore=NULL, const std::string *consider=NULL) |
char | peekSymbol (int &pos, bool direction) |
int | findMatchingRightBracket (int pos) |
int | findMatchingLeftBracket (int pos) |
std::string | toString () |
char & | operator[] (unsigned int i) const |
unsigned int | length () const |
Class for storing L-system string in fast form optimalized for append operation and for storing values/parameters of different types
LongString::LongString | ( | unsigned int | length = 1048576 | ) |
Create a LongString and set a default increment and initial length
length | initial length and also default increment |
LongString::LongString | ( | const LongString & | c | ) |
Copy constructor
LongString::~LongString | ( | ) |
Destructor
|
inline |
Appends some parameter of any type declared in Parameter::Type. Can be used to append module parameter.
par | parameter |
void LongString::append | ( | const char | ch | ) |
Appends one byte.
ch | byte to append |
void LongString::append | ( | const char * | data, |
int | length | ||
) |
Appends buffer with data.
data | buffer with data |
length | length of buffer |
void LongString::append | ( | LongString * | ls | ) |
Appends another LongString
ls | string to append |
void LongString::convertFromString | ( | std::string * | str, |
unsigned int & | pos = ZERO , |
||
const char | delimiter = '\0' |
||
) |
Converts standart string of L-system to internal LongString format. Useful for successors and axioms.
int LongString::findMatchingLeftBracket | ( | int | pos | ) |
Look for matching left bracket
pos | initial position |
int LongString::findMatchingRightBracket | ( | int | pos | ) |
Look for matching right bracket
pos | initial position |
char * LongString::getData | ( | ) |
Get pointer to string data in LongString in raw form
char * LongString::getData | ( | unsigned int & | pos, |
unsigned int & | length, | ||
char | delimiter | ||
) |
Get pointer to string data in LongString in raw form
pos | position of first byte in the string to be taken into consideration |
length | maximum length of taken data |
delimiter | optional delimiter |
|
inline |
Extracts parameters of same type from some position in string
pos | start position of parameters |
pParams | array for storing parameters |
paramsCnt | number of found parameters |
char * LongString::getSymbol | ( | unsigned int & | pos | ) |
Returns data whole symbol/module with it's parameters
pos | Position of module. Will be changet to position after module |
|
inline |
Length of longstring
int LongString::matchLeft | ( | char | ch, |
int | pos, | ||
const std::string * | ignore = NULL , |
||
const std::string * | consider = NULL |
||
) |
Matches left context
ch | left context |
pos | initial position - might be right behind identifier character |
ignore | string of characters that should be ignored during matching algorithm |
consider | string of characters that shoul be considered during matching algorithm |
int LongString::matchRight | ( | char | ch, |
int | pos, | ||
const std::string * | ignore = NULL , |
||
const std::string * | consider = NULL |
||
) |
Match right context
ch | right context |
pos | initial position - might be right behind identifier character |
ignore | string of characters that should be ignored during matching algorithm |
consider | string of characters that shoul be considered during matching algorithm |
LongString & LongString::operator= | ( | const LongString & | c | ) |
Assignment operator
|
inline |
Access to any byte of string
char LongString::peekSymbol | ( | int & | pos, |
bool | direction | ||
) |
Peek neighbouring symbol's identifier.
pos | initial position |
direction | true for searching to the right; false for searching to the left |
std::string LongString::toString | ( | ) |
Debug method for converting LongString from internal raw format to standart string. Becareful - very slow !