Libosmium 2.22.0 Fast and flexible C++ library for working with OpenStreetMap data

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
osmium::OSMObject Class Reference

`#include <object.hpp>`

Inheritance diagram for osmium::OSMObject:
[legend]
Collaboration diagram for osmium::OSMObject:
[legend]

## Public Types
using | iterator = osmium::memory::CollectionIterator<Item>
using | const_iterator = osmium::memory::CollectionIterator<const Item>
template<typename T >
using | t_iterator = osmium::memory::ItemIterator<T>
template<typename T >
using | t_const_iterator = osmium::memory::ItemIterator<const T>

## Public Member Functions
object_id_type | id () const noexcept
| Get ID of this object.
unsigned_object_id_type | positive_id () const noexcept
| Get absolute value of the ID of this object.
OSMObject & | set_id (object_id_type id) noexcept
OSMObject & | set_id (const char *id)
bool | deleted () const noexcept
| Is this object marked as deleted?
bool | visible () const noexcept
| Is this object marked visible (ie not deleted)?
OSMObject & | set_deleted (bool deleted) noexcept
OSMObject & | set_visible (bool visible) noexcept
OSMObject & | set_visible (const char *visible)
object_version_type | version () const noexcept
| Get version of this object.
OSMObject & | set_version (object_version_type version) noexcept
OSMObject & | set_version (const char *version)
changeset_id_type | changeset () const noexcept
| Get changeset id of this object.
OSMObject & | set_changeset (changeset_id_type changeset) noexcept
OSMObject & | set_changeset (const char *changeset)
user_id_type | uid () const noexcept
| Get user id of this object.
OSMObject & | set_uid (user_id_type uid) noexcept
OSMObject & | set_uid_from_signed (signed_user_id_type uid) noexcept
OSMObject & | set_uid (const char *uid)
bool | user_is_anonymous () const noexcept
| Is this user anonymous?
osmium::Timestamp | timestamp () const noexcept
| Get timestamp when this object last changed.
OSMObject & | set_timestamp (const osmium::Timestamp &timestamp) noexcept
OSMObject & | set_timestamp (const char *timestamp)
const char * | user () const noexcept
| Get user name for this object.
void | clear_user () noexcept
| Clear user name.
const TagList & | tags () const
| Get the list of tags for this object.
const char * | get_value_by_key (const char *key, const char *default_value=nullptr) const noexcept
OSMObject & | set_attribute (const char *attr, const char *value)
void | remove_tags () noexcept
iterator | begin ()
iterator | end ()
const_iterator | cbegin () const
const_iterator | cend () const
const_iterator | begin () const
const_iterator | end () const
template<typename T >
osmium::memory::ItemIteratorRange< T > | subitems ()
template<typename T >
osmium::memory::ItemIteratorRange< const T > | subitems () const
template<typename T >
t_iterator< T > | begin ()
template<typename T >
t_iterator< T > | end ()
template<typename T >
t_const_iterator< T > | cbegin () const
template<typename T >
t_const_iterator< T > | cend () const
template<typename T >
t_const_iterator< T > | begin () const
template<typename T >
t_const_iterator< T > | end () const
Public Member Functions inherited from osmium::OSMEntity
| OSMEntity (osmium::memory::item_size_type size, osmium::item_type type)
bool | type_is_in (osmium::osm_entity_bits::type entity_bits) const
Public Member Functions inherited from osmium::memory::Item
| Item (const Item &)=delete
Item & | operator= (const Item &)=delete
| Item (Item &&)=delete
Item & | operator= (Item &&)=delete
| ~Item () noexcept=default
unsigned char * | next () noexcept
const unsigned char * | next () const noexcept
item_size_type | byte_size () const noexcept
item_size_type | padded_size () const
item_type | type () const noexcept
bool | removed () const noexcept
void | set_removed (const bool removed) noexcept
diff_indicator_type | diff () const noexcept
char | diff_as_char () const noexcept
void | set_diff (const diff_indicator_type diff) noexcept

## Static Public Member Functions
static constexpr bool | is_compatible_to (osmium::item_type t) noexcept
Static Public Member Functions inherited from osmium::OSMEntity
static constexpr bool | is_compatible_to (osmium::item_type t) noexcept
Static Public Member Functions inherited from osmium::memory::Item
static constexpr bool | is_compatible_to (osmium::item_type) noexcept

## Protected Member Functions
| OSMObject (osmium::memory::item_size_type size, osmium::item_type type)
Protected Member Functions inherited from osmium::memory::Item
| Item (item_size_type size=0, item_type type=item_type{}) noexcept
Item & | set_type (const item_type item_type) noexcept

## Private Member Functions
size_t | sizeof_object () const noexcept
unsigned char * | user_position () noexcept
const unsigned char * | user_position () const noexcept
string_size_type | user_size () const noexcept
unsigned char * | subitems_position ()
const unsigned char * | subitems_position () const

## Private Attributes
object_id_type | m_id = 0
bool | m_deleted: 1
object_version_type | m_version: 31
osmium::Timestamp | m_timestamp
user_id_type | m_uid = 0
changeset_id_type | m_changeset = 0

## Friends
template<typename TDerived , typename T >
class | osmium::builder::OSMObjectBuilder

## Detailed Description

OSMObject (Node, Way, Relation, or Area).

## Member Typedef Documentation

## ◆ const_iterator

using osmium::OSMObject::const_iterator = osmium::memory::CollectionIterator<const Item>

## ◆ iterator

using osmium::OSMObject::iterator = osmium::memory::CollectionIterator<Item>

## ◆ t_const_iterator

template<typename T >

using osmium::OSMObject::t_const_iterator = osmium::memory::ItemIterator<const T>

## ◆ t_iterator

template<typename T >

using osmium::OSMObject::t_iterator = osmium::memory::ItemIterator<T>

## Constructor & Destructor Documentation

## ◆ OSMObject()

osmium::OSMObject::OSMObject | ( | osmium::memory::item_size_type | size,
|  | osmium::item_type | type )
| inline protected

## Member Function Documentation

## ◆ begin() [1/4]

iterator osmium::OSMObject::begin | ( |  | ) |
| inline

## ◆ begin() [2/4]

template<typename T >

t_iterator< T > osmium::OSMObject::begin | ( |  | ) |
| inline

## ◆ begin() [3/4]

const_iterator osmium::OSMObject::begin | ( |  | ) | const
| inline

## ◆ begin() [4/4]

template<typename T >

t_const_iterator< T > osmium::OSMObject::begin | ( |  | ) | const
| inline

## ◆ cbegin() [1/2]

const_iterator osmium::OSMObject::cbegin | ( |  | ) | const
| inline

## ◆ cbegin() [2/2]

template<typename T >

t_const_iterator< T > osmium::OSMObject::cbegin | ( |  | ) | const
| inline

## ◆ cend() [1/2]

const_iterator osmium::OSMObject::cend | ( |  | ) | const
| inline

## ◆ cend() [2/2]

template<typename T >

t_const_iterator< T > osmium::OSMObject::cend | ( |  | ) | const
| inline

## ◆ changeset()

changeset_id_type osmium::OSMObject::changeset | ( |  | ) | const
| inline noexcept

Get changeset id of this object.

## ◆ clear_user()

void osmium::OSMObject::clear_user | ( |  | ) |
| inline noexcept

Clear user name.

## ◆ deleted()

bool osmium::OSMObject::deleted | ( |  | ) | const
| inline noexcept

Is this object marked as deleted?

## ◆ end() [1/4]

iterator osmium::OSMObject::end | ( |  | ) |
| inline

## ◆ end() [2/4]

template<typename T >

t_iterator< T > osmium::OSMObject::end | ( |  | ) |
| inline

## ◆ end() [3/4]

const_iterator osmium::OSMObject::end | ( |  | ) | const
| inline

## ◆ end() [4/4]

template<typename T >

t_const_iterator< T > osmium::OSMObject::end | ( |  | ) | const
| inline

## ◆ get_value_by_key()

const char * osmium::OSMObject::get_value_by_key | ( | const char * | key,
|  | const char * | default_value = nullptr ) const
| inline noexcept

Get tag value by key.

Convenience function that will forward to same function on TagList object.

## ◆ id()

object_id_type osmium::OSMObject::id | ( |  | ) | const
| inline noexcept

Get ID of this object.

## ◆ is_compatible_to()

static constexpr bool osmium::OSMObject::is_compatible_to | ( | osmium::item_type | t | ) |
| inline static constexpr noexcept

## ◆ positive_id()

unsigned_object_id_type osmium::OSMObject::positive_id | ( |  | ) | const
| inline noexcept

Get absolute value of the ID of this object.

## ◆ remove_tags()

void osmium::OSMObject::remove_tags | ( |  | ) |
| inline noexcept

Remove all tags from this object.

(This will not change the size of the object, the tags are simply marked as removed.)

## ◆ set_attribute()

OSMObject & osmium::OSMObject::set_attribute | ( | const char * | attr,
|  | const char * | value )
| inline

Set named attribute.

Parameters

  attr | Name of the attribute (must be one of "id", "version", "changeset", "timestamp", "uid", "visible")
  value | Value of the attribute

Returns
  Reference to object to make calls chainable.

## ◆ set_changeset() [1/2]

OSMObject & osmium::OSMObject::set_changeset | ( | changeset_id_type | changeset | ) |
| inline noexcept

Set changeset id of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_changeset() [2/2]

OSMObject & osmium::OSMObject::set_changeset | ( | const char * | changeset | ) |
| inline

Set changeset id of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_deleted()

OSMObject & osmium::OSMObject::set_deleted | ( | bool | deleted | ) |
| inline noexcept

Mark this object as deleted (or not).

Returns
  Reference to object to make calls chainable.

## ◆ set_id() [1/2]

OSMObject & osmium::OSMObject::set_id | ( | const char * | id | ) |
| inline

Set ID of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_id() [2/2]

OSMObject & osmium::OSMObject::set_id | ( | object_id_type | id | ) |
| inline noexcept

Set ID of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_timestamp() [1/2]

OSMObject & osmium::OSMObject::set_timestamp | ( | const char * | timestamp | ) |
| inline

Set the timestamp when this object last changed.

Parameters

  timestamp | Timestamp in ISO format.

Returns
  Reference to object to make calls chainable.

Exceptions

  std::invalid_argment | if the timestamp isn't a correctly ISO formatted string with the Z timezone.

Precondition
  timestamp != nullptr
  osmium::OSMObject::timestamp
  osmium::Timestamp timestamp() const noexcept
  Get timestamp when this object last changed.
  Definition object.hpp:283

## ◆ set_timestamp() [2/2]

OSMObject & osmium::OSMObject::set_timestamp | ( | const osmium::Timestamp & | timestamp | ) |
| inline noexcept

Set the timestamp when this object last changed.

Parameters

  timestamp | Timestamp

Returns
  Reference to object to make calls chainable.

## ◆ set_uid() [1/2]

OSMObject & osmium::OSMObject::set_uid | ( | const char * | uid | ) |
| inline

Set user id of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_uid() [2/2]

OSMObject & osmium::OSMObject::set_uid | ( | user_id_type | uid | ) |
| inline noexcept

Set user id of this object.

Returns
  Reference to object to make calls chainable.

## ◆ set_uid_from_signed()

OSMObject & osmium::OSMObject::set_uid_from_signed | ( | signed_user_id_type | uid | ) |
| inline noexcept

Set user id of this object. Sets uid to 0 (anonymous) if the given uid is smaller than 0.

Returns
  Reference to object to make calls chainable.

## ◆ set_version() [1/2]

OSMObject & osmium::OSMObject::set_version | ( | const char * | version | ) |
| inline

Set object version.

Returns
  Reference to object to make calls chainable.

## ◆ set_version() [2/2]

OSMObject & osmium::OSMObject::set_version | ( | object_version_type | version | ) |
| inline noexcept

Set object version.

Returns
  Reference to object to make calls chainable.

## ◆ set_visible() [1/2]

OSMObject & osmium::OSMObject::set_visible | ( | bool | visible | ) |
| inline noexcept

Mark this object as visible (ie not deleted) (or not).

Returns
  Reference to object to make calls chainable.

## ◆ set_visible() [2/2]

OSMObject & osmium::OSMObject::set_visible | ( | const char * | visible | ) |
| inline

Mark this object as visible (ie not deleted) or deleted.

Parameters

  visible | Either "true" or "false"

Returns
  Reference to object to make calls chainable.

## ◆ sizeof_object()

size_t osmium::OSMObject::sizeof_object | ( |  | ) | const
| inline private noexcept

## ◆ subitems() [1/2]

template<typename T >

osmium::memory::ItemIteratorRange< T > osmium::OSMObject::subitems | ( |  | ) |
| inline

Get a range of subitems of a specific type.

Template Parameters

  The | type (must be derived from osmium::memory::Item).

## ◆ subitems() [2/2]

template<typename T >

osmium::memory::ItemIteratorRange< const T > osmium::OSMObject::subitems | ( |  | ) | const
| inline

Get a range of subitems of a specific type.

Template Parameters

  The | type (must be derived from osmium::memory::Item).

## ◆ subitems_position() [1/2]

unsigned char * osmium::OSMObject::subitems_position | ( |  | ) |
| inline private

## ◆ subitems_position() [2/2]

const unsigned char * osmium::OSMObject::subitems_position | ( |  | ) | const
| inline private

## ◆ tags()

const TagList & osmium::OSMObject::tags | ( |  | ) | const
| inline

Get the list of tags for this object.

## ◆ timestamp()

osmium::Timestamp osmium::OSMObject::timestamp | ( |  | ) | const
| inline noexcept

Get timestamp when this object last changed.

## ◆ uid()

user_id_type osmium::OSMObject::uid | ( |  | ) | const
| inline noexcept

Get user id of this object.

## ◆ user()

const char * osmium::OSMObject::user | ( |  | ) | const
| inline noexcept

Get user name for this object.

## ◆ user_is_anonymous()

bool osmium::OSMObject::user_is_anonymous | ( |  | ) | const
| inline noexcept

Is this user anonymous?

## ◆ user_position() [1/2]

const unsigned char * osmium::OSMObject::user_position | ( |  | ) | const
| inline private noexcept

## ◆ user_position() [2/2]

unsigned char * osmium::OSMObject::user_position | ( |  | ) |
| inline private noexcept

## ◆ user_size()

string_size_type osmium::OSMObject::user_size | ( |  | ) | const
| inline private noexcept

## ◆ version()

object_version_type osmium::OSMObject::version | ( |  | ) | const
| inline noexcept

Get version of this object.

## ◆ visible()

bool osmium::OSMObject::visible | ( |  | ) | const
| inline noexcept

Is this object marked visible (ie not deleted)?

## Friends And Related Symbol Documentation

## ◆ osmium::builder::OSMObjectBuilder

template<typename TDerived , typename T >

friend class osmium::builder::OSMObjectBuilder
| friend

## Member Data Documentation

## ◆ m_changeset

changeset_id_type osmium::OSMObject::m_changeset = 0
| private

## ◆ m_deleted

bool osmium::OSMObject::m_deleted
| private

## ◆ m_id

object_id_type osmium::OSMObject::m_id = 0
| private

## ◆ m_timestamp

osmium::Timestamp osmium::OSMObject::m_timestamp
| private

## ◆ m_uid

user_id_type osmium::OSMObject::m_uid = 0
| private

## ◆ m_version

object_version_type osmium::OSMObject::m_version
| private

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

- include/osmium/osm/object.hpp