41 va_start(args, formatString);
52 static_assert(std::numeric_limits<FwSizeType>::max() >= std::numeric_limits<SizeType>::max(),
53 "String size type must fit into FwSizeType");
54 return Fw::stringFormat(us, static_cast<FwSizeType>(cap), formatString, args);
57 #if FW_SERIALIZABLE_TO_STRING || BUILD_UT 58 void StringBase::toString(
StringBase& text)
const {
84 FW_ASSERT(capacity >
length, static_cast<FwAssertArgType>(capacity), static_cast<FwAssertArgType>(
length));
87 if (size < remaining) {
90 FW_ASSERT(remaining < capacity, static_cast<FwAssertArgType>(remaining), static_cast<FwAssertArgType>(capacity));
91 (void)strncat(const_cast<CHAR*>(this->
toChar()), buff,
static_cast<size_t>(remaining));
109 FW_ASSERT(actualSize <= maxSize, static_cast<FwAssertArgType>(actualSize),
110 static_cast<FwAssertArgType>(maxSize));
Serialization/Deserialization operation was successful.
SerializeStatus deserializeFrom(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) override
Deserialize the contents of this object from a buffer.
const CHAR * operator+=(const CHAR *src)
Concatenate a CHAR*.
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
FormatStatus vformat(const CHAR *formatString, va_list args)
write formatted string to buffer using va_list
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
virtual SizeType getCapacity() const =0
Return the size of the buffer.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
SizeType maxLength() const
Get the maximum length of a string that the buffer can hold (which is capacity - 1) ...
A read-only abstract superclass for StringBase.
void appendBuff(const CHAR *buff, SizeType size)
StringBase & operator=(const CHAR *src)
Assign CHAR*.
FormatStatus stringFormat(char *destination, const FwSizeType maximumSize, const char *formatString,...)
format a c-string
Include length as first token in serialization.
virtual SizeType length() const
Get the length of the string.
Implementation of malloc based allocator.
FwSizeType string_length(const CHAR *source, FwSizeType buffer_size)
get the length of the source string
FormatStatus
status of string format calls