1#ifndef OSMIUM_OSM_METADATA_OPTIONS_HPP
2#define OSMIUM_OSM_METADATA_OPTIONS_HPP
68 if (attributes.empty() || attributes ==
"all" || attributes ==
"true" || attributes ==
"yes") {
71 if (attributes ==
"none" || attributes ==
"false" || attributes ==
"no") {
77 unsigned int opts = 0;
78 for (
const auto& attr : attrs) {
79 if (attr ==
"version") {
80 opts |= options::md_version;
81 }
else if (attr ==
"timestamp") {
82 opts |= options::md_timestamp;
83 }
else if (attr ==
"changeset") {
84 opts |= options::md_changeset;
85 }
else if (attr ==
"uid") {
86 opts |= options::md_uid;
87 }
else if (attr ==
"user") {
88 opts |= options::md_user;
90 throw std::invalid_argument{std::string{
"Unknown OSM object metadata attribute: '"} + attr +
"'"};
97 bool any() const noexcept {
102 bool all() const noexcept {
112 return (
m_options & options::md_version) != 0;
124 return (
m_options & options::md_timestamp) != 0;
136 return (
m_options & options::md_changeset) != 0;
147 bool uid() const noexcept {
148 return (
m_options & options::md_uid) != 0;
160 return (
m_options & options::md_user) != 0;
195 result +=
"version+";
199 result +=
"timestamp+";
203 result +=
"changeset+";
222 template <
typename TChar,
typename TTraits>
223 inline std::basic_ostream<TChar, TTraits>&
operator<<(std::basic_ostream<TChar, TTraits>& out,
const metadata_options& options) {
224 return out << options.to_string();
240 opts.
set_uid(
object.uid() > 0);
241 opts.
set_user(
object.user()[0] !=
'\0');
Definition: object.hpp:64
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
std::vector< std::string > split_string(const std::string &str, const char sep, bool compact=false)
Definition: string.hpp:50
osmium::metadata_options detect_available_metadata(const osmium::OSMObject &object)
Definition: metadata_options.hpp:231
std::basic_ostream< TChar, TTraits > & operator<<(std::basic_ostream< TChar, TTraits > &out, const item_type item_type)
Definition: item_type.hpp:187
Definition: location.hpp:555