class StringWriter

Defined at line 384 of file ../../third_party/openthread/src/core/common/string.hpp

Implements writing to a string buffer.

Public Methods

void StringWriter (char * aBuffer, uint16_t aSize)

Initializes the object as cleared on the provided buffer.

Parameters

aBuffer [in] A pointer to the char buffer to write into.
aSize [in] The size of
StringWriter & Clear ()

Clears the string writer.

StringWriter & Append (const char * aFormat)

Appends `printf()` style formatted data to the buffer.

Parameters

aFormat [in] A pointer to the format string.
... [in] Arguments for the format specification.
StringWriter & AppendVarArgs (const char * aFormat, va_list aArgs)

Appends `printf()` style formatted data to the buffer.

Parameters

aFormat [in] A pointer to the format string.
aArgs [in] Arguments for the format specification (as `va_list`).
StringWriter & AppendHexBytes (const uint8_t * aBytes, uint16_t aLength)

Appends an array of bytes in hex representation (using "%02x" style) to the buffer.

Parameters

aBytes [in] A pointer to buffer containing the bytes to append.
aLength [in] The length of buffer (in bytes).
StringWriter & AppendCharMultipleTimes (char aChar, uint16_t aCount)

Appends a given character a given number of times.

Parameters

aChar [in] The character to append.
aCount [in] Number of times to append
bool IsTruncated ()

Returns whether the output is truncated.

Defined at line 410 of file ../../third_party/openthread/src/core/common/string.hpp

uint16_t GetLength ()

Gets the length of the wanted string.

Similar to `strlen()` the length does not include the null character at the end of the string.

Defined at line 419 of file ../../third_party/openthread/src/core/common/string.hpp

uint16_t GetSize ()

Returns the size (number of chars) in the buffer.

Defined at line 426 of file ../../third_party/openthread/src/core/common/string.hpp

void ConvertToLowercase ()

Converts all uppercase letter characters in the string to lowercase.

Defined at line 469 of file ../../third_party/openthread/src/core/common/string.hpp

void ConvertToUppercase ()

Converts all lowercase letter characters in the string to uppercase.

Defined at line 474 of file ../../third_party/openthread/src/core/common/string.hpp