Libosmium  2.7.2
Fast and flexible C++ library for working with OpenStreetMap data
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | 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
 
const char * user () const noexcept
 Get user name for this object. 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
 
void set_attribute (const char *attr, const char *value)
 
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
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 (bool removed) noexcept
 

Protected Member Functions

 OSMObject (osmium::memory::item_size_type size, osmium::item_type type)
 
void set_user_size (string_size_type size)
 
- Protected Member Functions inherited from osmium::memory::Item
 Item (item_size_type size=0, item_type type=item_type()) noexcept
 
 Item (const Item &)=delete
 
 Item (Item &&)=delete
 
Itemoperator= (const Item &)=delete
 
Itemoperator= (Item &&)=delete
 
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
 
bool m_deleted: 1
 
object_version_type m_version: 31
 
osmium::Timestamp m_timestamp
 
user_id_type m_uid
 
changeset_id_type m_changeset
 

Detailed Description

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

Member Typedef Documentation

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

Constructor & Destructor Documentation

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

Member Function Documentation

iterator osmium::OSMObject::begin ( )
inline
const_iterator osmium::OSMObject::begin ( ) const
inline
template<typename T >
t_iterator<T> osmium::OSMObject::begin ( )
inline
template<typename T >
t_const_iterator<T> osmium::OSMObject::begin ( ) const
inline
const_iterator osmium::OSMObject::cbegin ( ) const
inline
template<typename T >
t_const_iterator<T> osmium::OSMObject::cbegin ( ) const
inline
const_iterator osmium::OSMObject::cend ( ) const
inline
template<typename T >
t_const_iterator<T> osmium::OSMObject::cend ( ) const
inline
changeset_id_type osmium::OSMObject::changeset ( ) const
inlinenoexcept

Get changeset id of this object.

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

Is this object marked as deleted?

iterator osmium::OSMObject::end ( )
inline
const_iterator osmium::OSMObject::end ( ) const
inline
template<typename T >
t_iterator<T> osmium::OSMObject::end ( )
inline
template<typename T >
t_const_iterator<T> osmium::OSMObject::end ( ) const
inline
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.

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

Get ID of this object.

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

Get absolute value of the ID of this object.

void 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
OSMObject& osmium::OSMObject::set_changeset ( changeset_id_type  changeset)
inlinenoexcept

Set changeset id of this object.

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_changeset ( const char *  changeset)
inline

Set changeset id of this object.

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_deleted ( bool  deleted)
inlinenoexcept

Mark this object as deleted (or not).

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_id ( object_id_type  id)
inlinenoexcept

Set ID of this object.

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_id ( const char *  id)
inline

Set ID of this object.

Returns
Reference to object to make calls chainable.
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.
OSMObject& osmium::OSMObject::set_uid ( user_id_type  uid)
inlinenoexcept

Set user id of this object.

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_uid ( const char *  uid)
inline

Set user id of this object.

Returns
Reference to object to make calls chainable.
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.
void osmium::OSMObject::set_user_size ( string_size_type  size)
inlineprotected
OSMObject& osmium::OSMObject::set_version ( object_version_type  version)
inlinenoexcept

Set object version.

Returns
Reference to object to make calls chainable.
OSMObject& osmium::OSMObject::set_version ( const char *  version)
inline

Set object version.

Returns
Reference to object to make calls chainable.
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.
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.
size_t osmium::OSMObject::sizeof_object ( ) const
inlineprivatenoexcept
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.
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.
unsigned char* osmium::OSMObject::subitems_position ( )
inlineprivate
const unsigned char* osmium::OSMObject::subitems_position ( ) const
inlineprivate
const TagList& osmium::OSMObject::tags ( ) const
inline

Get the list of tags for this object.

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

Get timestamp when this object last changed.

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

Get user id of this object.

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

Get user name for this object.

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

Is this user anonymous?

unsigned char* osmium::OSMObject::user_position ( )
inlineprivatenoexcept
const unsigned char* osmium::OSMObject::user_position ( ) const
inlineprivatenoexcept
string_size_type osmium::OSMObject::user_size ( ) const
inlineprivatenoexcept
object_version_type osmium::OSMObject::version ( ) const
inlinenoexcept

Get version of this object.

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

Is this object marked visible (ie not deleted)?

Member Data Documentation

changeset_id_type osmium::OSMObject::m_changeset
private
bool osmium::OSMObject::m_deleted
private
object_id_type osmium::OSMObject::m_id
private
osmium::Timestamp osmium::OSMObject::m_timestamp
private
user_id_type osmium::OSMObject::m_uid
private
object_version_type osmium::OSMObject::m_version
private

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