Jamoma API
0.6.0.a19
|
The TTString class is used to represent a string. More...
#include <TTString.h>
Inherits std::vector< T >.
Public Member Functions | |
TTString (const char *aCString="") | |
Constructor. | |
~TTString () | |
Destructor. | |
const char * | c_str () const |
Return a pointer to the internal C-string. | |
operator const char * () const | |
Cast to a C-string. More... | |
TTString & | operator= (const char *aCString) |
Assign from a C-string. More... | |
TTString & | operator= (std::string &aStdString) |
Assign from a std::string. More... | |
TTString & | operator= (const char aChar) |
Assign from a simple char. More... | |
void | assign (const char *aCString, size_t length=0) |
Overload to assign from a C-string. More... | |
void | assign (const std::string &aStdString) |
Assign from a std::string. More... | |
size_t | size () const |
Find out the length of a string. More... | |
size_t | length () const |
Find out the length of a string. More... | |
void | resize (size_t newSize) |
Allocate memory for the string. More... | |
void | append (const char *str, size_t length=0) |
Append / Concatenate. | |
size_t | find_first_of (const char aChar, size_t from=0) |
Return the index of the first instance of a specified char in the string. More... | |
size_t | find_last_of (const char aChar) |
Return the index of the last instance of a specified char in the string. More... | |
TTString | substr (size_t pos=0, size_t n=1) const |
Returns a string object with its contents initialized to a substring of the current object. More... | |
void TTFOUNDATION_EXPORT | random () |
Replace contents with a pseudo-random string. More... | |
The TTString class is used to represent a string.
We cannot safely pass std::string across lib boundaries, particularly on Windows. We also don't want to simply pass naked C-Strings for a whole host of reasons.
In many cases we try to mimic the interface of std::string for ease of compatibility.
FROM http://cboard.cprogramming.com/cplusplus-programming/86598-std-vector-char-vs-std-string.html
Definition at line 34 of file TTString.h.
|
inline |
Overload to assign from a C-string.
Definition at line 123 of file TTString.h.
References length(), and resize().
Referenced by assign(), operator=(), and TTString().
|
inline |
Assign from a std::string.
Definition at line 137 of file TTString.h.
References assign().
|
inline |
Return the index of the first instance of a specified char in the string.
aChar | The char for which to search |
from | A position in the string from which to begin the search. By default it starts at the beginning (0) |
Definition at line 296 of file TTString.h.
References size().
Referenced by TTAddressBase::splitAt().
|
inline |
Return the index of the last instance of a specified char in the string.
aChar | The char for which to search |
Definition at line 316 of file TTString.h.
References size().
Referenced by TTSoundfileLoader::test(), and TTSoundfile::test().
|
inline |
Find out the length of a string.
Definition at line 151 of file TTString.h.
References size().
Referenced by append(), and assign().
|
inline |
Cast to a C-string.
Definition at line 90 of file TTString.h.
|
inline |
Assign from a C-string.
Definition at line 98 of file TTString.h.
References assign().
|
inline |
Assign from a std::string.
Definition at line 106 of file TTString.h.
References assign().
|
inline |
Assign from a simple char.
Definition at line 114 of file TTString.h.
References resize().
void TTString::random | ( | ) |
Replace contents with a pseudo-random string.
Definition at line 13 of file TTString.cpp.
Referenced by TTSymbol::random().
|
inline |
Allocate memory for the string.
Definition at line 164 of file TTString.h.
Referenced by append(), assign(), operator=(), and substr().
|
inline |
Find out the length of a string.
Definition at line 144 of file TTString.h.
Referenced by append(), find_first_of(), find_last_of(), TTValue::fromString(), jamoma_edit_filename(), jamoma_edit_numeric_instance(), jamoma_edit_string_instance(), jamoma_patcher_get_info(), length(), TTWebSocket::SendMessage(), TTAddressBase::splitAt(), substr(), and TTValue::transformCSVStringToSymbolArray().
|
inline |
Returns a string object with its contents initialized to a substring of the current object.
pos | Position of a character in the current string object to be used as starting character for the substring. |
n | Length of the substring. |
Definition at line 342 of file TTString.h.
References resize(), and size().
Referenced by TTValue::fromString(), TTAddressBase::splitAt(), TTSoundfileLoader::test(), and TTSoundfile::test().