Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
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:
Inheritance graph
[legend]
Collaboration diagram for osmium::OSMObject:
Collaboration graph
[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. More...
 
unsigned_object_id_type positive_id () const noexcept
 Get absolute value of the ID of this object. More...
 
OSMObjectset_id (object_id_type id) noexcept
 
OSMObjectset_id (const char *id)
 
bool deleted () const noexcept
 Is this object marked as deleted? More...
 
bool visible () const noexcept
 Is this object marked visible (ie not deleted)? More...
 
OSMObjectset_deleted (bool deleted) noexcept
 
OSMObjectset_visible (bool visible) noexcept
 
OSMObjectset_visible (const char *visible)
 
object_version_type version () const noexcept
 Get version of this object. More...
 
OSMObjectset_version (object_version_type version) noexcept
 
OSMObjectset_version (const char *version)
 
changeset_id_type changeset () const noexcept
 Get changeset id of this object. More...
 
OSMObjectset_changeset (changeset_id_type changeset) noexcept
 
OSMObjectset_changeset (const char *changeset)
 
user_id_type uid () const noexcept
 Get user id of this object. More...
 
OSMObjectset_uid (user_id_type uid) noexcept
 
OSMObjectset_uid_from_signed (signed_user_id_type uid) noexcept
 
OSMObjectset_uid (const char *uid)
 
bool user_is_anonymous () const noexcept
 Is this user anonymous? More...
 
osmium::Timestamp timestamp () const noexcept
 Get timestamp when this object last changed. More...
 
OSMObjectset_timestamp (const osmium::Timestamp &timestamp) noexcept
 
OSMObjectset_timestamp (const char *timestamp)
 
const char * user () const noexcept
 Get user name for this object. More...
 
void clear_user () noexcept
 Clear user name. More...
 
const TagListtags () const
 Get the list of tags for this object. More...
 
const char * get_value_by_key (const char *key, const char *default_value=nullptr) const noexcept
 
OSMObjectset_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
 
Itemoperator= (const Item &)=delete
 
 Item (Item &&)=delete
 
Itemoperator= (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
 
Itemset_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

◆ iterator

◆ t_const_iterator

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

◆ t_iterator

Constructor & Destructor Documentation

◆ OSMObject()

osmium::OSMObject::OSMObject ( osmium::memory::item_size_type  size,
osmium::item_type  type 
)
inlineprotected

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
inlinenoexcept

Get changeset id of this object.

◆ clear_user()

void osmium::OSMObject::clear_user ( )
inlinenoexcept

Clear user name.

◆ deleted()

bool osmium::OSMObject::deleted ( ) const
inlinenoexcept

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
inlinenoexcept

Get tag value by key.

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

◆ id()

object_id_type osmium::OSMObject::id ( ) const
inlinenoexcept

Get ID of this object.

◆ is_compatible_to()

static constexpr bool osmium::OSMObject::is_compatible_to ( osmium::item_type  t)
inlinestaticconstexprnoexcept

◆ positive_id()

unsigned_object_id_type osmium::OSMObject::positive_id ( ) const
inlinenoexcept

Get absolute value of the ID of this object.

◆ remove_tags()

void osmium::OSMObject::remove_tags ( )
inlinenoexcept

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
attrName of the attribute (must be one of "id", "version", "changeset", "timestamp", "uid", "visible")
valueValue of the attribute
Returns
Reference to object to make calls chainable.

◆ set_changeset() [1/2]

OSMObject & osmium::OSMObject::set_changeset ( changeset_id_type  changeset)
inlinenoexcept

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

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

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
timestampTimestamp in ISO format.
Returns
Reference to object to make calls chainable.
Exceptions
std::invalid_argmentif the timestamp isn't a correctly ISO formatted string with the Z timezone.
Precondition
timestamp != nullptr
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)
inlinenoexcept

Set the timestamp when this object last changed.

Parameters
timestampTimestamp
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)
inlinenoexcept

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

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

Set object version.

Returns
Reference to object to make calls chainable.

◆ set_visible() [1/2]

OSMObject & osmium::OSMObject::set_visible ( bool  visible)
inlinenoexcept

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
visibleEither "true" or "false"
Returns
Reference to object to make calls chainable.

◆ sizeof_object()

size_t osmium::OSMObject::sizeof_object ( ) const
inlineprivatenoexcept

◆ 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
Thetype (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
Thetype (must be derived from osmium::memory::Item).

◆ subitems_position() [1/2]

unsigned char * osmium::OSMObject::subitems_position ( )
inlineprivate

◆ subitems_position() [2/2]

const unsigned char * osmium::OSMObject::subitems_position ( ) const
inlineprivate

◆ tags()

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

Get the list of tags for this object.

◆ timestamp()

osmium::Timestamp osmium::OSMObject::timestamp ( ) const
inlinenoexcept

Get timestamp when this object last changed.

◆ uid()

user_id_type osmium::OSMObject::uid ( ) const
inlinenoexcept

Get user id of this object.

◆ user()

const char * osmium::OSMObject::user ( ) const
inlinenoexcept

Get user name for this object.

◆ user_is_anonymous()

bool osmium::OSMObject::user_is_anonymous ( ) const
inlinenoexcept

Is this user anonymous?

◆ user_position() [1/2]

const unsigned char * osmium::OSMObject::user_position ( ) const
inlineprivatenoexcept

◆ user_position() [2/2]

unsigned char * osmium::OSMObject::user_position ( )
inlineprivatenoexcept

◆ user_size()

string_size_type osmium::OSMObject::user_size ( ) const
inlineprivatenoexcept

◆ version()

object_version_type osmium::OSMObject::version ( ) const
inlinenoexcept

Get version of this object.

◆ visible()

bool osmium::OSMObject::visible ( ) const
inlinenoexcept

Is this object marked visible (ie not deleted)?

Friends And Related Function 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: