OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
16 #include "../core/math_func.hpp"
17 #include "../string_func.h"
36 inline CStrA(
const OnTransfer &ot)
95 size_t addSize = std::max<size_t>(strlen(format), 16);
96 addSize += addSize / 2;
112 if (err != ERANGE && err != ENOENT && err != 0) {
128 int CDECL
WARN_FORMAT(2, 3) AddFormat(const
char *format, ...)
131 va_start(args, format);
138 int CDECL
WARN_FORMAT(2, 3) Format(const
char *format, ...)
142 va_start(args, format);
size_t GetReserve() const
Return number of additional items that can fit in the Blob without buffer reallocation.
Blob based case sensitive ANSI/UTF-8 string.
Blob - simple dynamic T array.
void Free()
free the blob's memory
char * GrowSizeNC(uint count)
Grow the actual buffer and fix the trailing zero at the end.
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
size_t Length() const
return the number of valid data bytes in the blob
size_t Size() const
Return number of items in the Blob.
int CDECL WARN_FORMAT(2, 3) AddFormat(const char *format
Add formatted string (like sprintf) at the end of existing contents.
void AppendStr(const char *str)
Append zero-ended C string.
CStrA & operator=(const char *src)
Assignment from C string.
CBlobT< char > base
base class
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
CStrA(const CStrA &src)
Copy constructor.
CStrA()
Create an empty CStrT.
int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
Safer implementation of vsnprintf; same as vsnprintf except:
int AddFormatL(const char *format, va_list args) WARN_FORMAT(2
Add formatted string (like vsprintf) at the end of existing contents.
void FixTail() const
fixing the four bytes at the end of blob data - useful when blob is used to hold string
bool operator<(const CStrA &other) const
Lower-than operator (to support stl collections)
void AppendRaw(const void *p, size_t num_bytes)
append new bytes at the end of existing data bytes - reallocates if necessary
char * MakeFreeSpace(size_t num_items)
Ensures that given number of items can be added to the end of Blob.
CStrA(const OnTransfer &ot)
Take over ownership constructor.
void Append(const CStrA &src)
Append another CStrA.
CStrA & operator=(const CStrA &src)
Assignment from another CStrA.
T * Data()
Return pointer to the first data item - non-const version.