Loading...
Searching...
No Matches
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

| Builder (const Builder &)=delete
| Builder (Builder &&)=delete
Builder & | operator= (const Builder &)=delete
Builder & | operator= (Builder &&)=delete
osmium::memory::Buffer & | buffer () noexcept
| Return the buffer this builder is using.
void | add_item (const osmium::memory::Item &item)

## Protected Member Functions

| Builder (osmium::memory::Buffer &buffer, Builder *parent, osmium::memory::item_size_type size)
| ~Builder () noexcept
unsigned char * | item_pos () const noexcept
osmium::memory::Item & | item () const noexcept
unsigned char * | reserve_space (std::size_t size)
void | add_padding (bool self=false)
void | add_size (osmium::memory::item_size_type size)
uint32_t | size () const noexcept
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_with_zero (const char *data, const osmium::memory::item_size_type length)
osmium::memory::item_size_type | append (const char *str)

## Private Attributes

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

## Detailed Description

Parent class for individual builder classes. Instantiate one of its derived classes.

## Constructor & Destructor Documentation

## Builder() [1/3]

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

inline explicit protected

## ~Builder()

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

inline protected noexcept

## Builder() [2/3]

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

delete

## Builder() [3/3]

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

delete

## Member Function Documentation

## add_item()

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

inline

Add a subitem to the object being built. This can be something like a TagList or RelationMemberList.

## add_padding()

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

inline protected

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).

## add_size()

void osmium::builder::Builder::add_size | ( | osmium::memory::item_size_type | size | ) |

inline protected

## append() [1/2]

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

inline protected

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).

## append() [2/2]

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

inline protected

Append \0-terminated string to buffer.

Parameters

  str | \0-terminated string.

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

## append_with_zero()

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

inline protected

Append data to buffer and append an additional \0.

Parameters

  data | Pointer to data.
  length | Length of data in bytes.

Returns
  The number of bytes appended (length + 1).

## buffer()

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

inline noexcept

Return the buffer this builder is using.

## item()

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

inline protected noexcept

## item_pos()

unsigned char * osmium::builder::Builder::item_pos | ( |  | ) | const

inline protected noexcept

## operator=() [1/2]

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

delete

## operator=() [2/2]

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

delete

## reserve_space()

unsigned char * osmium::builder::Builder::reserve_space | ( | std::size_t | size | ) |

inline protected

## reserve_space_for()

template<typename T >

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

inline protected

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

## size()

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

inline protected noexcept

## Member Data Documentation

## m_buffer

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

private

## m_item_offset

std::size_t osmium::builder::Builder::m_item_offset

private

## m_parent

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

private

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

- include/osmium/builder/builder.hpp