AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::cutils::cbuffer Struct Reference

C buffer. More...

#include <iostream.hpp>

Collaboration diagram for anch::cutils::cbuffer:

Public Attributes

char * data = nullptr
std::size_t size = 0
std::function< std::size_t(char *, std::size_t)> read = nullptr
std::function< std::size_t(const char *, std::size_t)> write = nullptr

Detailed Description

C buffer.

Read and write functions return the number of bytes which have been read or written:

  • read: 0 means end of stream ;
  • write: it can write less bytes than requested (it is called again with the remaining bytes) ; 0 means error.

They can throw exceptions: the stream sets its badbit (and rethrows according to its exceptions mask).

data is optional: when NULL , it will be allocated/deallocated by CStreambuf. When set, it has to contain at least size bytes and to outlive the stream. In input-output mode, it is used for reading and a writing area of size bytes is allocated.

Since
0.1
Author
Vincent Lachenal

Member Data Documentation

◆ data

char* anch::cutils::cbuffer::data = nullptr

Buffer data

◆ read

std::function<std::size_t(char*,std::size_t)> anch::cutils::cbuffer::read = nullptr

Read data function

◆ size

std::size_t anch::cutils::cbuffer::size = 0

Buffer size (has to be greater than 0)

◆ write

std::function<std::size_t(const char*,std::size_t)> anch::cutils::cbuffer::write = nullptr

Write data function


The documentation for this struct was generated from the following file: