 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
25 return new std::string;
33 char* dat = strdup(sb->c_str());
62 const int MAX_DIGITS = 20;
65 for (i = 0; i < MAX_DIGITS; i++) {
66 buf[i] = x % 10 +
'0';
74 for (
int j = i - 1; j >= 0; j--) {
81 va_start(arg, format);
83 vsnprintf(
buf,
sizeof(
buf), format, arg);
100 if (!content || *content ==
'\0') {
108 if ((*content !=
'\0') && (sb->back() !=
'\n')) {
126 while (isspace(sb->back())) {
size_t stringbuffer_length(StringBuffer *sb)
Return the current length of the buffer.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
static event_registration c
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
void stringbuffer_append_char(StringBuffer *sb, const char c)
Append a character to a string buffer instance.
#define HUGE_BUF
Used for messages - some can be quite long.
void stringbuffer_append_int64(StringBuffer *sb, int64_t x)
Append a signed integer to a string buffer instance.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
sstring stringbuffer_finish_shared(StringBuffer *sb)
Deallocate the string buffer instance and return the string as a shared string.
sstring add_string(const char *str)
Share a string.
std::string StringBuffer
The string buffer state.
static void stringbuffer_ensure(StringBuffer *sb, size_t len)
Ensure sb can hold at least len more characters, growing the sb if not.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
void stringbuffer_append_multiline_block(StringBuffer *sb, const char *start, const char *content, const char *end)
Append the specified content in a multiline block, starting with "start" and ending with "end".
void stringbuffer_trim_whitespace(StringBuffer *sb)
Trim trailing whitespace from a stringbuffer.
void stringbuffer_delete(StringBuffer *sb)
Totally delete a string buffer.
const typedef char * sstring
void stringbuffer_append_stringbuffer(StringBuffer *sb, const StringBuffer *sb2)
Append the contents of a string buffer instance to another string buffer instance.