Libosmium  2.17.0
Fast and flexible C++ library for working with OpenStreetMap data
Loading...
Searching...
No Matches
osm_object_builder.hpp
Go to the documentation of this file.
1#ifndef OSMIUM_BUILDER_OSM_OBJECT_BUILDER_HPP
2#define OSMIUM_BUILDER_OSM_OBJECT_BUILDER_HPP
3
4/*
5
6This file is part of Osmium (https://osmcode.org/libosmium).
7
8Copyright 2013-2021 Jochen Topf <jochen@topf.org> and others (see README).
9
10Boost Software License - Version 1.0 - August 17th, 2003
11
12Permission is hereby granted, free of charge, to any person or organization
13obtaining a copy of the software and accompanying documentation covered by
14this license (the "Software") to use, reproduce, display, distribute,
15execute, and transmit the Software, and to prepare derivative works of the
16Software, and to permit third-parties to whom the Software is furnished to
17do so, all subject to the following:
18
19The copyright notices in the Software and this entire statement, including
20the above license grant, this restriction and the following disclaimer,
21must be included in all copies of the Software, in whole or in part, and
22all derivative works of the Software, unless such copies or derivative
23works are solely in the form of machine-executable object code generated by
24a source language processor.
25
26THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32DEALINGS IN THE SOFTWARE.
33
34*/
35
38#include <osmium/osm/area.hpp>
39#include <osmium/osm/box.hpp>
43#include <osmium/osm/node.hpp>
45#include <osmium/osm/object.hpp>
47#include <osmium/osm/tag.hpp>
49#include <osmium/osm/types.hpp>
50#include <osmium/osm/way.hpp>
52
53#include <algorithm>
54#include <cassert>
55#include <cstddef>
56#include <cstdint>
57#include <cstring>
58#include <initializer_list>
59#include <limits>
60#include <new>
61#include <stdexcept>
62#include <string>
63#include <utility>
64
65namespace osmium {
66
67 namespace memory {
68 class Buffer;
69 } // namespace memory
70
71 namespace builder {
72
73 class TagListBuilder : public Builder {
74
75 public:
76
77 explicit TagListBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
78 Builder(buffer, parent, sizeof(TagList)) {
79 new (&item()) TagList{};
80 }
81
82 explicit TagListBuilder(Builder& parent) :
83 Builder(parent.buffer(), &parent, sizeof(TagList)) {
84 new (&item()) TagList{};
85 }
86
89
92
95 }
96
103 void add_tag(const char* key, const char* value) {
104 if (std::strlen(key) > osmium::max_osm_string_length) {
105 throw std::length_error{"OSM tag key is too long"};
106 }
107 if (std::strlen(value) > osmium::max_osm_string_length) {
108 throw std::length_error{"OSM tag value is too long"};
109 }
110 add_size(append(key));
111 add_size(append(value));
112 }
113
122 void add_tag(const char* key, const std::size_t key_length, const char* value, const std::size_t value_length) {
123 if (key_length > osmium::max_osm_string_length) {
124 throw std::length_error{"OSM tag key is too long"};
125 }
126 if (value_length > osmium::max_osm_string_length) {
127 throw std::length_error{"OSM tag value is too long"};
128 }
131 }
132
139 void add_tag(const std::string& key, const std::string& value) {
140 if (key.size() > osmium::max_osm_string_length) {
141 throw std::length_error{"OSM tag key is too long"};
142 }
143 if (value.size() > osmium::max_osm_string_length) {
144 throw std::length_error{"OSM tag value is too long"};
145 }
146 add_size(append(key.data(), osmium::memory::item_size_type(key.size()) + 1));
147 add_size(append(value.data(), osmium::memory::item_size_type(value.size()) + 1));
148 }
149
155 void add_tag(const osmium::Tag& tag) {
156 add_size(append(tag.key()));
157 add_size(append(tag.value()));
158 }
159
165 void add_tag(const std::pair<const char* const, const char* const>& tag) {
166 add_tag(tag.first, tag.second);
167 }
168 void add_tag(const std::pair<const char* const, const char*>& tag) {
169 add_tag(tag.first, tag.second);
170 }
171 void add_tag(const std::pair<const char*, const char* const>& tag) {
172 add_tag(tag.first, tag.second);
173 }
174 void add_tag(const std::pair<const char*, const char*>& tag) {
175 add_tag(tag.first, tag.second);
176 }
177
183 void add_tag(const std::pair<const std::string&, const std::string&>& tag) {
184 add_tag(tag.first, tag.second);
185 }
186
187 }; // class TagListBuilder
188
189 template <typename T>
191
192 public:
193
194 explicit NodeRefListBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
195 Builder(buffer, parent, sizeof(T)) {
196 new (&item()) T{};
197 }
198
199 explicit NodeRefListBuilder(Builder& parent) :
200 Builder(parent.buffer(), &parent, sizeof(T)) {
201 new (&item()) T{};
202 }
203
206
209
211 add_padding();
212 }
213
214 void add_node_ref(const NodeRef& node_ref) {
215 new (reserve_space_for<osmium::NodeRef>()) osmium::NodeRef{node_ref};
216 add_size(sizeof(osmium::NodeRef));
217 }
218
219 void add_node_ref(const object_id_type ref, const osmium::Location& location = Location{}) {
220 add_node_ref(NodeRef{ref, location});
221 }
222
223 }; // class NodeRefListBuilder
224
228
230
240 void add_role(osmium::RelationMember& member, const char* role, const std::size_t length) {
241 if (length > osmium::max_osm_string_length) {
242 throw std::length_error{"OSM relation member role is too long"};
243 }
244 member.set_role_size(osmium::string_size_type(length) + 1);
246 add_padding(true);
247 }
248
249 public:
250
251 explicit RelationMemberListBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
252 Builder(buffer, parent, sizeof(RelationMemberList)) {
253 new (&item()) RelationMemberList{};
254 }
255
257 Builder(parent.buffer(), &parent, sizeof(RelationMemberList)) {
258 new (&item()) RelationMemberList{};
259 }
260
263
266
268 add_padding();
269 }
270
284 void add_member(osmium::item_type type, object_id_type ref, const char* role, const std::size_t role_length, const osmium::OSMObject* full_member = nullptr) {
285 auto* member = reserve_space_for<osmium::RelationMember>();
286 new (member) osmium::RelationMember{ref, type, full_member != nullptr};
287 add_size(sizeof(RelationMember));
288 add_role(*member, role, role_length);
289 if (full_member) {
290 add_item(*full_member);
291 }
292 }
293
305 void add_member(osmium::item_type type, object_id_type ref, const char* role, const osmium::OSMObject* full_member = nullptr) {
306 add_member(type, ref, role, std::strlen(role), full_member);
307 }
308
320 void add_member(osmium::item_type type, object_id_type ref, const std::string& role, const osmium::OSMObject* full_member = nullptr) {
321 add_member(type, ref, role.data(), role.size(), full_member);
322 }
323
324 }; // class RelationMemberListBuilder
325
327
329
330 void add_user(osmium::ChangesetComment& comment, const char* user, const std::size_t length) {
331 if (length > osmium::max_osm_string_length) {
332 throw std::length_error{"OSM user name is too long"};
333 }
334 comment.set_user_size(osmium::string_size_type(length) + 1);
336 }
337
338 void add_text(osmium::ChangesetComment& comment, const char* text, const std::size_t length) {
339 if (length > std::numeric_limits<osmium::changeset_comment_size_type>::max() - 1) {
340 throw std::length_error{"OSM changeset comment is too long"};
341 }
344 add_padding(true);
345 }
346
347 public:
348
349 explicit ChangesetDiscussionBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
350 Builder(buffer, parent, sizeof(ChangesetDiscussion)) {
351 new (&item()) ChangesetDiscussion{};
352 }
353
355 Builder(parent.buffer(), &parent, sizeof(ChangesetDiscussion)) {
356 new (&item()) ChangesetDiscussion{};
357 }
358
361
364
366 assert(!m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
367 add_padding();
368 }
369
370 void add_comment(osmium::Timestamp date, osmium::user_id_type uid, const char* user) {
371 assert(!m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
372 m_comment = reserve_space_for<osmium::ChangesetComment>();
373 new (m_comment) osmium::ChangesetComment{date, uid};
374 add_size(sizeof(ChangesetComment));
375 add_user(*m_comment, user, std::strlen(user));
376 }
377
378 void add_comment_text(const char* text) {
379 assert(m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
381 m_comment = nullptr;
382 add_text(comment, text, std::strlen(text));
383 }
384
385 void add_comment_text(const std::string& text) {
386 assert(m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
388 m_comment = nullptr;
389 add_text(comment, text.c_str(), text.size());
390 }
391
392 }; // class ChangesetDiscussionBuilder
393
394#define OSMIUM_FORWARD(setter) \
395 template <typename... TArgs> \
396 type& setter(TArgs&&... args) { \
397 object().setter(std::forward<TArgs>(args)...); \
398 return static_cast<type&>(*this); \
399 }
400
401 template <typename TDerived, typename T>
402 class OSMObjectBuilder : public Builder {
403
404 using type = TDerived;
405
406 constexpr static const std::size_t min_size_for_user = osmium::memory::padded_length(sizeof(string_size_type) + 1);
407
408 public:
409
410 explicit OSMObjectBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
411 Builder(buffer, parent, sizeof(T) + min_size_for_user) {
412 new (&item()) T{};
414 std::memset(object().data() + sizeof(T), 0, min_size_for_user);
415 object().set_user_size(1);
416 }
417
425 T& object() noexcept {
426 return static_cast<T&>(item());
427 }
428
436 const T& cobject() const noexcept {
437 return static_cast<const T&>(item());
438 }
439
446 TDerived& set_user(const char* user, const string_size_type length) {
447 const auto size_of_object = sizeof(T) + sizeof(string_size_type);
448 assert(cobject().user_size() == 1 && (size() <= size_of_object + osmium::memory::padded_length(1))
449 && "set_user() must be called at most once and before any sub-builders");
450 constexpr const auto available_space = min_size_for_user - sizeof(string_size_type) - 1;
451 if (length > available_space) {
452 const auto space_needed = osmium::memory::padded_length(length - available_space);
453 std::memset(reserve_space(space_needed), 0, space_needed);
454 add_size(static_cast<uint32_t>(space_needed));
455 }
456 std::memcpy(object().data() + size_of_object, user, length);
457 object().set_user_size(length + 1);
458
459 return static_cast<TDerived&>(*this);
460 }
461
469 TDerived& set_user(const char* user) {
470 const auto len = std::strlen(user);
471 assert(len < std::numeric_limits<string_size_type>::max());
472 return set_user(user, static_cast<string_size_type>(len));
473 }
474
482 TDerived& set_user(const std::string& user) {
483 assert(user.size() < std::numeric_limits<string_size_type>::max());
484 return set_user(user.data(), static_cast<string_size_type>(user.size()));
485 }
486
488 template <typename... TArgs>
489 OSMIUM_DEPRECATED void add_user(TArgs&&... args) {
490 set_user(std::forward<TArgs>(args)...);
491 }
492
493 OSMIUM_FORWARD(set_id)
494 OSMIUM_FORWARD(set_visible)
495 OSMIUM_FORWARD(set_deleted)
496 OSMIUM_FORWARD(set_version)
497 OSMIUM_FORWARD(set_changeset)
498 OSMIUM_FORWARD(set_uid)
499 OSMIUM_FORWARD(set_uid_from_signed)
500 OSMIUM_FORWARD(set_timestamp)
501 OSMIUM_FORWARD(set_attribute)
502 OSMIUM_FORWARD(set_removed)
503
504 void add_tags(const std::initializer_list<std::pair<const char*, const char*>>& tags) {
505 osmium::builder::TagListBuilder tl_builder{buffer(), this};
506 for (const auto& p : tags) {
507 tl_builder.add_tag(p.first, p.second);
508 }
509 }
510
511 }; // class OSMObjectBuilder
512
513 class NodeBuilder : public OSMObjectBuilder<NodeBuilder, Node> {
514
516
517 public:
518
519 explicit NodeBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
521 }
522
523 explicit NodeBuilder(Builder& parent) :
524 OSMObjectBuilder<NodeBuilder, Node>(parent.buffer(), &parent) {
525 }
526
527 OSMIUM_FORWARD(set_location)
528
529 }; // class NodeBuilder
530
531 class WayBuilder : public OSMObjectBuilder<WayBuilder, Way> {
532
534
535 public:
536
537 explicit WayBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
539 }
540
541 explicit WayBuilder(Builder& parent) :
542 OSMObjectBuilder<WayBuilder, Way>(parent.buffer(), &parent) {
543 }
544
545 void add_node_refs(const std::initializer_list<osmium::NodeRef>& nodes) {
547 for (const auto& node_ref : nodes) {
548 builder.add_node_ref(node_ref);
549 }
550 }
551
552 }; // class WayBuilder
553
554 class RelationBuilder : public OSMObjectBuilder<RelationBuilder, Relation> {
555
557
558 public:
559
560 explicit RelationBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
562 }
563
564 explicit RelationBuilder(Builder& parent) :
565 OSMObjectBuilder<RelationBuilder, Relation>(parent.buffer(), &parent) {
566 }
567
568 }; // class RelationBuilder
569
570 class AreaBuilder : public OSMObjectBuilder<AreaBuilder, Area> {
571
573
574 public:
575
576 explicit AreaBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
578 }
579
580 explicit AreaBuilder(Builder& parent) :
581 OSMObjectBuilder<AreaBuilder, Area>(parent.buffer(), &parent) {
582 }
583
588 set_id(osmium::object_id_to_area_id(source.id(), source.type()));
589 set_version(source.version());
590 set_changeset(source.changeset());
591 set_timestamp(source.timestamp());
592 set_visible(source.visible());
593 set_uid(source.uid());
594 set_user(source.user());
595 }
596
597 }; // class AreaBuilder
598
599 class ChangesetBuilder : public Builder {
600
602
603 constexpr static const std::size_t min_size_for_user = osmium::memory::padded_length(1);
604
605 public:
606
607 explicit ChangesetBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
608 Builder(buffer, parent, sizeof(Changeset) + min_size_for_user) {
609 new (&item()) Changeset{};
611 std::memset(object().data() + sizeof(Changeset), 0, min_size_for_user);
613 }
614
622 Changeset& object() noexcept {
623 return static_cast<Changeset&>(item());
624 }
625
633 const Changeset& cobject() const noexcept {
634 return static_cast<const Changeset&>(item());
635 }
636
637 OSMIUM_FORWARD(set_id)
638 OSMIUM_FORWARD(set_uid)
639 OSMIUM_FORWARD(set_uid_from_signed)
640 OSMIUM_FORWARD(set_created_at)
641 OSMIUM_FORWARD(set_closed_at)
642 OSMIUM_FORWARD(set_num_changes)
643 OSMIUM_FORWARD(set_num_comments)
644 OSMIUM_FORWARD(set_attribute)
645 OSMIUM_FORWARD(set_removed)
646
647 // @deprecated Use set_bounds() instead.
648 OSMIUM_DEPRECATED osmium::Box& bounds() noexcept {
649 return object().bounds();
650 }
651
652 ChangesetBuilder& set_bounds(const osmium::Box& box) noexcept {
653 object().bounds() = box;
654 return *this;
655 }
656
663 ChangesetBuilder& set_user(const char* user, const string_size_type length) {
664 assert(cobject().user_size() == 1 && (size() <= sizeof(Changeset) + osmium::memory::padded_length(1))
665 && "set_user() must be called at most once and before any sub-builders");
666 constexpr const auto available_space = min_size_for_user - 1;
667 if (length > available_space) {
668 const auto space_needed = osmium::memory::padded_length(length - available_space);
669 std::memset(reserve_space(space_needed), 0, space_needed);
670 add_size(static_cast<uint32_t>(space_needed));
671 }
672 std::memcpy(object().data() + sizeof(Changeset), user, length);
673 object().set_user_size(length + 1);
674
675 return *this;
676 }
677
685 ChangesetBuilder& set_user(const char* user) {
686 const auto len = std::strlen(user);
687 assert(len <= std::numeric_limits<string_size_type>::max());
688 return set_user(user, static_cast<string_size_type>(len));
689 }
690
698 ChangesetBuilder& set_user(const std::string& user) {
699 assert(user.size() < std::numeric_limits<string_size_type>::max());
700 return set_user(user.data(), static_cast<string_size_type>(user.size()));
701 }
702
704 template <typename... TArgs>
705 OSMIUM_DEPRECATED void add_user(TArgs&&... args) {
706 set_user(std::forward<TArgs>(args)...);
707 }
708
709 }; // class ChangesetBuilder
710
711#undef OSMIUM_FORWARD
712
713 } // namespace builder
714
715} // namespace osmium
716
717#endif // OSMIUM_BUILDER_OSM_OBJECT_BUILDER_HPP
Definition: area.hpp:126
Definition: changeset.hpp:59
void set_text_size(changeset_comment_size_type size) noexcept
Definition: changeset.hpp:91
void set_user_size(string_size_type size) noexcept
Definition: changeset.hpp:87
Definition: changeset.hpp:132
An OSM Changeset, a group of changes made by a single user over a short period of time.
Definition: changeset.hpp:148
void set_user_size(string_size_type size) noexcept
Definition: changeset.hpp:167
osmium::Box & bounds() noexcept
Definition: changeset.hpp:350
Definition: location.hpp:271
Definition: node_ref.hpp:50
Definition: node.hpp:48
Definition: object.hpp:64
const char * user() const noexcept
Get user name for this object.
Definition: object.hpp:322
bool visible() const noexcept
Is this object marked visible (ie not deleted)?
Definition: object.hpp:156
object_version_type version() const noexcept
Get version of this object.
Definition: object.hpp:198
osmium::Timestamp timestamp() const noexcept
Get timestamp when this object last changed.
Definition: object.hpp:287
user_id_type uid() const noexcept
Get user id of this object.
Definition: object.hpp:246
changeset_id_type changeset() const noexcept
Get changeset id of this object.
Definition: object.hpp:222
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:122
Definition: relation.hpp:154
Definition: relation.hpp:57
void set_role_size(string_size_type size) noexcept
Definition: relation.hpp:91
Definition: relation.hpp:168
Definition: tag.hpp:119
Definition: tag.hpp:48
const char * key() const noexcept
Definition: tag.hpp:86
const char * value() const noexcept
Definition: tag.hpp:95
Definition: timestamp.hpp:147
Definition: way.hpp:72
Definition: osm_object_builder.hpp:570
AreaBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:576
void initialize_from_object(const osmium::OSMObject &source)
Definition: osm_object_builder.hpp:587
AreaBuilder(Builder &parent)
Definition: osm_object_builder.hpp:580
Definition: builder.hpp:57
unsigned char * reserve_space(std::size_t size)
Definition: builder.hpp:94
osmium::memory::item_size_type append(const char *data, const osmium::memory::item_size_type length)
Definition: builder.hpp:156
uint32_t size() const noexcept
Definition: builder.hpp:133
osmium::memory::Item & item() const
Definition: builder.hpp:90
void add_padding(bool self=false)
Definition: builder.hpp:111
void add_size(osmium::memory::item_size_type size)
Definition: builder.hpp:126
osmium::memory::Buffer & buffer() noexcept
Return the buffer this builder is using.
Definition: builder.hpp:207
osmium::memory::item_size_type append_with_zero(const char *data, const osmium::memory::item_size_type length)
Definition: builder.hpp:169
void add_item(const osmium::memory::Item &item)
Definition: builder.hpp:215
Definition: osm_object_builder.hpp:599
ChangesetBuilder & set_user(const char *user)
Definition: osm_object_builder.hpp:685
OSMIUM_DEPRECATED osmium::Box & bounds() noexcept
Definition: osm_object_builder.hpp:648
Changeset & object() noexcept
Definition: osm_object_builder.hpp:622
ChangesetBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:607
ChangesetBuilder & set_bounds(const osmium::Box &box) noexcept
Definition: osm_object_builder.hpp:652
ChangesetBuilder & set_user(const std::string &user)
Definition: osm_object_builder.hpp:698
OSMIUM_DEPRECATED void add_user(TArgs &&... args)
Definition: osm_object_builder.hpp:705
static constexpr const std::size_t min_size_for_user
Definition: osm_object_builder.hpp:603
const Changeset & cobject() const noexcept
Definition: osm_object_builder.hpp:633
ChangesetBuilder & set_user(const char *user, const string_size_type length)
Definition: osm_object_builder.hpp:663
Definition: osm_object_builder.hpp:326
void add_user(osmium::ChangesetComment &comment, const char *user, const std::size_t length)
Definition: osm_object_builder.hpp:330
ChangesetDiscussionBuilder(const ChangesetDiscussionBuilder &)=delete
ChangesetDiscussionBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:349
ChangesetDiscussionBuilder & operator=(ChangesetDiscussionBuilder &&)=delete
ChangesetDiscussionBuilder(ChangesetDiscussionBuilder &&)=delete
void add_text(osmium::ChangesetComment &comment, const char *text, const std::size_t length)
Definition: osm_object_builder.hpp:338
ChangesetDiscussionBuilder(Builder &parent)
Definition: osm_object_builder.hpp:354
~ChangesetDiscussionBuilder()
Definition: osm_object_builder.hpp:365
void add_comment(osmium::Timestamp date, osmium::user_id_type uid, const char *user)
Definition: osm_object_builder.hpp:370
void add_comment_text(const char *text)
Definition: osm_object_builder.hpp:378
void add_comment_text(const std::string &text)
Definition: osm_object_builder.hpp:385
ChangesetDiscussionBuilder & operator=(const ChangesetDiscussionBuilder &)=delete
osmium::ChangesetComment * m_comment
Definition: osm_object_builder.hpp:328
Definition: osm_object_builder.hpp:513
NodeBuilder(Builder &parent)
Definition: osm_object_builder.hpp:523
NodeBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:519
Definition: osm_object_builder.hpp:190
NodeRefListBuilder(NodeRefListBuilder &&)=delete
~NodeRefListBuilder()
Definition: osm_object_builder.hpp:210
NodeRefListBuilder & operator=(const NodeRefListBuilder &)=delete
NodeRefListBuilder(Builder &parent)
Definition: osm_object_builder.hpp:199
NodeRefListBuilder & operator=(NodeRefListBuilder &&)=delete
void add_node_ref(const NodeRef &node_ref)
Definition: osm_object_builder.hpp:214
NodeRefListBuilder(const NodeRefListBuilder &)=delete
void add_node_ref(const object_id_type ref, const osmium::Location &location=Location{})
Definition: osm_object_builder.hpp:219
NodeRefListBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:194
Definition: osm_object_builder.hpp:402
const T & cobject() const noexcept
Definition: osm_object_builder.hpp:436
OSMIUM_DEPRECATED void add_user(TArgs &&... args)
Definition: osm_object_builder.hpp:489
T & object() noexcept
Definition: osm_object_builder.hpp:425
OSMObjectBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:410
static constexpr const std::size_t min_size_for_user
Definition: osm_object_builder.hpp:406
TDerived type
Definition: osm_object_builder.hpp:404
TDerived & set_user(const std::string &user)
Definition: osm_object_builder.hpp:482
void add_tags(const std::initializer_list< std::pair< const char *, const char * > > &tags)
Definition: osm_object_builder.hpp:504
TDerived & set_user(const char *user)
Definition: osm_object_builder.hpp:469
TDerived & set_user(const char *user, const string_size_type length)
Definition: osm_object_builder.hpp:446
Definition: osm_object_builder.hpp:554
RelationBuilder(Builder &parent)
Definition: osm_object_builder.hpp:564
RelationBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:560
Definition: osm_object_builder.hpp:229
RelationMemberListBuilder(RelationMemberListBuilder &&)=delete
~RelationMemberListBuilder()
Definition: osm_object_builder.hpp:267
void add_member(osmium::item_type type, object_id_type ref, const char *role, const std::size_t role_length, const osmium::OSMObject *full_member=nullptr)
Definition: osm_object_builder.hpp:284
RelationMemberListBuilder & operator=(RelationMemberListBuilder &&)=delete
RelationMemberListBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:251
void add_role(osmium::RelationMember &member, const char *role, const std::size_t length)
Definition: osm_object_builder.hpp:240
RelationMemberListBuilder(Builder &parent)
Definition: osm_object_builder.hpp:256
RelationMemberListBuilder(const RelationMemberListBuilder &)=delete
RelationMemberListBuilder & operator=(const RelationMemberListBuilder &)=delete
void add_member(osmium::item_type type, object_id_type ref, const char *role, const osmium::OSMObject *full_member=nullptr)
Definition: osm_object_builder.hpp:305
void add_member(osmium::item_type type, object_id_type ref, const std::string &role, const osmium::OSMObject *full_member=nullptr)
Definition: osm_object_builder.hpp:320
Definition: osm_object_builder.hpp:73
TagListBuilder & operator=(TagListBuilder &&)=delete
void add_tag(const std::pair< const std::string &, const std::string & > &tag)
Definition: osm_object_builder.hpp:183
~TagListBuilder()
Definition: osm_object_builder.hpp:93
void add_tag(const std::pair< const char *, const char *const > &tag)
Definition: osm_object_builder.hpp:171
void add_tag(const char *key, const std::size_t key_length, const char *value, const std::size_t value_length)
Definition: osm_object_builder.hpp:122
TagListBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:77
void add_tag(const std::pair< const char *, const char * > &tag)
Definition: osm_object_builder.hpp:174
TagListBuilder(const TagListBuilder &)=delete
TagListBuilder & operator=(const TagListBuilder &)=delete
void add_tag(const std::pair< const char *const, const char * > &tag)
Definition: osm_object_builder.hpp:168
void add_tag(const std::pair< const char *const, const char *const > &tag)
Definition: osm_object_builder.hpp:165
void add_tag(const std::string &key, const std::string &value)
Definition: osm_object_builder.hpp:139
TagListBuilder(Builder &parent)
Definition: osm_object_builder.hpp:82
void add_tag(const char *key, const char *value)
Definition: osm_object_builder.hpp:103
TagListBuilder(TagListBuilder &&)=delete
void add_tag(const osmium::Tag &tag)
Definition: osm_object_builder.hpp:155
Definition: osm_object_builder.hpp:531
void add_node_refs(const std::initializer_list< osmium::NodeRef > &nodes)
Definition: osm_object_builder.hpp:545
WayBuilder(osmium::memory::Buffer &buffer, Builder *parent=nullptr)
Definition: osm_object_builder.hpp:537
WayBuilder(Builder &parent)
Definition: osm_object_builder.hpp:541
item_type type() const noexcept
Definition: item.hpp:171
#define OSMIUM_DEPRECATED
Definition: compatibility.hpp:51
constexpr std::size_t padded_length(std::size_t length) noexcept
Definition: item.hpp:64
uint32_t item_size_type
Definition: item.hpp:57
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
@ max_osm_string_length
Definition: types.hpp:70
uint32_t changeset_comment_size_type
Definition: types.hpp:66
uint32_t user_id_type
Type for OSM user IDs.
Definition: types.hpp:49
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
uint16_t string_size_type
Definition: types.hpp:59
osmium::object_id_type object_id_to_area_id(osmium::object_id_type id, osmium::item_type type) noexcept
Definition: area.hpp:105
item_type
Definition: item_type.hpp:43
Definition: location.hpp:551
#define OSMIUM_FORWARD(setter)
Definition: osm_object_builder.hpp:394