103void pm_buffer_append_string(
pm_buffer_t *buffer, const
char *value,
size_t length);
112void pm_buffer_append_bytes(
pm_buffer_t *buffer, const uint8_t *value,
size_t length);
120void pm_buffer_append_byte(
pm_buffer_t *buffer, uint8_t value);
128void pm_buffer_append_varuint(
pm_buffer_t *buffer, uint32_t value);
136void pm_buffer_append_varsint(
pm_buffer_t *buffer, int32_t value);
144void pm_buffer_append_double(
pm_buffer_t *buffer,
double value);
154bool pm_buffer_append_unicode_codepoint(
pm_buffer_t *buffer, uint32_t value);
161 PM_BUFFER_ESCAPING_RUBY,
162 PM_BUFFER_ESCAPING_JSON
bool pm_buffer_init_capacity(pm_buffer_t *buffer, size_t capacity)
Initialize a pm_buffer_t with the given capacity.
PRISM_EXPORTED_FUNCTION size_t pm_buffer_sizeof(void)
Return the size of the pm_buffer_t struct.
size_t pm_buffer_index(const pm_buffer_t *buffer, char value)
Checks if the buffer includes the given value.
void pm_buffer_append_format(pm_buffer_t *buffer, const char *format,...) PRISM_ATTRIBUTE_FORMAT(2
Append a formatted string to the buffer.
pm_buffer_escaping_t
The different types of escaping that can be performed by the buffer when appending a slice of Ruby so...
void pm_buffer_append_zeroes(pm_buffer_t *buffer, size_t length)
Append the given amount of space as zeroes to the buffer.
void pm_buffer_append_source(pm_buffer_t *buffer, const uint8_t *source, size_t length, pm_buffer_escaping_t escaping)
Append a slice of source code to the buffer.
void pm_buffer_prepend_string(pm_buffer_t *buffer, const char *value, size_t length)
Prepend the given string to the buffer.
void pm_buffer_rstrip(pm_buffer_t *buffer)
Strip the whitespace from the end of the buffer.
void pm_buffer_insert(pm_buffer_t *buffer, size_t index, const char *value, size_t length)
Insert the given string into the buffer at the given index.
void pm_buffer_concat(pm_buffer_t *destination, const pm_buffer_t *source)
Concatenate one buffer onto another.
void pm_buffer_clear(pm_buffer_t *buffer)
Clear the buffer by reducing its size to 0.
Functions for working with characters and strings.
Macro definitions used throughout the prism library.
#define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
Certain compilers support specifying that a function accepts variadic parameters that look like print...
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
A pm_buffer_t is a simple memory buffer that stores data in a contiguous block of memory.
size_t capacity
The capacity of the buffer in bytes that has been allocated.
size_t length
The length of the buffer in bytes.
char * value
A pointer to the start of the buffer.