1 #ifndef OSMIUM_OSM_OBJECT_HPP 2 #define OSMIUM_OSM_OBJECT_HPP 175 if (!strcmp(
"true", visible)) {
177 }
else if (!strcmp(
"false", visible)) {
180 throw std::invalid_argument(
"Unknown value for visible attribute (allowed is 'true' or 'false')");
255 m_uid = uid < 0 ? 0 : static_cast<user_id_type>(
uid);
290 const char*
user() const noexcept {
291 return reinterpret_cast<const char*
>(data() +
sizeof_object());
296 return osmium::detail::subitem_of_type<const TagList>(
cbegin(),
cend());
305 const char*
get_value_by_key(
const char* key,
const char* default_value =
nullptr) const noexcept {
316 if (!strcmp(attr,
"id")) {
318 }
else if (!strcmp(attr,
"version")) {
320 }
else if (!strcmp(attr,
"changeset")) {
322 }
else if (!strcmp(attr,
"timestamp")) {
324 }
else if (!strcmp(attr,
"uid")) {
326 }
else if (!strcmp(attr,
"visible")) {
354 const_iterator
end()
const {
358 template <
typename T>
361 template <
typename T>
364 template <
typename T>
369 template <
typename T>
374 template <
typename T>
379 template <
typename T>
384 template <
typename T>
389 template <
typename T>
401 return lhs.type() == rhs.type() &&
402 lhs.id() == rhs.id() &&
403 lhs.version() == rhs.version();
407 return ! (lhs == rhs);
416 if (lhs.type() != rhs.type()) {
417 return lhs.type() < rhs.type();
419 return (lhs.id() == rhs.id() && lhs.version() < rhs.version()) ||
420 lhs.positive_id() < rhs.positive_id();
428 return ! (rhs < lhs);
432 return ! (lhs < rhs);
437 #endif // OSMIUM_OSM_OBJECT_HPP
object_id_type m_id
Definition: object.hpp:60
Definition: collection.hpp:47
unsigned char * user_position() noexcept
Definition: object.hpp:71
uint64_t unsigned_object_id_type
Type for OSM object (node, way, or relation) IDs where we only allow positive IDs.
Definition: types.hpp:46
t_const_iterator< T > begin() const
Definition: object.hpp:385
bool operator<=(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:446
OSMObject & set_timestamp(const osmium::Timestamp ×tamp) noexcept
Definition: object.hpp:284
bool m_deleted
Definition: object.hpp:61
OSMObject(osmium::memory::item_size_type size, osmium::item_type type)
Definition: object.hpp:93
Definition: item_iterator.hpp:119
unsigned char * next() noexcept
Definition: item.hpp:139
string_size_type user_size() const noexcept
Definition: object.hpp:79
constexpr bool operator==(const Box &lhs, const Box &rhs) noexcept
Definition: box.hpp:222
item_type
Definition: item_type.hpp:43
const_iterator cend() const
Definition: object.hpp:346
size_t sizeof_object() const noexcept
Definition: object.hpp:67
object_version_type m_version
Definition: object.hpp:62
t_const_iterator< T > cend() const
Definition: object.hpp:380
OSMObject & set_id(object_id_type id) noexcept
Definition: object.hpp:124
OSMEntity is the abstract base class for the OSMObject and Changeset classes.
Definition: entity.hpp:64
OSMObject & set_changeset(const char *changeset)
Definition: object.hpp:229
const_iterator cbegin() const
Definition: object.hpp:342
T padded_length(T length) noexcept
Definition: item.hpp:56
void set_attribute(const char *attr, const char *value)
Definition: object.hpp:315
osmium::Timestamp m_timestamp
Definition: object.hpp:63
object_version_type string_to_object_version(const char *input)
Definition: types_from_string.hpp:123
bool user_is_anonymous() const noexcept
Is this user anonymous?
Definition: object.hpp:269
iterator end()
Definition: object.hpp:338
OSMObject & set_visible(const char *visible)
Definition: object.hpp:174
t_const_iterator< T > cbegin() const
Definition: object.hpp:375
OSMObject & set_uid_from_signed(signed_user_id_type uid) noexcept
Definition: object.hpp:254
bool operator<(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:438
object_id_type string_to_object_id(const char *input)
Definition: types_from_string.hpp:59
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
Namespace for everything in the Osmium library.
Definition: assembler.hpp:59
changeset_id_type m_changeset
Definition: object.hpp:65
Definition: timestamp.hpp:56
uint16_t string_size_type
Definition: types.hpp:59
changeset_id_type string_to_changeset_id(const char *input)
Definition: types_from_string.hpp:137
const TagList & tags() const
Get the list of tags for this object.
Definition: object.hpp:295
user_id_type uid() const noexcept
Get user id of this object.
Definition: object.hpp:234
t_iterator< T > begin()
Definition: object.hpp:365
changeset_id_type changeset() const noexcept
Get changeset id of this object.
Definition: object.hpp:210
const_iterator begin() const
Definition: object.hpp:350
OSMObject & set_changeset(changeset_id_type changeset) noexcept
Definition: object.hpp:219
OSMObject & set_uid(const char *uid)
Definition: object.hpp:264
Definition: location.hpp:79
int32_t signed_user_id_type
Type for signed OSM user IDs.
Definition: types.hpp:50
OSMObject & set_id(const char *id)
Definition: object.hpp:134
bool deleted() const noexcept
Is this object marked as deleted?
Definition: object.hpp:139
bool operator>=(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:450
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:110
OSMObject & set_version(object_version_type version) noexcept
Definition: object.hpp:195
signed_user_id_type string_to_user_id(const char *input)
Definition: types_from_string.hpp:151
object_version_type version() const noexcept
Get version of this object.
Definition: object.hpp:186
bool operator>(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:442
osmium::memory::CollectionIterator< const Item > const_iterator
Definition: object.hpp:332
OSMObject & set_visible(bool visible) noexcept
Definition: object.hpp:163
bool visible() const noexcept
Is this object marked visible (ie not deleted)?
Definition: object.hpp:144
uint32_t object_version_type
Type for OSM object version number.
Definition: types.hpp:47
unsigned char * subitems_position()
Definition: object.hpp:83
uint32_t item_size_type
Definition: item.hpp:50
t_iterator< T > end()
Definition: object.hpp:370
const_iterator end() const
Definition: object.hpp:354
user_id_type m_uid
Definition: object.hpp:64
unsigned_object_id_type positive_id() const noexcept
Get absolute value of the ID of this object.
Definition: object.hpp:115
OSMObject & set_deleted(bool deleted) noexcept
Definition: object.hpp:153
osmium::memory::CollectionIterator< Item > iterator
Definition: object.hpp:331
t_const_iterator< T > end() const
Definition: object.hpp:390
void set_user_size(string_size_type size)
Definition: object.hpp:103
uint32_t changeset_id_type
Type for OSM changeset IDs.
Definition: types.hpp:48
const unsigned char * subitems_position() const
Definition: object.hpp:87
const char * get_value_by_key(const char *key, const char *default_value=nullptr) const noexcept
Definition: object.hpp:305
const unsigned char * user_position() const noexcept
Definition: object.hpp:75
const char * user() const noexcept
Get user name for this object.
Definition: object.hpp:290
const char * get_value_by_key(const char *key, const char *default_value=nullptr) const noexcept
Definition: tag.hpp:119
OSMObject & set_version(const char *version)
Definition: object.hpp:205
item_type type() const noexcept
Definition: item.hpp:155
osmium::Timestamp timestamp() const noexcept
Get timestamp when this object last changed.
Definition: object.hpp:274
OSMObject & set_uid(user_id_type uid) noexcept
Definition: object.hpp:243
bool operator!=(const Changeset &lhs, const Changeset &rhs)
Definition: changeset.hpp:431
Definition: object.hpp:58
uint32_t user_id_type
Type for OSM user IDs.
Definition: types.hpp:49
iterator begin()
Definition: object.hpp:334