O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
string.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
3/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
4/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
5/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
6/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
7/* */
14/* ************************************************************************** */
15
17
20{
21 return cstring_input_stream(value->start, value->count);
22}
23
25istream_t cstring_input_stream(const char* value, size_t length)
26{
28
29 queue_push_n(&result.buffer, value, length);
30 return result;
31}
bool istream_has_at_least(const istream_t *self, size_t count)
Test if enough characters are available.
Definition input.c:37
#define InputStreamInit(Size, Accumulate)
Convenient wrapper around istream_init that casts Accumulate.
bool queue_push_n(queue_t *self, const void *elements, size_t count)
Add count elements to the queue.
Definition queue.c:31
istream_t cstring_input_stream(const char *value, size_t length)
Create an input stream with the content of a C string.
Definition string.c:25
istream_t string_input_stream(const string_t *value)
Create an input stream with the content of a string.
Definition string.c:19
array_t string_t
A string is an array of char.
Definition string.h:30
Create input streams from strings.
void * start
Underlying storage.
Definition array.h:25
size_t count
Number of elements currently stored.
Definition array.h:27
Input Stream.
queue_t buffer
Circular buffer of bytes.