Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / obuffer.h / obuffer.h.0.md

% limb manual
% obuffer.h(0)
% limb 0.1.0
% 2023-07-24

# NAME

obuffer.h - output buffer interface

# SYNOPSIS

    #include <limb/obuffer.h>

# DESCRIPTION

This header defines required functions to write on output buffers.

An output buffer is simply a wrapper around a buffer (from [buffer.h](0)), with
a level to only receive data from the same level or lower. Refer to
[obuffer_level](3) for more.

Additionally it is possible to attach one output buffer to another, thusly
forming a /chain/. Whenever sending data to any buffer in the chain, it will be
sent to all output buffers in the chain. Refer to [obuffer_attach](3) for more.

## Constants

The following constants are defined :

: *OLVL_SILENT*, *OLVL_QUIET*, *OLVL_NORMAL*, *OLVL_VERBOSE*,
: *OLVL_DEBUG*, *OLVL_MAXIMUM*
:: Different output levels

## Types

The following types are defined :

: *obuffer*
:: A *struct obuffer*

## Structures

The following structures are defined :

: *struct obuffer*
:: An opaque structure representing an output buffer.

## Pointers

The following pointers are defined :

: `obuffer_1`
:: An output buffer based on `buffer_1`, thusly representing *stdout*.

: `obuffer_2`
:: An output buffer based on `buffer_2`, thusly representing *stderr*.

## Macros

The following macros are defined :

: *OBUFFER_INIT(`buffer`, `level`)*
:: Value to initialize an obuffer.

## Functions

The following functions/macros are defined :

: [obuffer_parse_level](3)
:: To parse a string representing an output level.

: [obuffer_level](3)
:: Return the level of an output buffer.

: [obuffer_setlevel](3)
:: To set the level of an output buffer.

: [obuffer_put](3)
:: To write given data to an output buffer (if levels match)

: [obuffer_putmsg](3)
:: To write a message, given as an array of strings, to an output buffer (if
:: levels match)

: [obuffer_attach](3)
:: To attach an output buffer to another, entering its chain.

: [obuffer_detach](3)
:: To remove an output buffer from its chain.

: [obuffer_is_attached](3)
:: Return whether or not an output buffer is part of a chain.