38 if (len != other.
length()) {
47 if ((us ==
nullptr) or (other ==
nullptr)) {
52 const size_t result =
static_cast<size_t>(strncmp(us, other, capacity));
58 va_start(args, formatString);
59 this->
vformat(formatString, args);
68 #if FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING
69 (void) vsnprintf(us, cap, formatString, args);
85 #if FW_SERIALIZABLE_TO_STRING || BUILD_UT
86 void StringBase::toString(
StringBase& text)
const {
92 std::ostream& operator<<(std::ostream& os,
const StringBase& str) {
118 if (size < remaining) {
122 (void)strncat(
const_cast<CHAR*
>(this->
toChar()), buff, remaining);
#define FW_MIN(a, b)
MIN macro.
uint8_t U8
8-bit unsigned integer
PlatformAssertArgType FwAssertArgType
PlatformSizeType FwSizeType
NATIVE_UINT_TYPE SizeType
@ INCLUDE_LENGTH
Include length as first token in serialization.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
virtual const CHAR * toChar() const =0
bool operator!=(const StringBase &other) const
Inequality with StringBase.
NATIVE_UINT_TYPE SizeType
SizeType serializedTruncatedSize(FwSizeType maxLength) const
virtual SerializeStatus deserialize(SerializeBufferBase &buffer)
deserialization function
void format(const CHAR *formatString,...)
write formatted string to buffer
SizeType length() const
Get length of string.
bool operator==(const StringBase &other) const
Check for equality with StringBase.
SizeType maxLength() const
Get the maximum length of a string that the buffer can hold (which is capacity - 1)
void appendBuff(const CHAR *buff, SizeType size)
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
virtual SizeType getCapacity() const =0
return size of buffer
const CHAR * operator+=(const CHAR *src)
Concatenate a CHAR*.
StringBase & operator=(const CHAR *src)
Assign CHAR*.
SizeType serializedSize() const
void vformat(const CHAR *formatString, va_list args)
write formatted string to buffer using va_list
FwSizeType string_length(const CHAR *source, FwSizeType buffer_size)
get the length of the source string
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.