21#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
22#error "#include <rlib.h> only please."
#define R_ATTR_WARN_UNUSED_RESULT
Warn if a function's return value is ignored.
Definition rmacros.h:278
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
R_ATTR_WARN_UNUSED_RESULT RString * r_string_new_sized(rsize size)
Allocate an empty RString with size bytes of buffer reserved up front.
rsize r_string_prepend_len(RString *str, const rchar *cstr, rsize len)
Prepend len bytes from cstr to the front of str.
void r_string_free(RString *str)
Free the RString and its backing buffer.
rsize r_string_overwrite(RString *str, rsize pos, const rchar *cstr)
Overwrite bytes starting at pos with cstr.
rsize r_string_prepend_printf(RString *str, const rchar *fmt,...)
printf-format and prepend the result to the front of str.
rsize r_string_append_vprintf(RString *str, const rchar *fmt, va_list ap)
va_list flavour of r_string_append_printf.
rsize r_string_truncate(RString *str, rsize len)
Trim str to len bytes (no-op, returning 0, if already shorter).
int r_string_cmp_cstr(RString *str, const rchar *cstr)
Byte-compare an RString against a NUL-terminated C string.
rsize r_string_alloc_size(RString *str)
Capacity of the underlying buffer in bytes.
struct RString RString
Opaque heap-allocated mutable string.
Definition rstring.h:56
rsize r_string_insert(RString *str, rsize pos, const rchar *cstr)
Insert cstr at byte offset pos, sliding the existing tail to the right.
rsize r_string_length(RString *str)
Current length in bytes (excluding the terminating NUL).
rsize r_string_append(RString *str, const rchar *cstr)
Append a NUL-terminated C string to str.
R_ATTR_WARN_UNUSED_RESULT RString * r_string_new(const rchar *cstr)
Allocate an RString seeded from the NUL-terminated cstr.
rsize r_string_append_len(RString *str, const rchar *cstr, rsize len)
Append len bytes from cstr to str.
rsize r_string_overwrite_len(RString *str, rsize pos, const rchar *cstr, rsize len)
Length-bounded variant of r_string_overwrite.
int r_string_cmp(RString *str1, RString *str2)
Byte-compare two RString contents. Behaves like r_strcmp.
rsize r_string_prepend(RString *str, const rchar *cstr)
Prepend a NUL-terminated C string to the front of str.
rsize r_string_erase(RString *str, rsize pos, rsize len)
Remove len bytes starting at byte offset pos (clamped to the end of the string).
rsize r_string_prepend_vprintf(RString *str, const rchar *fmt, va_list ap)
va_list flavour of r_string_prepend_printf.
R_ATTR_WARN_UNUSED_RESULT rchar * r_string_free_keep(RString *str)
Free the RString struct but return its inner rchar *.
rsize r_string_insert_len(RString *str, rsize pos, const rchar *cstr, rsize len)
Length-bounded variant of r_string_insert.
rsize r_string_reset(RString *str, const rchar *cstr)
Discard the current contents and seed str from a fresh NUL-terminated C string.
rsize r_string_append_printf(RString *str, const rchar *fmt,...)
printf-format and append the result to str.
rsize r_string_append_c(RString *str, rchar c)
Append a single byte to str.
char rchar
Default character type (char).
Definition rtypes.h:137
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290
Foundational type aliases used by every rlib header.