Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
Classes | Namespaces | Macros | Typedefs | Functions
attr.hpp File Reference
#include <osmium/builder/builder.hpp>
#include <osmium/builder/osm_object_builder.hpp>
#include <osmium/memory/buffer.hpp>
#include <osmium/osm/changeset.hpp>
#include <osmium/osm/item_type.hpp>
#include <osmium/osm/location.hpp>
#include <osmium/osm/node.hpp>
#include <osmium/osm/node_ref.hpp>
#include <osmium/osm/object.hpp>
#include <osmium/osm/relation.hpp>
#include <osmium/osm/timestamp.hpp>
#include <osmium/osm/types.hpp>
#include <osmium/util/string.hpp>
#include <cstddef>
#include <cstdint>
#include <ctime>
#include <initializer_list>
#include <iterator>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for attr.hpp:

Go to the source code of this file.

Classes

class  member_type
 
class  member_type_string
 
class  comment_type
 
struct  detail::changeset_handler
 
struct  detail::object_handler
 
struct  detail::node_handler
 
struct  detail::tags_handler
 
struct  detail::nodes_handler
 
struct  detail::members_handler
 
struct  detail::discussion_handler
 
struct  detail::ring_handler
 
struct  detail::any_node_handlers
 
struct  detail::any_way_handlers
 
struct  detail::any_relation_handlers
 
struct  detail::any_area_handlers
 
struct  detail::any_changeset_handlers
 

Namespaces

namespace  osmium
 Namespace for everything in the Osmium library.
 
namespace  osmium::builder
 Classes for building OSM objects and other items in buffers.
 
namespace  osmium::builder::attr
 
namespace  detail
 

Macros

#define OSMIUM_ATTRIBUTE(_handler, _name, _type)
 
#define OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR(_handler, _name, _type)
 
#define OSMIUM_ATTRIBUTE_ITER(_handler, _name)
 

Typedefs

using pair_of_cstrings = std::pair< const char *const, const char *const >
 
using pair_of_strings = std::pair< const std::string &, const std::string & >
 
using tag_ilist = std::initializer_list< std::pair< const char *, const char * > >
 
using object_id_ilist = std::initializer_list< osmium::object_id_type >
 
using node_ref_ilist = std::initializer_list< osmium::NodeRef >
 
using member_ilist = std::initializer_list< member_type >
 
using comment_ilist = std::initializer_list< comment_type >
 

Functions

 osmium::builder::attr::OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (object_handler, _id, osmium::object_id_type)
 
 osmium::builder::attr::OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (object_handler, _version, osmium::object_version_type)
 
 osmium::builder::attr::OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (entity_handler, _uid, osmium::user_id_type)
 
 osmium::builder::attr::OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (entity_handler, _cid, osmium::changeset_id_type)
 
constexpr osmium::builder::attr::_deleted (bool value=true) noexcept
 
constexpr osmium::builder::_visible (bool value=true) noexcept
 
constexpr osmium::_timestamp (const osmium::Timestamp &value) noexcept
 
constexpr osmium::_timestamp (time_t value) noexcept
 
constexpr osmium::_timestamp (uint32_t value) noexcept
 
 osmium::_timestamp (const char *value)
 
 osmium::_timestamp (const std::string &value)
 
constexpr _location (const osmium::Location &value) noexcept
 
 _location (double lon, double lat)
 
constexpr _user (const char *val) noexcept
 
 _user (const std::string &val) noexcept
 
 detail::OSMIUM_ATTRIBUTE_ITER (tags_handler, tags_from_iterator_pair)
 
 detail::OSMIUM_ATTRIBUTE_ITER (nodes_handler, nodes_from_iterator_pair)
 
 detail::OSMIUM_ATTRIBUTE_ITER (members_handler, members_from_iterator_pair)
 
 detail::OSMIUM_ATTRIBUTE_ITER (discussion_handler, comments_from_iterator_pair)
 
 detail::OSMIUM_ATTRIBUTE_ITER (ring_handler, outer_ring_from_iterator_pair)
 
 detail::OSMIUM_ATTRIBUTE_ITER (ring_handler, inner_ring_from_iterator_pair)
 
 _tag (const pair_of_cstrings &value) noexcept
 
 _tag (const std::pair< const char *const, const char * > &value)
 
 _tag (const std::pair< const char *, const char * > &value)
 
 _tag (const pair_of_strings &value)
 
 _tag (const char *key, const char *val)
 
 _tag (const std::string &key, const std::string &val)
 
 _tag (const char *const key_value)
 
 _tag (const std::string &key_value)
 
 _t (const char *tags)
 
template<typename TTagIterator >
constexpr detail::tags_from_iterator_pair< TTagIterator > _tags (TTagIterator first, TTagIterator last)
 
template<typename TContainer >
detail::tags_from_iterator_pair< typename TContainer::const_iterator > _tags (const TContainer &container)
 
detail::tags_from_iterator_pair< tag_ilist::const_iterator > _tags (const tag_ilist &container)
 
constexpr _node (osmium::object_id_type value) noexcept
 
constexpr _node (const NodeRef &value) noexcept
 
template<typename TIdIterator >
constexpr detail::nodes_from_iterator_pair< TIdIterator > _nodes (TIdIterator first, TIdIterator last)
 
template<typename TContainer >
detail::nodes_from_iterator_pair< typename TContainer::const_iterator > _nodes (const TContainer &container)
 
detail::nodes_from_iterator_pair< object_id_ilist::const_iterator > _nodes (const object_id_ilist &container)
 
detail::nodes_from_iterator_pair< node_ref_ilist::const_iterator > _nodes (const node_ref_ilist &container)
 
constexpr _member (const member_type &value) noexcept
 
constexpr _member (osmium::item_type type, osmium::object_id_type id) noexcept
 
constexpr _member (osmium::item_type type, osmium::object_id_type id, const char *role) noexcept
 
 _member (osmium::item_type type, osmium::object_id_type id, const std::string &role) noexcept
 
 _member (const osmium::RelationMember &member) noexcept
 
template<typename TMemberIterator >
constexpr detail::members_from_iterator_pair< TMemberIterator > _members (TMemberIterator first, TMemberIterator last)
 
template<typename TContainer >
detail::members_from_iterator_pair< typename TContainer::const_iterator > _members (const TContainer &container)
 
detail::members_from_iterator_pair< member_ilist::const_iterator > _members (const member_ilist &container)
 
 OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (changeset_handler, _num_changes, osmium::num_changes_type)
 
 OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (changeset_handler, _num_comments, osmium::num_comments_type)
 
 OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (changeset_handler, _created_at, osmium::Timestamp)
 
 OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (changeset_handler, _closed_at, osmium::Timestamp)
 
constexpr _comment (const comment_type &value) noexcept
 
 _comment (const osmium::ChangesetComment &comment) noexcept
 
template<typename TCommentIterator >
constexpr detail::comments_from_iterator_pair< TCommentIterator > _comments (TCommentIterator first, TCommentIterator last)
 
template<typename TContainer >
detail::comments_from_iterator_pair< typename TContainer::const_iterator > _comments (const TContainer &container)
 
detail::comments_from_iterator_pair< comment_ilist::const_iterator > _comments (const comment_ilist &container)
 
template<typename TIdIterator >
constexpr detail::outer_ring_from_iterator_pair< TIdIterator > _outer_ring (TIdIterator first, TIdIterator last)
 
template<typename TContainer >
detail::outer_ring_from_iterator_pair< typename TContainer::const_iterator > _outer_ring (const TContainer &container)
 
detail::outer_ring_from_iterator_pair< object_id_ilist::const_iterator > _outer_ring (const object_id_ilist &container)
 
detail::outer_ring_from_iterator_pair< node_ref_ilist::const_iterator > _outer_ring (const node_ref_ilist &container)
 
template<typename TIdIterator >
constexpr detail::inner_ring_from_iterator_pair< TIdIterator > _inner_ring (TIdIterator first, TIdIterator last)
 
template<typename TContainer >
detail::inner_ring_from_iterator_pair< typename TContainer::const_iterator > _inner_ring (const TContainer &container)
 
detail::inner_ring_from_iterator_pair< object_id_ilist::const_iterator > _inner_ring (const object_id_ilist &container)
 
detail::inner_ring_from_iterator_pair< node_ref_ilist::const_iterator > _inner_ring (const node_ref_ilist &container)
 
template<typename THandler , typename TBuilder , typename... TArgs>
void detail::add_basic (TBuilder &builder, const TArgs &... args) noexcept
 
template<typename... TArgs>
constexpr const char * detail::get_user (const attr::_user &user, const TArgs &...) noexcept
 
constexpr const char * detail::get_user () noexcept
 
template<typename TFirst , typename... TRest>
constexpr std::enable_if<!std::is_same< attr::_user, TFirst >::value, constchar * >::type detail::get_user (const TFirst &, const TRest &... args) noexcept
 
template<typename TBuilder , typename... TArgs>
void detail::add_user (TBuilder &builder, const TArgs &... args)
 
template<typename TBuilder , typename THandler , typename... TArgs>
std::enable_if<!is_handled_by< THandler, TArgs... >::value >::type detail::add_list (osmium::builder::Builder &, const TArgs &...) noexcept
 
template<typename TBuilder , typename THandler , typename... TArgs>
std::enable_if< is_handled_by< THandler, TArgs... >::value >::type detail::add_list (osmium::builder::Builder &parent, const TArgs &... args)
 
template<typename... TArgs>
size_t add_node (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_way (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_relation (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_changeset (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_area (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_way_node_list (osmium::memory::Buffer &buffer, const TArgs &... args)
 
template<typename... TArgs>
size_t add_tag_list (osmium::memory::Buffer &buffer, const TArgs &... args)
 

Macro Definition Documentation

◆ OSMIUM_ATTRIBUTE

#define OSMIUM_ATTRIBUTE (   _handler,
  _name,
  _type 
)
Value:
struct _name : public osmium::builder::detail::type_wrapper<_type> { \
using handler = osmium::builder::detail::_handler;

◆ OSMIUM_ATTRIBUTE_ITER

#define OSMIUM_ATTRIBUTE_ITER (   _handler,
  _name 
)
Value:
template <typename TIterator> \
struct _name : public osmium::builder::detail::iterator_wrapper<TIterator> { \
using handler = osmium::builder::detail::_handler; \
constexpr _name(TIterator first, TIterator last) : \
osmium::builder::detail::iterator_wrapper<TIterator>(first, last) {} \
}
Definition: attr.hpp:342
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53

◆ OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR

#define OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR (   _handler,
  _name,
  _type 
)
Value:
OSMIUM_ATTRIBUTE(_handler, _name, _type) \
constexpr explicit _name(std::add_const<_type>::type& value) : \
type_wrapper(value) {} \
}
#define OSMIUM_ATTRIBUTE(_handler, _name, _type)
Definition: attr.hpp:179
type
Definition: entity_bits.hpp:63

Typedef Documentation

◆ comment_ilist

using comment_ilist = std::initializer_list<comment_type>

◆ member_ilist

using member_ilist = std::initializer_list<member_type>

◆ node_ref_ilist

typedef std::initializer_list< osmium::NodeRef > node_ref_ilist

◆ object_id_ilist

typedef std::initializer_list< osmium::object_id_type > object_id_ilist

◆ pair_of_cstrings

using pair_of_cstrings = std::pair<const char* const, const char* const>

◆ pair_of_strings

using pair_of_strings = std::pair<const std::string&, const std::string&>

◆ tag_ilist

using tag_ilist = std::initializer_list<std::pair<const char*, const char*> >

Function Documentation

◆ _comment() [1/2]

constexpr _comment ( const comment_type value)
explicitconstexprnoexcept

◆ _comment() [2/2]

_comment ( const osmium::ChangesetComment comment)
explicitnoexcept

◆ _comments() [1/3]

detail::comments_from_iterator_pair< comment_ilist::const_iterator > _comments ( const comment_ilist container)
inline

◆ _comments() [2/3]

template<typename TContainer >
detail::comments_from_iterator_pair< typename TContainer::const_iterator > _comments ( const TContainer &  container)
inline

◆ _comments() [3/3]

template<typename TCommentIterator >
constexpr detail::comments_from_iterator_pair< TCommentIterator > _comments ( TCommentIterator  first,
TCommentIterator  last 
)
inlineconstexpr

◆ _inner_ring() [1/4]

detail::inner_ring_from_iterator_pair< node_ref_ilist::const_iterator > _inner_ring ( const node_ref_ilist container)
inline

◆ _inner_ring() [2/4]

detail::inner_ring_from_iterator_pair< object_id_ilist::const_iterator > _inner_ring ( const object_id_ilist container)
inline

◆ _inner_ring() [3/4]

template<typename TContainer >
detail::inner_ring_from_iterator_pair< typename TContainer::const_iterator > _inner_ring ( const TContainer &  container)
inline

◆ _inner_ring() [4/4]

template<typename TIdIterator >
constexpr detail::inner_ring_from_iterator_pair< TIdIterator > _inner_ring ( TIdIterator  first,
TIdIterator  last 
)
inlineconstexpr

◆ _location() [1/2]

constexpr _location ( const osmium::Location value)
explicitconstexprnoexcept

◆ _location() [2/2]

_location ( double  lon,
double  lat 
)
explicit

◆ _member() [1/5]

constexpr _member ( const member_type value)
explicitconstexprnoexcept

◆ _member() [2/5]

_member ( const osmium::RelationMember member)
explicitnoexcept

◆ _member() [3/5]

constexpr _member ( osmium::item_type  type,
osmium::object_id_type  id 
)
explicitconstexprnoexcept

◆ _member() [4/5]

constexpr _member ( osmium::item_type  type,
osmium::object_id_type  id,
const char *  role 
)
explicitconstexprnoexcept

◆ _member() [5/5]

_member ( osmium::item_type  type,
osmium::object_id_type  id,
const std::string &  role 
)
explicitnoexcept

◆ _members() [1/3]

detail::members_from_iterator_pair< member_ilist::const_iterator > _members ( const member_ilist container)
inline

◆ _members() [2/3]

template<typename TContainer >
detail::members_from_iterator_pair< typename TContainer::const_iterator > _members ( const TContainer &  container)
inline

◆ _members() [3/3]

template<typename TMemberIterator >
constexpr detail::members_from_iterator_pair< TMemberIterator > _members ( TMemberIterator  first,
TMemberIterator  last 
)
inlineconstexpr

◆ _node() [1/2]

constexpr _node ( const NodeRef &  value)
explicitconstexprnoexcept

◆ _node() [2/2]

constexpr _node ( osmium::object_id_type  value)
explicitconstexprnoexcept

◆ _nodes() [1/4]

detail::nodes_from_iterator_pair< node_ref_ilist::const_iterator > _nodes ( const node_ref_ilist container)
inline

◆ _nodes() [2/4]

detail::nodes_from_iterator_pair< object_id_ilist::const_iterator > _nodes ( const object_id_ilist container)
inline

◆ _nodes() [3/4]

template<typename TContainer >
detail::nodes_from_iterator_pair< typename TContainer::const_iterator > _nodes ( const TContainer &  container)
inline

◆ _nodes() [4/4]

template<typename TIdIterator >
constexpr detail::nodes_from_iterator_pair< TIdIterator > _nodes ( TIdIterator  first,
TIdIterator  last 
)
inlineconstexpr

◆ _outer_ring() [1/4]

detail::outer_ring_from_iterator_pair< node_ref_ilist::const_iterator > _outer_ring ( const node_ref_ilist container)
inline

◆ _outer_ring() [2/4]

detail::outer_ring_from_iterator_pair< object_id_ilist::const_iterator > _outer_ring ( const object_id_ilist container)
inline

◆ _outer_ring() [3/4]

template<typename TContainer >
detail::outer_ring_from_iterator_pair< typename TContainer::const_iterator > _outer_ring ( const TContainer &  container)
inline

◆ _outer_ring() [4/4]

template<typename TIdIterator >
constexpr detail::outer_ring_from_iterator_pair< TIdIterator > _outer_ring ( TIdIterator  first,
TIdIterator  last 
)
inlineconstexpr

◆ _t()

_t ( const char *  tags)
explicit

◆ _tag() [1/8]

_tag ( const char *const  key_value)
explicit

◆ _tag() [2/8]

_tag ( const char *  key,
const char *  val 
)
explicit

◆ _tag() [3/8]

_tag ( const pair_of_cstrings value)
explicitnoexcept

◆ _tag() [4/8]

_tag ( const pair_of_strings value)
explicit

◆ _tag() [5/8]

_tag ( const std::pair< const char *, const char * > &  value)
explicit

◆ _tag() [6/8]

_tag ( const std::pair< const char *const, const char * > &  value)
explicit

◆ _tag() [7/8]

_tag ( const std::string &  key,
const std::string &  val 
)
explicit

◆ _tag() [8/8]

_tag ( const std::string &  key_value)
explicit

◆ _tags() [1/3]

detail::tags_from_iterator_pair< tag_ilist::const_iterator > _tags ( const tag_ilist container)
inline

◆ _tags() [2/3]

template<typename TContainer >
detail::tags_from_iterator_pair< typename TContainer::const_iterator > _tags ( const TContainer &  container)
inline

◆ _tags() [3/3]

template<typename TTagIterator >
constexpr detail::tags_from_iterator_pair< TTagIterator > _tags ( TTagIterator  first,
TTagIterator  last 
)
inlineconstexpr

◆ _user() [1/2]

constexpr _user ( const char *  val)
explicitconstexprnoexcept

◆ _user() [2/2]

_user ( const std::string &  val)
explicitnoexcept

◆ add_area()

template<typename... TArgs>
size_t add_area ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a area using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the area will be added.
argsThe attributes of the area.
Returns
The position in the buffer where this area was added.

◆ add_changeset()

template<typename... TArgs>
size_t add_changeset ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a changeset using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the changeset will be added.
argsThe attributes of the changeset.
Returns
The position in the buffer where this changeset was added.

◆ add_node()

template<typename... TArgs>
size_t add_node ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a node using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the node will be added.
argsThe attributes of the node.
Returns
The position in the buffer where this node was added.

◆ add_relation()

template<typename... TArgs>
size_t add_relation ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a relation using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the relation will be added.
argsThe attributes of the relation.
Returns
The position in the buffer where this relation was added.

◆ add_tag_list()

template<typename... TArgs>
size_t add_tag_list ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a TagList using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the list will be added.
argsThe contents of the list.
Returns
The position in the buffer where this list was added.

◆ add_way()

template<typename... TArgs>
size_t add_way ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a way using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the way will be added.
argsThe attributes of the way.
Returns
The position in the buffer where this way was added.

◆ add_way_node_list()

template<typename... TArgs>
size_t add_way_node_list ( osmium::memory::Buffer &  buffer,
const TArgs &...  args 
)
inline

Create a WayNodeList using the given arguments and add it to the given buffer.

Parameters
bufferThe buffer to which the list will be added.
argsThe contents of the list.
Returns
The position in the buffer where this list was added.

◆ OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR() [1/4]

OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR ( changeset_handler  ,
_closed_at  ,
osmium::Timestamp   
)

◆ OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR() [2/4]

OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR ( changeset_handler  ,
_created_at  ,
osmium::Timestamp   
)

◆ OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR() [3/4]

OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR ( changeset_handler  ,
_num_changes  ,
osmium::num_changes_type   
)

◆ OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR() [4/4]

OSMIUM_ATTRIBUTE_WITH_CONSTRUCTOR ( changeset_handler  ,
_num_comments  ,
osmium::num_comments_type   
)