O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
input_stream.h File Reference

Buffered input streams. More...

#include "o2s/queue.h"
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  istream_t
 Input Stream. More...

Macros

#define InputStreamInit(Size, Accumulate)
 Convenient wrapper around istream_init that casts Accumulate.
Calling a virtual member function
#define istream_accumulate(Stream, Count)
 Convenient way to call the input stream's accumulate member function.

Functions

istream_t istream_init (size_t buffer_size, bool(*accumulate)(istream_t *, size_t))
 Allocate a buffer and set the member function.
void istream_close (istream_t *self)
 Free the buffer.
bool istream_has_at_least (const istream_t *self, size_t count)
 Test if enough characters are available.

Detailed Description

Buffered input streams.

Author
Antoine GAGNIERE

Definition in file input_stream.h.

Function Documentation

◆ istream_has_at_least()

bool istream_has_at_least ( const istream_t * self,
size_t count )

Test if enough characters are available.

Returns
true if the buffer contains at least count bytes

Definition at line 37 of file input.c.

◆ istream_init()

istream_t istream_init ( size_t buffer_size,
bool(* accumulate )(istream_t *, size_t) )

Allocate a buffer and set the member function.

Warning
Input stream is an abstact type and is not meant to be created by an end user

Definition at line 22 of file input.c.