18 #include "../core/math_func.hpp" 19 #include "../string_func.h" 38 inline CStrA(
const OnTransfer &ot)
97 size_t addSize = max<size_t>(strlen(format), 16);
98 addSize += addSize / 2;
114 if (err != ERANGE && err != ENOENT && err != 0) {
130 int CDECL
WARN_FORMAT(2, 3) AddFormat(
const char *format, ...)
133 va_start(args, format);
140 int CDECL
WARN_FORMAT(2, 3) Format(
const char *format, ...)
144 va_start(args, format);
CStrA & operator=(const char *src)
Assignment from C string.
CStrA & operator=(const CStrA &src)
Assignment from another CStrA.
CBlobT< char > base
base class
int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
Safer implementation of vsnprintf; same as vsnprintf except:
bool operator<(const CStrA &other) const
Lower-than operator (to support stl collections)
size_t GetReserve() const
Return number of additional items that can fit in the Blob without buffer reallocation.
int AddFormatL(const char *format, va_list args)
Add formated string (like vsprintf) at the end of existing contents.
size_t Length() const
return the number of valid data bytes in the blob
Blob - simple dynamic T array.
CStrA()
Create an empty CStrT.
CStrA(const OnTransfer &ot)
Take over ownership constructor.
char * GrowSizeNC(size_t num_items)
Grow number of data items in Blob by given number - doesn't construct items.
void Clear()
invalidate blob's data - doesn't free buffer
Blob based case sensitive ANSI/UTF-8 string.
char * GrowSizeNC(uint count)
Grow the actual buffer and fix the trailing zero at the end.
Support for storing random binary data.
void Append(const CStrA &src)
Append another CStrA.
char * MakeFreeSpace(size_t num_items)
Ensures that given number of items can be added to the end of Blob.
CStrA(const CStrA &src)
Copy constructor.
int CDECL WARN_FORMAT(2, 3) AddFormat(const char *format
Add formated string (like sprintf) at the end of existing contents.
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
T * Data()
Return pointer to the first data item - non-const version.
void AppendRaw(const void *p, size_t num_bytes)
append new bytes at the end of existing data bytes - reallocates if necessary
size_t Size() const
Return number of items in the Blob.
void Free()
free the blob's memory
void FixTail() const
fixing the four bytes at the end of blob data - useful when blob is used to hold string ...
void AppendStr(const char *str)
Append zero-ended C string.