#include <ustr.hpp>
Inheritance diagram for UStr:
Public Member Functions | |
UStr () | |
UStr (const char *) | |
UStr (const UStr &) | |
UStr (const std::string &) | |
UStr (const UIntgBase &) | |
UStr (const UFloatBase &) | |
constructors
| |
virtual | ~UStr () |
destructor. | |
virtual void | clear () |
clears the string's content. | |
virtual bool | empty () const |
true if content is empty | |
int | length () const |
returns the length of the string. | |
UStr & | operator= (const char *s2) |
UStr & | operator= (const UStr &s2) |
UStr & | operator= (const std::string &s2) |
UStr & | operator= (const UIntgBase &v2) |
UStr & | operator= (const UFloatBase &v2) |
copy the value of the argument to this string. | |
virtual void | set (const char *s2) |
virtual void | set (const UStr &s2) |
virtual void | set (const std::string &s2) |
virtual void | set (const UIntgBase &v2) |
virtual void | set (const UFloatBase &v2) |
virtual void | setNum (int v2) |
virtual void | setNum (double v2) |
copy the value of the argument to this string. | |
bool | operator== (const char *s2) const |
bool | operator== (const UStr &s2) const |
bool | operator== (const std::string &s2) const |
virtual bool | equals (const char *) const |
virtual bool | equals (const std::string &) const |
virtual bool | equals (const UStr &) const |
returns true if string contents are the same. | |
virtual int | compare (const char *) const |
virtual int | compare (const std::string &) const |
virtual int | compare (const UStr &) const |
virtual int | compareTo (const char *, bool ignore_case=false) const |
virtual int | compareTo (const std::string &, bool ignore_case=false) const |
virtual int | compareTo (const UStr &, bool ignore_case=false) const |
compare strings lexicographically. | |
const char * | chars () const |
const char * | c_str () const |
returns a C string that should not be changed nor deleted. | |
virtual char | charAt (int pos) const |
virtual char | at (int pos) const |
returns the character at offset 'pos'. | |
virtual char | setCharAt (int pos, char c, bool update=true) |
changes the character at offset 'pos'. | |
virtual bool | copyTo (UStr &to, int pos=0, unsigned int nbchars=npos) const |
virtual bool | copyTo (std::string &to, int pos=0, unsigned int nbchars=npos) const |
copies a substring of *this string into the argument string. | |
virtual UStr | substring (int from_pos=0, unsigned int nbchars=npos) const |
virtual std::string | toString (int from_pos=0, unsigned int nbchars=npos) const |
returns a substring. | |
virtual UStr | split (int pos, bool delete_char_at_pos=false) |
splits the string: removes contents from offset 'pos' and returns the remaining chars. | |
virtual void | trim (bool strip_beginning=true, bool strip_end=true) |
virtual void | strip (bool strip_beginning=true, bool strip_end=true) |
removes white spaces, tabs and newlines at the beginning and end of string. | |
int | find (char) |
int | rfind (char) |
int | find (const char *) |
int | find (const UStr &) |
int | find (const std::string &) |
returns -1 if not found. | |
UStr & | operator &= (const UStr &s2) |
UStr & | operator &= (const char *s2) |
UStr & | operator &= (const std::string &s2) |
UStr & | operator &= (int v2) |
UStr & | operator &= (float v2) |
UStr & | operator &= (const UIntgBase &v2) |
UStr & | operator &= (const UFloatBase &v2) |
appends argument to this. | |
virtual void | append (char) |
virtual void | append (const char *) |
virtual void | append (const char *, unsigned int nbchars) |
virtual void | append (const UStr &) |
virtual void | append (const UStr &, unsigned int nbchars) |
virtual void | append (const std::string &) |
virtual void | append (const std::string &, unsigned int nbchars) |
virtual void | append (int) |
virtual void | append (float) |
virtual void | append (const UIntgBase &) |
virtual void | append (const UFloatBase &) |
appends the string given as an argument to the end of *this string. | |
virtual bool | insert (int to_pos, char) |
virtual bool | insert (int to_pos, const char *from, int from_pos=0, unsigned int from_nbchars=npos) |
virtual bool | insert (int to_pos, const UStr &from, int from_pos=0, unsigned int from_nbchars=npos) |
virtual bool | insert (int to_pos, const std::string &from, int from_pos=0, unsigned int from_nbchars=npos) |
inserts 'from' string at offset 'to_pos' in *this string. | |
virtual void | remove (int pos, unsigned int nbchars) |
removes 'nbchars' characters from offset 'pos' details:
| |
virtual void | replace (int pos, unsigned int nbchars, const UStr &) |
virtual void | replace (int pos, unsigned int nbchars, const char *) |
virtual void | replace (int pos, unsigned int nbchars, const std::string &) |
replaces 'nbchars' characters from offset 'pos' in this string by the argument string. | |
virtual UStr | getFileName (bool with_suffix=true) const |
returns the file name of a file path (= without the directory); removes the suffix if arg is false. | |
virtual UStr | getFileSuffix () const |
returns the suffix of a file path (= the end of the pathname after the dot) | |
virtual UStr | getFileDir (bool with_final_slash=true) const |
returns the directory of a file path (= without the file name). | |
virtual UStr | getFilePath (const UStr &new_suffix) const |
returns the file path with a new suffix. | |
virtual long | getFileType () const |
virtual long | getFileType (bool &is_regular_file, bool &is_directory) const |
returns the Unix file type (0 if the file does not exist) | |
virtual bool | isFileFound (bool is_regular_file=true) const |
returns true if file exists (also checks that this is a regular file if arg is true) | |
virtual int | readFile (const UStr &pathname) |
reads this file into the UStr and returns the loading status (see UFilestat). | |
virtual void | changed (bool update_now) |
[impl] called when object's content is changed. | |
virtual void | update () |
updates grahics. | |
Static Public Member Functions | |
static int | readFile (const UStr &filename, std::vector< UStr * > &slist, bool strip_beg_line=false, bool strip_end_line=false) |
reads this file into the UStr vector and returns the loading status (see UFilestat). | |
Static Public Attributes | |
static const unsigned int | npos = static_cast<unsigned int>(-1) |
static UStr | none |
static UStr | newline |
Friends | |
UStr & | ustr () |
UStr & | ustr (const char *_s) |
UStr & | ustr (const UStr &_s) |
UStr & | ustr (const std::string &_s) |
creator shortcuts (same as *new UStr()). | |
std::ostream & | operator<< (std::ostream &, const UStr &) |
prints string on ostream, for instance: cout << str. | |
UStr | operator & (const UStr &s1, const UStr &s2) |
UStr | operator & (const UStr &s1, const char *s2) |
UStr | operator & (const char *s1, const UStr &s2) |
UStr | operator & (const UStr &s1, const std::string &s2) |
UStr | operator & (const std::string &s1, const UStr &s2) |
UStr | operator & (const UStr &, int) |
UStr | operator & (const UStr &, float) |
UStr | operator & (const UStr &, const UIntgBase &) |
UStr | operator & (const UStr &, const UFloatBase &) |
creates a new string that collates the 2 arguments. |
Notes:
|
dont forget: checked by _set() for freeing memory! |
|
dont forget: checked by _set() for freeing memory! |
|
! |
|
constructors
|
|
returns the character at offset 'pos'.
|
|
[impl] called when object's content is changed. This function:
Reimplemented from UElem. |
|
compare strings lexicographically. ignores case considerations if second argument is true (checks case by default) |
|
copies a substring of *this string into the argument string. details:
|
|
inserts 'from' string at offset 'to_pos' in *this string. details:
|
|
appends argument to this. Notes:
|
|
changes the character at offset 'pos'.
|
|
returns a substring. details:
|
|
creates a new string that collates the 2 arguments. Notes:
|