C++ main module for gpm Package
1.0
|
this class describes a string More...
#include <CORE_String.h>
Public Member Functions | |
CORE_String () | |
create a string More... | |
CORE_String (const tString &str) | |
create a string More... | |
~CORE_String () | |
deleter More... | |
const char & | operator[] (int i) const |
get the i-th element Assert in (i>-1) Assert in (i<size()); More... | |
char & | operator[] (int i) |
get the i-th element Assert in (i>-1) Assert in (i<size()); More... | |
void | setString (const tString &str) |
set the integer to i More... | |
void | setString (const char *str) |
set the integer to i More... | |
tString | getString () const |
get the string More... | |
tString | toString () const |
return the string associated to the string More... | |
char * | toCharArray () const |
turn the string into char array More... | |
void | tokenize (const tString &separator) |
tokenize the string with the separator More... | |
void | tokenize () |
tokenize the string More... | |
int | getTokensCount () const |
get the number of tokens More... | |
int | getTokensNumber () const |
get the number of tokens More... | |
void | begin () |
tBoolean | hasNextToken () const |
return true if there is another token More... | |
tString | nextToken () |
return the next token More... | |
tString | getToken (const int &index) |
get the token at index More... | |
void | replaceAll (const tString &strToReplace, const tString &str) |
replace all instances of strToReplace by str More... | |
void | replaceFirst (const tString &strToReplace, const tString &str) |
replace first instance of strToReplace by str More... | |
void | replaceLast (const tString &strToReplace, const tString &str) |
replace last instance of strToReplace by str More... | |
void | toUpper () |
turn the string to upper case More... | |
void | toLower () |
turn the string to lower case More... | |
tString::size_type | indexOf (const tString &v) const |
return the first index of v fin this->mString More... | |
tString::size_type | lastIndexOf (const tString &v) const |
return the last index of v fin this->mString More... | |
tString::size_type | getLastIndexOf (const tString &v) const |
return the last index of v fin this->mString More... | |
tString::size_type | indexOf (const tString &v, const tString::size_type &fromIndex) const |
return the index of char v in this->mString from fromIndex index More... | |
void | remove (const tString::size_type &from, const tString::size_type &to) |
remove all the chars in from & to More... | |
void | remove (const tString::size_type &index) |
remove the char at index More... | |
tString | substring (const tString::size_type &from, const tString::size_type &to) const |
return the string between from & to indices from index is included, to is not More... | |
tString | substring (const tString::size_type &from) const |
return the string from index More... | |
char | charAt (const int &index) const |
return the char at index More... | |
int | length () const |
get the size of the size More... | |
void | append (const tString &v) |
append the string v to the string More... | |
void | append (const char &v) |
append the char v to the string More... | |
void | trim () |
trim More... | |
void | getSharedPointer (SP::CORE_Object &p) |
get the shared pointer of this class into p More... | |
void | getSharedPointer (SPC::CORE_Object &p) const |
get the shared pointer of this class into p More... | |
tString | getClassName () const |
return the class name of the object More... | |
tString | getIdentityString () const |
return the identity string of the object of the form className_at_address More... | |
tString | getPointerAddress () const |
return the identity string of the object More... | |
template<class T > | |
tBoolean | isInstanceOf () const |
return true if the object is an instance of T More... | |
virtual void | print () |
print the class More... | |
virtual ostream & | print (ostream &out) const |
print the class More... | |
virtual void | print (const tString &message) |
print the class More... | |
virtual void | print (const tInteger &str) |
print More... | |
virtual void | print (const tRelativeInteger &str) |
print More... | |
virtual void | print (const tReal &str) |
print More... | |
virtual void | print (const int &str) |
print More... | |
Static Public Member Functions | |
static SP::CORE_String | New () |
create a class String More... | |
static SP::CORE_String | New (const tString &str) |
build an integer object More... | |
static char * | stringToCharArray (const tString &str) |
turn the string into char array More... | |
static void | replaceAll (tString &inOutValue, const tString &strToReplace, const tString &str) |
replace all instances of strToReplace by str More... | |
static void | replaceFirst (tString &inOutValue, const tString &strToReplace, const tString &str) |
replace first instance of strToReplace by str More... | |
static void | replaceLast (tString &inOutValue, const tString &strToReplace, const tString &str) |
replace last instance of strToReplace by str More... | |
static int | getOccurencesNumber (const tString &str, const tString &occ) |
get the number of occurence of the string More... | |
static tString | toString (const tString &str, const int &len) |
return the string associated to the string More... | |
static void | toUpper (tString &s) |
to upper More... | |
static tString | toUpper (const tString &str) |
turn the string to upper case More... | |
static void | toLower (tString &s) |
to lower More... | |
static tString | toLower (const tString &str) |
turn the string to upper case More... | |
static tString | toString (const tFlag &c) |
return the string representation of short c More... | |
static tString | toString (const float &c) |
return the string representation of float c More... | |
static tString | toString (const double &c) |
return the string representation of double c More... | |
static tString | toString (const long double &c) |
return the string representation of long double c More... | |
static tString | toString (const int &c) |
return the string representation of int c More... | |
static tString | toString (const long &c) |
return the string representation of long c More... | |
static tString | toString (const long long &c) |
return the string representation of long long c More... | |
static tString | toString (const unsigned int &c) |
return the string representation of unsigned int c More... | |
static tString | toString (const unsigned long &c) |
return the string representation of c More... | |
static tString | toString (const unsigned long long &c) |
return the string representation of unsigned long long c More... | |
static tString | toString (const tBoolean &c) |
return the string representation of boolean c More... | |
static tString | boolean2String (const tBoolean &c) |
return the string representation true or false of boolean c More... | |
static tString | booleanToString (const tBoolean &c) |
return the string representation true or false of boolean c More... | |
static tBoolean | string2Boolean (const tString &c) |
return the booleazn corresponding to string More... | |
static tBoolean | stringToBoolean (const tString &c) |
return the booleazn corresponding to string More... | |
static tString | toString (tCharacter c) |
return the string representation of char c More... | |
static tString | toString (tComplex c) |
return the string representation of complex c More... | |
static tString | toString (tString c) |
return the string representation of string c More... | |
static tString | toString (const int &n, const long double *c) |
return the string representation of long double c More... | |
static void | parse (const tString &str, unsigned char &c) |
parse unsigned char c in str More... | |
static void | parse (const tString &str, short int &c) |
parse short c in str More... | |
static void | parse (const tString &str, unsigned short int &c) |
parse short c in str More... | |
static void | parse (const tString &str, int &c) |
parse int c in str More... | |
static void | parse (const tString &str, long &c) |
parse long c in str More... | |
static void | parse (const tString &str, long long &c) |
parse long long c in str More... | |
static void | parse (const tString &str, unsigned int &c) |
parse unsigned int c in str More... | |
static void | parse (const tString &str, unsigned long &c) |
parse unsigned long c in str More... | |
static void | parse (const tString &str, unsigned long long &c) |
parse unsigned long long c in str More... | |
static void | parse (const tString &str, bool &c) |
parse boolean c in str More... | |
static void | parse (const tString &str, char &c) |
parse char c in str More... | |
static void | parse (const tString &str, float &c) |
parse float c in str More... | |
static void | parse (const tString &str, double &c) |
parse double c in str More... | |
static void | parse (const tString &str, long double &c) |
parse long double c in str More... | |
static void | parse (const tString &str, tString &c) |
parse tString c in str More... | |
static void | parse (const tString &str, tComplex &c) |
parse tComplex c in str More... | |
static tString::size_type | getLastIndexOf (const tString &str, const tString &v) |
return the last index of v fin this->mString More... | |
static tString | keepOnlyFirstLines (const tString &str, const int &nLines, tBoolean &isTruncated) |
keep only the first lines of parameter str More... | |
static void | removeAll (tString &inOutStr, const tString &strToRemove) |
remove the char at index More... | |
static void | truncate (tString &text, const int &nLines, const int &nCharsByLine) |
truncate the message with nLines of nChars More... | |
static tString | substring (const tString &str, const tString::size_type &from, const tString::size_type &to) |
return the string between from & to indices from index is included, to is not More... | |
static void | trim (tString &str) |
trim a string More... | |
static int | readInteger (const tString &v) |
read only integer characters More... | |
static tReal | readReal (const tString &v) |
read only real characters if not a real return 0 More... | |
static tBoolean | isLetter (const char &v) |
return if the char is a letter More... | |
static tBoolean | isDigit (const char &v) |
return if the char is a digit More... | |
static tString | getClassName (const tString &identityString) |
return the class name of the object using only the identity string More... | |
template<class T > | |
static tString | getTypeName () |
get type name More... | |
static tBoolean | is64Architecture () |
return true if the machine is a 64 bits machine More... | |
static tBoolean | is32Architecture () |
return true if the machine is a 32 bits machine More... | |
static tString | pointer2String (const void *obj) |
return the string represantation of a pointer More... | |
static void | setOutput (ostream &out) |
set output More... | |
static ostream & | getOutput () |
get output More... | |
static void | printObjectsInMemory () |
print object in memory More... | |
static ostream & | print (ostream &out, const tString &message) |
print the class More... | |
static void | outputPrint (const tString &message) |
Static Public Attributes | |
static tBoolean | mIsMemoryTesting =false |
indicator to store all classes created and deleted only for debuging version More... | |
Protected Member Functions | |
void | setThis (SP::CORE_Object p) |
set this weak shared pointer called toDoAfterThis setting method More... | |
virtual void | setType (tString type) |
set the type of the object More... | |
virtual void | toDoAfterThisSetting () |
method called after setThis() method this method can oly be called once. More... | |
this class describes a string
Attributes:
Associations:
To do for tokenizer:
int main(){ using namespace std; using namespace boost; string s = "This is, a test"; tokenizer<> tok(s); for(tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){ cout << *beg << "\n"; } } #include <boost/tokenizer.hpp> #include <string> #include <iostream>
int main() { typedef boost::tokenizer<boost::char_separator<char>> tokenizer; std::string s = "Boost C++ Libraries"; boost::char_separator<char> sep{" "}; tokenizer tok{s, sep}; for (const auto &t : tok) std::cout << t << '
'; }
CORE_String::CORE_String | ( | ) |
CORE_String::CORE_String | ( | const tString & | str | ) |
create a string
CORE_String::~CORE_String | ( | ) |
deleter
|
inline |
append the string v to the string
|
inline |
|
inline |
return the string representation true or false of boolean c
Referenced by booleanToString(), GPMG_VertexWindow::componentClicked(), CORE_CommandLine::interpretCommandLine(), GPM_Port::toString(), and GPM_Variable::toString().
return the string representation true or false of boolean c
References boolean2String().
|
inline |
return the char at index
return the class name of the object using only the identity string
Referenced by CORE_Object::printObjectsInMemory().
|
inherited |
return the class name of the object
References tString.
Referenced by CORE_Object::getIdentityString().
|
inlineinherited |
return the identity string of the object of the form className_at_address
References CORE_Object::getClassName(), CORE_Object::pointer2String(), and tString.
Referenced by CORE_Object::toString().
|
inline |
return the last index of v fin this->mString
|
inlinestatic |
return the last index of v fin this->mString
get the number of occurence of the string
|
inlinestaticinherited |
get output
|
inlineinherited |
return the identity string of the object
References CORE_Object::pointer2String().
|
inlineinherited |
get the shared pointer of this class into p
Referenced by MATH_ParentExpression::addArgument(), GPMG_EnvironmentPanel::componentClicked(), GPM_GraphElement::copy(), CORE_Map< Key, Value >::getSharedPointer(), CORE_Array< T >::getSharedPointer(), CORE_Vector< T >::getSharedPointer(), CORE_Matrix< T >::getSharedPointer(), CORE_Object::printObjectsInMemory(), MATH_ParentExpression::setArgument(), GPMG_EnvironmentPanel::setEnvironment(), GPM_GraphElement::setGraph(), GPMG_GraphElementWindow::setGraphElement(), GPMG_ShowGraphDrawPanel::showGraph(), and GPMG_RuleGraphDrawPanel::showRule().
|
inlineinherited |
get the shared pointer of this class into p
|
inline |
get the string
|
inline |
get the token at index
|
inline |
get the number of tokens
|
inline |
get the number of tokens
|
inlinestaticinherited |
get type name
References tString.
|
inline |
return true if there is another token
|
inline |
return the first index of v fin this->mString
|
inline |
return the index of char v in this->mString from fromIndex index
|
inlinestaticinherited |
return true if the machine is a 32 bits machine
References CORE_Object::is64Architecture().
|
staticinherited |
return true if the machine is a 64 bits machine
Referenced by CORE_Object::is32Architecture().
|
inlinestatic |
return if the char is a digit
Referenced by GPM_ModelFunction::expandVariableNames().
|
inlineinherited |
return true if the object is an instance of T
References null.
Referenced by MATH_BinaryOperator::insertInTree(), MATH_UnaryOperator::insertInTree(), and MATH_EndBlock::insertInTree().
|
inlinestatic |
return if the char is a letter
Referenced by GPM_Rule::isDependentOn().
|
static |
keep only the first lines of parameter str
str | : string parameter to keep only nLines |
nLines | : number of lines to keep |
isTruncated | : is set to true if the string has been truncated |
References tString.
|
inline |
return the last index of v fin this->mString
|
inline |
get the size of the size
|
inlinestatic |
create a class String
References CORE_String().
Referenced by CORE_IO::getFiles(), CORE_ClassFactory::NewInstance(), GPM_Variable::parse(), GPM_ModelFunction::readRulesFromFile(), CORE_Color::setColor(), CORE_Time::setTime(), and CORE_Array< T >::setValues().
|
inlinestatic |
|
inline |
return the next token
|
inline |
get the i-th element Assert in (i>-1) Assert in (i<size());
|
inline |
get the i-th element Assert in (i>-1) Assert in (i<size());
|
staticinherited |
print on output
References null, and CORE_Object::print().
Referenced by CORE_Exception::CORE_Exception().
|
inlinestatic |
parse unsigned char c in str
References CORE_Integer::parseInt().
Referenced by readInteger(), readReal(), CORE_VectorReader::readVector(), and CORE_Array< T >::setValues().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
parse long long c in str
References CORE_Integer::parseInt().
|
inlinestatic |
parse unsigned int c in str
References CORE_Integer::parseInt().
|
inlinestatic |
parse unsigned long c in str
References CORE_Integer::parseInt().
|
inlinestatic |
parse unsigned long long c in str
References CORE_Integer::parseInt().
|
inlinestatic |
parse boolean c in str
References CORE_Integer::parseInt().
|
inlinestatic |
parse char c in str
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
parse long double c in str
References CORE_Real::parseReal().
parse tString c in str
References tString.
parse tComplex c in str
References CORE_Complex::parseComplex(), and tComplex.
|
staticinherited |
return the string represantation of a pointer
References tString.
Referenced by CORE_Object::CORE_Object(), CORE_Object::getIdentityString(), CORE_Object::getPointerAddress(), and CORE_Object::~CORE_Object().
|
inlinevirtualinherited |
print the class
References CORE_Object::toString().
Referenced by CORE_Object::outputPrint(), CORE_Out::print(), CORE_Object::print(), CORE_Out::printInt(), CORE_Out::println(), CORE_Out::printReal(), CORE_Out::printString(), and CORE_Out::setAction().
|
inlinevirtualinherited |
print the class
References CORE_Object::print(), and CORE_Object::toString().
|
virtualinherited |
print the class
Reimplemented in CORE_Out.
References null, and CORE_Object::print().
|
virtualinherited |
References null.
|
virtualinherited |
References null.
|
inlinestaticinherited |
print the class
|
staticinherited |
print object in memory
References CORE_Object::getClassName(), CORE_Object::getSharedPointer(), and CORE_Object::mIsMemoryTesting.
Referenced by main().
|
static |
|
inline |
remove all the chars in from & to
|
inline |
remove the char at index
remove the char at index
replace all instances of strToReplace by str
Referenced by GPM_Object::turnBodyLineToText(), and GPM_Object::turnBodyTextToLine().
|
static |
replace all instances of strToReplace by str
replace first instance of strToReplace by str
|
static |
replace first instance of strToReplace by str
replace last instance of strToReplace by str
|
static |
replace last instance of strToReplace by str
|
inlinestaticinherited |
set output
|
inline |
set the integer to i
|
inline |
set the integer to i
|
inlineprotectedinherited |
set this weak shared pointer called toDoAfterThis setting method
References CORE_Object::toDoAfterThisSetting().
|
inlineprotectedvirtualinherited |
set the type of the object
Referenced by CORE_CommandLine::CORE_CommandLine(), CORE_IO::CORE_IO(), GPM_2DSnowGraph::GPM_2DSnowGraph(), GPM_BGLTest::GPM_BGLTest(), GPM_ClassFactory::GPM_ClassFactory(), GPM_ConwayFunction::GPM_ConwayFunction(), GPM_ConwayGraph::GPM_ConwayGraph(), GPM_CoreRun::GPM_CoreRun(), GPM_CoreTest::GPM_CoreTest(), GPM_Edge::GPM_Edge(), GPM_ExamplesRun::GPM_ExamplesRun(), GPM_Function::GPM_Function(), GPM_Graph::GPM_Graph(), GPM_GraphElement::GPM_GraphElement(), GPM_ModelGraph::GPM_ModelGraph(), GPM_Node::GPM_Node(), GPM_Object::GPM_Object(), GPM_PatternFunction::GPM_PatternFunction(), GPM_Port::GPM_Port(), GPM_PortGraph::GPM_PortGraph(), GPM_Snow2DFunction::GPM_Snow2DFunction(), GPM_Snow3DFunction::GPM_Snow3DFunction(), GPM_Vertex::GPM_Vertex(), and MATH_ExpressionRun::MATH_ExpressionRun().
return the booleazn corresponding to string
Referenced by GPMG_GraphPanel::componentClicked(), GPM_Port::loadFromStream(), GPM_Variable::parse(), CORE_CommandLine::readOption(), and stringToBoolean().
return the booleazn corresponding to string
References string2Boolean().
|
static |
turn the string into char array
the return value must be delete by delete[] function.
Referenced by toCharArray().
|
inlinestatic |
return the string between from & to indices from index is included, to is not
|
inline |
return the string between from & to indices from index is included, to is not
|
inline |
return the string from index
|
inline |
turn the string into char array
References stringToCharArray().
|
inlineprotectedvirtualinherited |
method called after setThis() method this method can oly be called once.
Reimplemented in GPM_2DSnowGraph, GPMG_EnvironmentWindow, GPM_GraphElement, GPM_ModelFunction, GPM_ModelGraph, GPMG_RuleGraphWindow, GPMG_MovieGraphWindow, GPMG_ShowGraphWindow, and GPM_Function.
Referenced by CORE_Object::setThis(), GPM_ModelGraph::toDoAfterThisSetting(), GPM_GraphElement::toDoAfterThisSetting(), and GPM_2DSnowGraph::toDoAfterThisSetting().
|
inline |
tokenize the string with the separator
References tokenize().
void CORE_String::tokenize | ( | ) |
tokenize the string
References tString.
Referenced by tokenize().
|
inlinestatic |
to lower
|
inline |
turn the string to lower case
Referenced by GPM_ClassFactory::NewInstance(), GPM_ModelClassFactory::NewInstance(), GPM_Graph::newInstance(), GPM_PortGraph::newInstance(), and toLower().
|
inlinevirtual |
return the string associated to the string
Reimplemented from CORE_Object.
Referenced by append(), GPM_PortGraph::findSegments(), CORE_Time::getDuration(), CORE_Array3D< T >::toString(), CORE_SharedPointersListVMap< Key, Value >::toString(), CORE_SharedPointersVMap< Key, Value >::toString(), CORE_Matrix< T >::toString(), toString(), CORE_Array2D< T >::toString(), CORE_Array< T >::toString(), and CORE_Vector< T >::toString().
return the string associated to the string
References tString.
return the string representation of short c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of float c
References CORE_Real::toString().
|
inlinestatic |
return the string representation of double c
References CORE_Real::toString().
|
inlinestatic |
return the string representation of long double c
References CORE_Real::toString().
|
inlinestatic |
return the string representation of int c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of long c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of long long c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of unsigned int c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of c
References CORE_Integer::toString().
|
inlinestatic |
return the string representation of unsigned long long c
References CORE_Integer::toString().
return the string representation of boolean c
References toString().
|
inlinestatic |
return the string representation of char c
References tString.
return the string representation of complex c
References CORE_Complex::toString().
return the string representation of string c
|
inlinestatic |
return the string representation of long double c
References CORE_Real::toString(), and tString.
|
inlinestatic |
to upper
|
inline |
|
static |
trim a string
|
inline |
trim
Referenced by GPM_Variable::parse(), CORE_Real::parseReal(), CORE_CommandLine::readOption(), CORE_Run::readOptions(), and MATH_LeafExpression::setSymbol().
|
static |
truncate the message with nLines of nChars
|
staticinherited |
indicator to store all classes created and deleted only for debuging version
Referenced by CORE_Object::CORE_Object(), main(), CORE_Object::printObjectsInMemory(), and CORE_Object::~CORE_Object().