protozero: protozero::fixed_size_buffer_adaptor Class Reference

protozero 1.8.1 Minimalistic protocol buffer decoder and encoder in C++.

Loading...
Searching...
No Matches
Public Member Functions | List of all members
protozero::fixed_size_buffer_adaptor Class Reference

`#include <buffer_fixed.hpp>`

## Public Member Functions
| fixed_size_buffer_adaptor (char *data, std::size_t capacity) noexcept
template<typename T>
| fixed_size_buffer_adaptor (T &container)
const char * | data () const noexcept
| Returns a pointer to the data in the buffer.
char * | data () noexcept
| Returns a pointer to the data in the buffer.
std::size_t | capacity () const noexcept
| The capacity this buffer was created with.
std::size_t | size () const noexcept
| The number of bytes used in the buffer. Always <= capacity().
char * | begin () noexcept
| Return iterator to beginning of data.
const char * | begin () const noexcept
| Return iterator to beginning of data.
const char * | cbegin () const noexcept
| Return iterator to beginning of data.
char * | end () noexcept
| Return iterator to end of data.
const char * | end () const noexcept
| Return iterator to end of data.
const char * | cend () const noexcept
| Return iterator to end of data.

## Detailed Description

This class can be used instead of std::string if you want to create a vector tile in a fixed-size buffer. Any operation that needs more space than is available will fail with a std::length_error exception.

## Constructor & Destructor Documentation

## ◆ fixed_size_buffer_adaptor() [1/2]

protozero::fixed_size_buffer_adaptor::fixed_size_buffer_adaptor | ( | char * | data,
|  | std::size_t | capacity )
| inlinenoexcept

Constructor.

Parameters

  data | Pointer to some memory allocated for the buffer.
  capacity | Number of bytes available.

## ◆ fixed_size_buffer_adaptor() [2/2]

template<typename T>

protozero::fixed_size_buffer_adaptor::fixed_size_buffer_adaptor | ( | T & | container | ) |
| inlineexplicit

Constructor.

Parameters

  container | Some container class supporting the member functions data() and size().

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

- include/protozero/buffer_fixed.hpp