Adaptive Framework
0.9.0
|
Files | |
file | afw_stream.h |
Adaptive Framework Stream Implementation Header. | |
Data Structures | |
struct | afw_stream_anchor_s |
struct for common xctx streams More... | |
Macros | |
#define | afw_stream_standard(enum_suffix, xctx) |
Get xctx stream instance. More... | |
#define | afw_stream_standard_is_set(enum_suffix, xctx) ((xctx)->stream_anchor->streams[afw_stream_number_ ## enum_suffix] != NULL ) |
Determine if an xctx's standard stream is set. More... | |
#define | afw_stream_standard_set(enum_suffix, stream, xctx) |
Set xctx's enum_suffix stream. More... | |
#define | afw_stream_standard_release(enum_suffix, xctx) |
Release an xctx's stream. More... | |
#define | afw_stream_write_z(writer, s_z, xctx) afw_stream_write(writer, s_z, strlen(s_z), xctx) |
Call afw_stream_write() with zero terminated string. More... | |
#define | afw_stream_write_eol(writer, xctx) afw_stream_write(writer, "\n", strlen("\n"), xctx) |
Write eol char to stream. More... | |
#define | afw_stream_write_utf8(writer, S, xctx) afw_stream_write(writer, (S)->s, (S)->len, xctx) |
Call afw_stream_write() with a afw_utf8_t string. More... | |
Enumerations | |
enum | afw_stream_number_t { afw_stream_number_raw_response_body , afw_stream_number_response_body , afw_stream_number_console , afw_stream_number_stderr , afw_stream_number_stdout , afw_stream_number_count } |
enum for common xctx streams | |
Functions | |
void | afw_stream_get_by_streamId (const afw_utf8_t *streamId, const afw_stream_t **stream, afw_size_t *streamNumber, afw_xctx_t *xctx) |
Get stream by streamId and streamNumber. More... | |
const afw_stream_t * | afw_stream_get_by_streamNumber (const afw_integer_t streamNumber, afw_xctx_t *xctx) |
Get stream by streamNumber. More... | |
afw_size_t | afw_stream_get_streamNumber_for_streamId (const afw_utf8_t *streamId, afw_xctx_t *xctx) |
Get streamNumber for streamId. More... | |
afw_size_t | afw_stream_set (const afw_stream_t *stream, afw_xctx_t *xctx) |
Set an opening stream and get its streamNumber. More... | |
const afw_stream_t * | afw_stream_standard_impl (afw_stream_number_t n, afw_xctx_t *xctx) |
Implementation for get xctx standard stream instance. More... | |
void | afw_stream_write_integer (const afw_stream_t *writer, afw_integer_t integer, afw_xctx_t *xctx) |
Call afw_stream_write() with an integer. More... | |
void | afw_stream_write_size (const afw_stream_t *writer, afw_size_t size, afw_xctx_t *xctx) |
Call afw_stream_write() with an size. More... | |
const afw_stream_t * | 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. More... | |
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. More... | |
afw_stream_internal_stream_anchor_create (afw_xctx_t *xctx) | |
afw_stream_internal_release_all_streams (afw_xctx_t *xctx) | |
Adaptive Framework Stream.
#define afw_stream_standard | ( | enum_suffix, | |
xctx | |||
) |
Get xctx stream instance.
enum_suffix | is appended to afw_stream_number_ |
xctx | of caller. |
Definition at line 122 of file afw_stream.h.
#define afw_stream_standard_is_set | ( | enum_suffix, | |
xctx | |||
) | ((xctx)->stream_anchor->streams[afw_stream_number_ ## enum_suffix] != NULL ) |
Determine if an xctx's standard stream is set.
enum_suffix | is appended to afw_stream_number_ |
xctx | of caller. |
Definition at line 134 of file afw_stream.h.
#define afw_stream_standard_release | ( | enum_suffix, | |
xctx | |||
) |
Release an xctx's stream.
enum_suffix | is appended to afw_stream_number_ |
xctx | of caller. |
Note: afw_stream_console_stream() will get a new one if called.
Definition at line 161 of file afw_stream.h.
#define afw_stream_standard_set | ( | enum_suffix, | |
stream, | |||
xctx | |||
) |
Set xctx's enum_suffix stream.
enum_suffix | is appended to afw_stream_number_ |
stream | |
xctx | of caller. |
Definition at line 146 of file afw_stream.h.
#define afw_stream_write_eol | ( | writer, | |
xctx | |||
) | afw_stream_write(writer, "\n", strlen("\n"), xctx) |
Write eol char to stream.
writer | instance. |
xctx | of caller. |
Definition at line 188 of file afw_stream.h.
#define afw_stream_write_utf8 | ( | writer, | |
S, | |||
xctx | |||
) | afw_stream_write(writer, (S)->s, (S)->len, xctx) |
Call afw_stream_write() with a afw_utf8_t string.
writer | instance. |
s | utf8 string. |
xctx | of caller. |
Definition at line 199 of file afw_stream.h.
#define afw_stream_write_z | ( | writer, | |
s_z, | |||
xctx | |||
) | afw_stream_write(writer, s_z, strlen(s_z), xctx) |
Call afw_stream_write() with zero terminated string.
writer | instance. |
s_z | zero terminated string to write. |
xctx | of caller. |
Definition at line 178 of file afw_stream.h.
const afw_stream_t* 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.
fd | opened file descriptor. |
streamId | |
allow_read | |
allow_write | |
auto_flush | after each write. |
close_on_release | true closes fd on release call. |
p | to use. |
xctx | of caller. |
Definition at line 138 of file afw_stream_fd.c.
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.
streamId | |
path | |
mode | |
auto_flush | |
p | to use. |
xctx | of caller. |
Definition at line 171 of file afw_stream_fd.c.
void afw_stream_get_by_streamId | ( | const afw_utf8_t * | streamId, |
const afw_stream_t ** | stream, | ||
afw_size_t * | streamNumber, | ||
afw_xctx_t * | xctx | ||
) |
Get stream by streamId and streamNumber.
streamId. | |
stream | return pointer. |
streamNumber | return pointer. |
xctx | of caller. |
Definition at line 19 of file afw_stream.c.
const afw_stream_t* afw_stream_get_by_streamNumber | ( | const afw_integer_t | streamNumber, |
afw_xctx_t * | xctx | ||
) |
Get stream by streamNumber.
streamNumber. | |
xctx | of caller. |
Definition at line 68 of file afw_stream.c.
afw_size_t afw_stream_get_streamNumber_for_streamId | ( | const afw_utf8_t * | streamId, |
afw_xctx_t * | xctx | ||
) |
Get streamNumber for streamId.
streamId. | |
xctx | of caller. |
Definition at line 97 of file afw_stream.c.
afw_size_t afw_stream_set | ( | const afw_stream_t * | stream, |
afw_xctx_t * | xctx | ||
) |
Set an opening stream and get its streamNumber.
stream. | |
xctx | of caller. |
Definition at line 114 of file afw_stream.c.
const afw_stream_t* afw_stream_standard_impl | ( | afw_stream_number_t | n, |
afw_xctx_t * | xctx | ||
) |
Implementation for get xctx standard stream instance.
n | of streams indexed by afw_stream_number_t. |
xctx | of caller. |
Definition at line 150 of file afw_stream.c.
void afw_stream_write_integer | ( | const afw_stream_t * | writer, |
afw_integer_t | integer, | ||
afw_xctx_t * | xctx | ||
) |
Call afw_stream_write() with an integer.
writer | instance. |
integer | to write as as string. |
xctx | of caller. |
Definition at line 341 of file afw_stream.c.
void afw_stream_write_size | ( | const afw_stream_t * | writer, |
afw_size_t | size, | ||
afw_xctx_t * | xctx | ||
) |
Call afw_stream_write() with an size.
writer | instance. |
size | to write as string. |
xctx | of caller. |
Definition at line 357 of file afw_stream.c.