NAME
src/pmc/stringbuilder.pmc - StringBuilder PMC Class
DESCRIPTION
TODO: Add description here.
Methods
void init()
Initializes the StringBuilder.
void init_int()
Initializes the StringBuilder with initial size of buffer.
void init_pmc()
Initializes the StringBuilder with an array of STRINGs.
void mark()
Mark the buffer.
STRING *get_string()
Returns created string.
STRING *push_string()
Append string to current buffer.
VTABLE i_concatenate_str()
VTABLE i_concatenate()
Append string.
Synonym for push_string
VTABLE set_string_native(STRING)
VTABLE set_pmc(PMC)
Set content of buffer to passed string or PMC
VTABLE get_integer()
Returns current capacity of allocated buffer.For testing purpose only?
VTABLE substr()
append_format(string fmt [, pmc args ] [, pmc hash ])
Add a line to a INTVAL get_string_length()
Returns length of currently built string.
StringBuilder
object according to fmt
.
The fmt
string can contain any number of "%-replacements" which are replaced by the corresponding values from args
or hash
prior to being appended to the string.
(Here args
is a slurpy array,
and hash
is a slurpy hash.)The currently defined replacements include:
%0 %1 ... %9 the value from the args array at index 0..9 %, the values of the args array separated by commas %% a percent signA percent-sign followed by any other character that is a hash key receives the value of the hash element.
Helper functions.
static size_t calculate_capacity(PARROT_INTERP, size_t needed)
Calculate capacity for string. We allocate double the amount needed.