21 #define AFW_IMPLEMENTATION_ID "afw_stream_fd"
41 impl_afw_stream_fd_write_cb(
54 len = fwrite(buffer, size, 1, self->fd);
68 impl_afw_stream_release(
75 if (self->close_on_release) {
84 impl_afw_stream_flush(
124 len = fwrite(buffer, size, 1, self->fd);
130 if (self->auto_flush) {
155 self->pub.inf = &impl_afw_stream_inf;
157 self->pub.streamId = streamId;
158 self->pub.write_cb = impl_afw_stream_fd_write_cb;
160 self->auto_flush = auto_flush;
161 self->close_on_release = close_on_release;
191 fd = fopen(actual_path_z, mode_z);
200 for (c = mode_z; *c; c++) {
204 else if (*c ==
'w' || *c ==
'a') {
207 else if (*c ==
'+') {
213 allow_read, allow_write, auto_flush,
true, p, xctx);
AFW_DEFINE(const afw_object_t *)
#define AFW_DECLARE(type)
Declare a public afw function.
Adaptive Framework Core Internal.
Interface afw_interface implementation declares.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
apr_size_t afw_size_t
size_t.
#define AFW_THROW_ERROR_RV_Z(code, rv_source_id, rv, message_z, xctx)
Macro used to set error and rv in xctx and throw it.
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
void impl_afw_stream_write(const afw_stream_t *instance, const void *buffer, afw_size_t size, afw_xctx_t *xctx)
void impl_afw_stream_read(const afw_stream_t *instance, const void *buffer, afw_size_t size, afw_xctx_t *xctx)
afw_stream_fd_create(FILE *fd, const afw_utf8_t *streamId, afw_boolean_t allow_read, afw_boolean_t allow_write, afw_boolean_t auto_flush, afw_boolean_t close_on_release, const afw_pool_t *p, afw_xctx_t *xctx)
Create a stream to a file descriptor.
const afw_stream_t * afw_stream_fd_open_and_create(const afw_utf8_t *streamId, const afw_utf8_t *path, const afw_utf8_t *mode, afw_boolean_t auto_flush, const afw_pool_t *p, afw_xctx_t *xctx)
Open a file and create a stream for it.
const afw_utf8_z_t * afw_utf8_to_utf8_z(const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx)
Convert utf8 to utf8_z in specified pool.
#define afw_xctx_calloc_type(type, xctx)
Macro to allocate cleared memory to hold type in xctx's pool.
Interface afw_pool public struct.
Interface afw_stream public struct.
NFC normalized UTF-8 string.
Interface afw_xctx public struct.