Wiretap API  <small>Wiretap 2020.1</small>
WireTapStr Class Reference

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
 
WireTapStroperator+= (const WireTapStr &src)
 Concatenate operator. More...
 
WireTapStroperator+= (const char *src)
 Concatenate operator. More...
 
WireTapStroperator+= (const char src)
 Concatenate operator. More...
 
bool operator< (const WireTapStr &stringObject) const
 
WireTapStroperator= (const WireTapStr &src)
 Assignment operator. More...
 
WireTapStroperator= (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=0)
 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...
 
virtual ~WireTapStr ()
 Destructor. More...
 

Public Attributes

WireTapStr const
 Sub String generator. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

§ WireTapStr() [1/3]

WireTapStr::WireTapStr ( const char *  str = 0)

Constructs a WireTapStr object from a null-terminated string.

§ WireTapStr() [2/3]

WireTapStr::WireTapStr ( const char *  str,
unsigned int  len 
)

Constructs a WireTapStr object from the first to len characters of a null-terminated string.

§ WireTapStr() [3/3]

WireTapStr::WireTapStr ( const WireTapStr original)

Copy constructor.

Constructs a WireTapStr object duplicating the content of the original.

Parameters
originalAn input parameter. The WireTapStr object that is to be copied.

§ ~WireTapStr()

virtual WireTapStr::~WireTapStr ( )
virtual

Destructor.

Member Function Documentation

§ c_str()

const char* WireTapStr::c_str ( ) const

Obtains a pointer to a null-terminated string representing the content of the WireTapStr object.

Returns
A pointer to the null-terminated string that represents the content of the WireTapStr object. The pointer must be used immediately.

§ clear()

void WireTapStr::clear ( )

Clear the content of the string.

§ isEmpty()

bool WireTapStr::isEmpty ( ) const
Returns
A boolean that indicates if the string is empty or not.

§ length()

unsigned int WireTapStr::length ( ) const

Gets the length of the string (in bytes) contained in the WireTrapStr object.

Returns
An unsigned integer that indicates how many characters (not including the null-terminator) are contained in the WireTapStr object.

§ operator const char *()

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.

See also
The explicit conversion method, WireTapStr.c_str.
Returns
A null-terminated string whose content is identical to that in the WireTapStr object.

§ operator!=() [1/2]

bool WireTapStr::operator!= ( const WireTapStr stringObject) const

§ operator!=() [2/2]

bool WireTapStr::operator!= ( const char *  aString) const

§ operator+=() [1/3]

WireTapStr& WireTapStr::operator+= ( const WireTapStr src)

Concatenate operator.

Parameters
srcAn input parameter. Its content will be concatenated to this WireTapStr object.
Returns
A reference to this WireTapStr object.

§ operator+=() [2/3]

WireTapStr& WireTapStr::operator+= ( const char *  src)

Concatenate operator.

Parameters
srcAn input parameter. A null-terminated string. Its content will be concatenated to this WireTapStr object.
Returns
A reference to this WireTapStr object.

§ operator+=() [3/3]

WireTapStr& WireTapStr::operator+= ( const char  src)

Concatenate operator.

Parameters
srcAn input parameter. A character. Its value will be concatenated to this WireTapStr object.
Returns
A reference to this WireTapStr object.

§ operator<()

bool WireTapStr::operator< ( const WireTapStr stringObject) const

§ operator=() [1/2]

WireTapStr& WireTapStr::operator= ( const WireTapStr src)

Assignment operator.

Parameters
srcAn input parameter. Its content will be copied to this WireTapStr object.
Returns
A reference to this WireTapStr object.

§ operator=() [2/2]

WireTapStr& WireTapStr::operator= ( const char *  src)

Assignment operator.

Parameters
srcAn input parameter. A null-terminated string. Its content will be copied to this WireTapStr object.
Returns
A reference to this WireTapStr object.

§ operator==() [1/2]

bool WireTapStr::operator== ( const WireTapStr stringObject) const

Comparison operator used for two WireTapStr objects.

Parameters
stringObject
Returns
true if the two strings represented by the objects are identical, etc

§ operator==() [2/2]

bool WireTapStr::operator== ( const char *  aString) const

Comparison operator used for a WireTapStr object and a null-terminated string.

Parameters
aString
Returns
true if the string represented by the WireTapStr object and the the null-terminated string are identical.

§ operator[]()

char WireTapStr::operator[] ( unsigned int  index) const

Operator used to access a character in a WireTapStr object.

Parameters
indexAn 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.
Returns
The character at the specified index in the string represented by the WireTapStr object.

§ reset()

void WireTapStr::reset ( )

Resets the WireTapStr so it contains an empty null-terminated string.

Member Data Documentation

§ const

WireTapStr WireTapStr::const

Sub String generator.

Parameters
posAn 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.
lenAn input parameter. Number of characters to include in the substring (if the string is shorter, as many characters as possible are used).
Returns
A reference to this WireTapStr object.

The documentation for this class was generated from the following file: