This class is a cut-down version of std::string. More...
Public Member Functions | |
const char * | c_str () const |
Obtains a pointer to a null-terminated string representing the content of the WireTapStr object. More... | |
void | clear () |
bool | isEmpty () const |
unsigned int | length () const |
Gets the length of the string (in bytes) contained in the WireTrapStr object. More... | |
operator const char * () const | |
Operator that implicitly converts a WireTapStr object to a null-terminated string so that a WireTapStr object can be used wherever a string is required. More... | |
bool | operator!= (const WireTapStr &stringObject) const |
bool | operator!= (const char *aString) const |
WireTapStr & | operator+= (const WireTapStr &src) |
Concatenate operator. More... | |
WireTapStr & | operator+= (const char *src) |
Concatenate operator. More... | |
WireTapStr & | operator+= (const char src) |
Concatenate operator. More... | |
bool | operator< (const WireTapStr &stringObject) const |
WireTapStr & | operator= (const WireTapStr &src) |
Assignment operator. More... | |
WireTapStr & | operator= (WireTapStr &&src) noexcept |
Move assignement operator. More... | |
WireTapStr & | operator= (const char *src) |
Assignment operator. More... | |
bool | operator== (const WireTapStr &stringObject) const |
Comparison operator used for two WireTapStr objects. More... | |
bool | operator== (const char *aString) const |
Comparison operator used for a WireTapStr object and a null-terminated string. More... | |
char | operator[] (unsigned int index) const |
Operator used to access a character in a WireTapStr object. More... | |
void | reset () |
Resets the WireTapStr so it contains an empty null-terminated string. More... | |
WireTapStr (const char *str=nullptr) | |
Constructs a WireTapStr object from a null-terminated string. More... | |
WireTapStr (const char *str, unsigned int len) | |
Constructs a WireTapStr object from the first to len characters of a null-terminated string. More... | |
WireTapStr (const WireTapStr &original) | |
Copy constructor. More... | |
WireTapStr (WireTapStr &&original) noexcept | |
Move constructor. More... | |
virtual | ~WireTapStr () |
Destructor. More... | |
Public Attributes | |
WireTapStr | const |
Sub String generator. More... | |
This class is a cut-down version of std::string.
API libraries often redefine standard library data types (like std::string) to avoid problems when a host application chooses a different standard C library from the one used by the API library. The Wiretap API includes WireTapStr for this reason. This means Wiretap clients must duplicate strings when converting from WireTapStr to their own string class for internal use.
WireTapStr::WireTapStr | ( | const char * | str = nullptr ) |
Constructs a WireTapStr object from a null-terminated string.
WireTapStr::WireTapStr | ( | const char * | str, |
unsigned int | len | ||
) |
Constructs a WireTapStr object from the first to len characters of a null-terminated string.
WireTapStr::WireTapStr | ( | const WireTapStr & | original) |
Copy constructor.
Constructs a WireTapStr object duplicating the content of the original.
original | An input parameter. The WireTapStr object that is to be copied. |
|
noexcept |
Move constructor.
Constructs a WireTapStr object by moving the content of the original.
original | An input parameter. The WireTapStr object that is to be moved. |
|
virtual |
Destructor.
const char* WireTapStr::c_str | ( | ) | const |
Obtains a pointer to a null-terminated string representing the content of the WireTapStr object.
void WireTapStr::clear | ( | ) |
Clear the content of the string.
bool WireTapStr::isEmpty | ( | ) | const |
unsigned int WireTapStr::length | ( | ) | const |
Gets the length of the string (in bytes) contained in the WireTrapStr object.
WireTapStr::operator const char * | ( | ) | const |
Operator that implicitly converts a WireTapStr object to a null-terminated string so that a WireTapStr object can be used wherever a string is required.
bool WireTapStr::operator!= | ( | const WireTapStr & | stringObject) | const |
bool WireTapStr::operator!= | ( | const char * | aString) | const |
WireTapStr& WireTapStr::operator+= | ( | const WireTapStr & | src) |
Concatenate operator.
src | An input parameter. Its content will be concatenated to this WireTapStr object. |
WireTapStr& WireTapStr::operator+= | ( | const char * | src) |
Concatenate operator.
src | An input parameter. A null-terminated string. Its content will be concatenated to this WireTapStr object. |
WireTapStr& WireTapStr::operator+= | ( | const char | src) |
Concatenate operator.
src | An input parameter. A character. Its value will be concatenated to this WireTapStr object. |
bool WireTapStr::operator< | ( | const WireTapStr & | stringObject) | const |
WireTapStr& WireTapStr::operator= | ( | const WireTapStr & | src) |
Assignment operator.
src | An input parameter. Its content will be copied to this WireTapStr object. |
|
noexcept |
Move assignement operator.
Constructs a WireTapStr object by moving the content of the original.
src | An input parameter. The WireTapStr object that is to be moved. |
WireTapStr& WireTapStr::operator= | ( | const char * | src) |
Assignment operator.
src | An input parameter. A null-terminated string. Its content will be copied to this WireTapStr object. |
bool WireTapStr::operator== | ( | const WireTapStr & | stringObject) | const |
Comparison operator used for two WireTapStr objects.
stringObject |
bool WireTapStr::operator== | ( | const char * | aString) | const |
Comparison operator used for a WireTapStr object and a null-terminated string.
aString |
char WireTapStr::operator[] | ( | unsigned int | index) | const |
Operator used to access a character in a WireTapStr object.
index | An input parameter. A valid index on the string represented by the WireTapStr object. Indices start at 0. The length of the string can be obtained by calling the WireTapStr.length method. |
void WireTapStr::reset | ( | ) |
Resets the WireTapStr so it contains an empty null-terminated string.
WireTapStr WireTapStr::const |
Sub String generator.
pos | An input parameter. Position of the first character to be copied as a substring. If this is equal or greater to the string length, the function returns an empty string. |
len | An input parameter. Number of characters to include in the substring (if the string is shorter, as many characters as possible are used). |