20 apr_array_header_t *ary;
25 #define AFW_IMPLEMENTATION_ID "afw_utf8_writer"
32 impl_afw_writer_write_raw_cb(
42 for (i = 0; i < size; i++) {
43 APR_ARRAY_PUSH(self->ary,
char) =
64 self->pub.inf = &impl_afw_writer_inf;
66 self->pub.write_raw_cb = impl_afw_writer_write_raw_cb;
85 if (writer->inf != &impl_afw_writer_inf) {
87 "afw_utf8_writer_get_string() can only be called by writer "
88 "created by afw_utf8_writer_create()", xctx);
90 current_string->s =
self->ary->elts;
91 current_string->len =
self->ary->nelts;
99 impl_afw_writer_release(
114 impl_afw_writer_flush(
140 if (self->needs_leading_white_space) {
141 for (count = 0; count <
self->pub.indent; count++) {
142 for (i = 0; i <
self->pub.tab->len; i++) {
143 APR_ARRAY_PUSH(self->ary,
char) =
self->pub.tab->s[i];
146 self->needs_leading_white_space =
false;
150 for (count = 0; count < size; count++) {
151 APR_ARRAY_PUSH(self->ary,
char) = *c++;
168 APR_ARRAY_PUSH(self->ary,
char) =
'\n';
169 self->needs_leading_white_space =
true;
177 impl_afw_writer_increment_indent(
191 impl_afw_writer_decrement_indent(
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
Interface afw_interface implementation declares.
apr_size_t afw_size_t
size_t.
unsigned char afw_octet_t
8 bits (unsigned).
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_release(instance, xctx)
Call method release of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
const afw_pool_t * afw_pool_create(const afw_pool_t *parent, afw_xctx_t *xctx)
Create a new pool.
afw_utf8_writer_current_string(const afw_writer_t *writer, afw_utf8_t *current_string, afw_xctx_t *xctx)
Get the current string in a UTF-8 writer.
afw_utf8_writer_create(const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx)
Create UTF-8 writer.
impl_afw_writer_write(const afw_writer_t *instance, const void *buffer, afw_size_t size, afw_xctx_t *xctx)
impl_afw_writer_write_eol(const afw_writer_t *instance, afw_xctx_t *xctx)
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Interface afw_writer public struct.
Interface afw_xctx public struct.