osmium::builder::Builder Class Reference

`#include <builder.hpp>`

Inheritance diagram for osmium::builder::Builder:
[legend]
Collaboration diagram for osmium::builder::Builder:
[legend]

## Public Member Functions

void | add_padding (bool self=false)
void | add_size (uint32_t size)
uint32_t | size () const noexcept
void | add_item (const osmium::memory::Item *item)
template<typename T >
T * | reserve_space_for ()
osmium::memory::item_size_type | append (const char *data, const osmium::memory::item_size_type length)
osmium::memory::item_size_type | append (const char *str)
osmium::memory::item_size_type | append_zero ()
osmium::memory::Buffer & | buffer () noexcept
| Return the buffer this builder is using. More...

## Protected Member Functions

| Builder (osmium::memory::Buffer &buffer, Builder *parent, osmium::memory::item_size_type size)
| ~Builder ()=default
osmium::memory::Item & | item () const

## Private Member Functions

| Builder (const Builder &)=delete
| Builder (Builder &&)=delete
Builder & | operator= (const Builder &)=delete
Builder & | operator= (Builder &&)=delete

## Private Attributes

osmium::memory::Buffer & | m_buffer
Builder * | m_parent
size_t | m_item_offset

## Constructor & Destructor Documentation

osmium::builder::Builder::Builder | ( | const Builder & |  | ) |

private delete

osmium::builder::Builder::Builder | ( | Builder && |  | ) |

private delete

osmium::builder::Builder::Builder | ( | osmium::memory::Buffer & | buffer,
|  | Builder * | parent,
|  | osmium::memory::item_size_type | size
| ) |  |

inline explicit protected

osmium::builder::Builder::~Builder | ( |  | ) |

protected default

## Member Function Documentation

void osmium::builder::Builder::add_item | ( | const osmium::memory::Item * | item | ) |

inline

void osmium::builder::Builder::add_padding | ( | bool | self = `false` | ) |

inline

Add padding to buffer (if needed) to align data properly.

This calculates how many padding bytes are needed and adds as many zero bytes to the buffer. It also adds this number to the size of the current item (if the "self" param is true) and recursively to all the parent items.

Parameters

  self | If true add number of padding bytes to size of current item. Size is always added to parent item (if any).

void osmium::builder::Builder::add_size | ( | uint32_t | size | ) |

inline

osmium::memory::item_size_type osmium::builder::Builder::append | ( | const char * | data,
|  | const osmium::memory::item_size_type | length
| ) |  |

inline

Append data to buffer.

Parameters

  data | Pointer to data.
  length | Length of data in bytes. If data is a \0-terminated string, length must contain the \0 byte.

Returns
  The number of bytes appended (length).

osmium::memory::item_size_type osmium::builder::Builder::append | ( | const char * | str | ) |

inline

Append \0-terminated string to buffer.

Parameters

  str | \0-terminated string.

Returns
  The number of bytes appended (strlen(str) + 1).

osmium::memory::item_size_type osmium::builder::Builder::append_zero | ( |  | ) |

inline

Append '\0' to the buffer.

Returns
  The number of bytes appended (always 1).

osmium::memory::Buffer& osmium::builder::Builder::buffer | ( |  | ) |

inline noexcept

Return the buffer this builder is using.

osmium::memory::Item& osmium::builder::Builder::item | ( |  | ) | const

inline protected

Builder& osmium::builder::Builder::operator= | ( | const Builder & |  | ) |

private delete

Builder& osmium::builder::Builder::operator= | ( | Builder && |  | ) |

private delete

template<typename T >

T* osmium::builder::Builder::reserve_space_for | ( |  | ) |

inline

Reserve space for an object of class T in buffer and return pointer to it.

uint32_t osmium::builder::Builder::size | ( |  | ) | const

inline noexcept

## Member Data Documentation

osmium::memory::Buffer& osmium::builder::Builder::m_buffer

private

size_t osmium::builder::Builder::m_item_offset

private

Builder* osmium::builder::Builder::m_parent

private

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

- osmium/builder/builder.hpp