NeoPZ
|
Implements strings as stack. Utility. More...
#include <pzstring.h>
Public Member Functions | |
TPZString () | |
Default Constructor. More... | |
TPZString (char const *source) | |
Constructs a TPZString object based on another string (char *) More... | |
TPZString (const int size) | |
Initializes the TPZString object with a predefined size. More... | |
TPZString (const char chr) | |
Single char constructor. More... | |
~TPZString () | |
Default destructor. More... | |
TPZString | operator+ (const char *increment) const |
Concatenates the 'this' string with another character string (increment) More... | |
TPZString | operator+ (const TPZString &increment) const |
Concatenates the 'this' string with another string object. More... | |
void | operator+= (const char *increment) |
Appends a string at the tail. Resizes the TPZString if necessary. More... | |
void | operator+= (const char increment) |
Appends a character at the end. Resizes if necessary. More... | |
bool | operator== (const TPZString cmp) |
Operator equal. Resizes if necessary. More... | |
void | operator= (const char *source) |
Operator attribution. Resizes if necessary. More... | |
void | Append (const char TailIncrement) |
Appends a character at the end. Resizes if necessary. More... | |
void | Append (const char *TailIncrement) |
Appends a string at the tail. Resizes the TPZString if necessary. More... | |
const char * | Str () const |
Explicitly convertes a TPZString into a const null ended char string. More... | |
operator const char * () const | |
Implicit conversion. More... | |
size_t | Length () const |
Similar to strlen(string). Also returns the number of non-null characters. More... | |
TPZString | SubStr (const int start, const int end) const |
Returns a subset string. More... | |
void | Empty () |
Empties the string. More... | |
void | Optimize () |
Internally allocates the exact string size to store it. More... | |
void | SimplifyWhiteSpace () |
Remove the repeat white spaces. More... | |
int | Replace (const char *old_str, const char *new_str) |
Replace the subset of string. Return the times of replacement. More... | |
int | Find (const char *find_str) |
Find the positions of the first occurence of the find string. More... | |
Public Member Functions inherited from TPZStack< char > | |
char & | Peek () const |
TPZStack () | |
Create the stack object, indicates the stack increments. More... | |
TPZStack (int nel, const char Object) | |
void | Push (const char object) |
Pushes a copy of the object on the stack. More... | |
void | push_back (const char object) |
char | Pop () |
Retrieve an object from the stack. More... | |
operator char * () const | |
Casting operator. More... | |
Public Member Functions inherited from TPZManVector< char, DEFAULTVEC_ALLOC > | |
TPZManVector (const int64_t size=0) | |
Creates a vector of a given size. More... | |
TPZManVector (const int64_t size, const char ©) | |
Creates a vector of a given size, filling it. More... | |
TPZManVector (const TPZManVector< char, NumExtAlloc > ©) | |
Copy constructor. More... | |
TPZManVector (const TPZVec< char > ©) | |
TPZManVector (const std::initializer_list< char > &list) | |
Creates a vector from a initializer list. More... | |
TPZManVector< char, NumExtAlloc > & | operator= (const TPZManVector< char, NumExtAlloc > ©) |
Assignment operator. More... | |
TPZManVector< char, NumExtAlloc > & | operator= (const std::initializer_list< char > &list) |
initializer list assignment operator More... | |
virtual | ~TPZManVector () |
Destructor. More... | |
int | NAlloc () const |
Returns number of elements allocated for this object. More... | |
void | Expand (const int64_t newsize) |
Expands the allocated storage to fit the newsize parameter. More... | |
void | Shrink () |
It reallocates storage to fit the necessary storage exactly. More... | |
virtual void | Resize (const int64_t newsize, const char &object) |
Resizes the vector object. More... | |
virtual void | Resize (const int64_t newsize) |
Resizes the vector object reallocating the storage if necessary. More... | |
Public Member Functions inherited from TPZVec< char > | |
TPZVec () | |
Creates a vector with size 0. More... | |
TPZVec (const int64_t size) | |
Creates a vector of a given size. More... | |
TPZVec (const int64_t size, const char ©) | |
Creates a vector of a given size. More... | |
TPZVec (const TPZVec< char > ©) | |
Creates a vector with copy constructor. will call the empty constructor on all objects of type T created. More... | |
TPZVec (const std::initializer_list< char > &list) | |
Creates a vector from a initializer list. More... | |
virtual | ~TPZVec () |
destructor, will delete the storage allocated More... | |
void | MigratePages () |
void | ReallocForNuma () |
TPZVec< char > & | operator= (const TPZVec< char > ©) |
will copy the vector into the current vector. More... | |
TPZVec< char > & | operator= (const std::initializer_list< char > &list) |
create a new vector and stores in the current vector More... | |
TPZVec< char > & | operator= (const char &a) |
Operator attribution. Fills the vector with a value of type T. More... | |
char & | operator[] (const int64_t index) const |
Access operator, will perform bounds checking unless the variable NODEBUG is defined. More... | |
char * | begin () const |
Casting operator. Returns The fStore pointer. More... | |
char * | end () const |
Returns a pointer to the last+1 element. More... | |
void | Fill (const char ©, const int64_t from=0, const int64_t numelem=-1) |
Will fill the elements of the vector with a copy object. More... | |
int64_t | NElements () const |
Returns the number of elements of the vector. More... | |
int64_t | size () const |
Returns the number of elements of the vector. More... | |
virtual void | resize (const int64_t newsize) |
void | Print (std::ostream &out=std::cout) |
Prints the structural information of the vector object to the output stream. This method will not print the objects themselves! More... | |
virtual void | clear () |
Empty the vector, make its size zero. More... | |
Additional Inherited Members | |
Protected Attributes inherited from TPZVec< char > | |
char * | fStore |
Allocated storage for the vector object. More... | |
int64_t | fNElements |
Number of elements of the vector object. More... | |
Implements strings as stack. Utility.
Definition at line 18 of file pzstring.h.
TPZString::TPZString | ( | ) |
Default Constructor.
Definition at line 11 of file pzstring.cpp.
TPZString::TPZString | ( | char const * | source | ) |
Constructs a TPZString object based on another string (char *)
Definition at line 16 of file pzstring.cpp.
TPZString::TPZString | ( | const int | size | ) |
Initializes the TPZString object with a predefined size.
Definition at line 29 of file pzstring.cpp.
TPZString::TPZString | ( | const char | chr | ) |
Single char constructor.
Definition at line 34 of file pzstring.cpp.
|
inline |
Default destructor.
Definition at line 35 of file pzstring.h.
References operator+(), and operator+=().
void TPZString::Append | ( | const char | TailIncrement | ) |
Appends a character at the end. Resizes if necessary.
Definition at line 86 of file pzstring.cpp.
References Length.
Referenced by operator+(), and operator=().
void TPZString::Append | ( | const char * | TailIncrement | ) |
Appends a string at the tail. Resizes the TPZString if necessary.
Definition at line 103 of file pzstring.cpp.
References Length.
void TPZString::Empty | ( | ) |
int TPZString::Find | ( | const char * | find_str | ) |
Find the positions of the first occurence of the find string.
Definition at line 195 of file pzstring.cpp.
Referenced by operator=().
size_t TPZString::Length | ( | ) | const |
Similar to strlen(string). Also returns the number of non-null characters.
Definition at line 80 of file pzstring.cpp.
Referenced by operator=().
TPZString::operator const char * | ( | ) | const |
Implicit conversion.
Definition at line 65 of file pzstring.cpp.
TPZString TPZString::operator+ | ( | const char * | increment | ) | const |
Concatenates the 'this' string with another character string (increment)
Definition at line 41 of file pzstring.cpp.
References Append().
Referenced by ~TPZString().
Concatenates the 'this' string with another string object.
Definition at line 48 of file pzstring.cpp.
References Append().
void TPZString::operator+= | ( | const char * | increment | ) |
Appends a string at the tail. Resizes the TPZString if necessary.
Definition at line 60 of file pzstring.cpp.
References Append().
Referenced by ~TPZString().
void TPZString::operator+= | ( | const char | increment | ) |
Appends a character at the end. Resizes if necessary.
Definition at line 55 of file pzstring.cpp.
References Append().
|
inline |
Operator attribution. Resizes if necessary.
Definition at line 64 of file pzstring.h.
References Append(), Empty(), TPZVec< char >::end(), Find(), TPZVec< char >::fStore, Length(), TPZVec< char >::NElements(), Optimize(), Replace(), TPZManVector< char, DEFAULTVEC_ALLOC >::Resize(), SimplifyWhiteSpace(), Str(), and SubStr().
|
inline |
Operator equal. Resizes if necessary.
Definition at line 56 of file pzstring.h.
References TPZVec< char >::fStore, and TPZVec< T >::fStore.
void TPZString::Optimize | ( | ) |
Internally allocates the exact string size to store it.
Definition at line 141 of file pzstring.cpp.
References Length.
Referenced by operator=().
int TPZString::Replace | ( | const char * | old_str, |
const char * | new_str | ||
) |
Replace the subset of string. Return the times of replacement.
Definition at line 181 of file pzstring.cpp.
Referenced by operator=().
void TPZString::SimplifyWhiteSpace | ( | ) |
Remove the repeat white spaces.
Definition at line 148 of file pzstring.cpp.
References Length.
Referenced by operator=().
const char * TPZString::Str | ( | ) | const |
Explicitly convertes a TPZString into a const null ended char string.
Definition at line 70 of file pzstring.cpp.
Referenced by operator=(), and TPZEulerConsLaw::Print().
TPZString TPZString::SubStr | ( | const int | start, |
const int | end | ||
) | const |
Returns a subset string.
start | start of the string (zero-based) |
end | end of the string (zero-based) If start and end are the same, a substring containing one character is returned.
|
Definition at line 114 of file pzstring.cpp.
References Length, and TPZVec< T >::NElements().
Referenced by operator=().