1#ifndef OSMIUM_OSM_TYPES_FROM_STRING_HPP
2#define OSMIUM_OSM_TYPES_FROM_STRING_HPP
61 if (*input !=
'\0' && !std::isspace(*input)) {
63 const auto id = std::strtoll(input, &
end, 10);
64 if (
id != std::numeric_limits<long long>::min() &&
65 id != std::numeric_limits<long long>::max() &&
70 throw std::range_error{std::string{
"illegal id: '"} + input +
"'"};
89 inline std::pair<osmium::item_type, osmium::object_id_type>
96 if (std::isdigit(*input)) {
104 throw std::range_error{std::string{
"not a valid id: '"} + input +
"'"};
109 inline uint32_t string_to_ulong(
const char* input,
const char* name) {
110 if (input[0] ==
'-' && input[1] ==
'1' && input[2] ==
'\0') {
113 if (*input !=
'\0' && *input !=
'-' && !std::isspace(*input)) {
115 const auto value = std::strtoul(input, &
end, 10);
116 if (value < std::numeric_limits<uint32_t>::max() && *
end ==
'\0') {
117 return static_cast<uint32_t
>(value);
120 throw std::range_error{std::string{
"illegal "} + name +
": '" + input +
"'"};
136 return detail::string_to_ulong(input,
"version");
150 return detail::string_to_ulong(input,
"changeset");
164 return detail::string_to_ulong(input,
"user id");
178 return detail::string_to_ulong(input,
"value for num changes");
192 return detail::string_to_ulong(input,
"value for num comments");
InputIterator< Reader > end(Reader &)
Definition: reader_iterator.hpp:47
type
Definition: entity_bits.hpp:63
@ nothing
Definition: entity_bits.hpp:67
type from_item_type(osmium::item_type item_type) noexcept
Definition: entity_bits.hpp:108
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
changeset_id_type string_to_changeset_id(const char *input)
Definition: types_from_string.hpp:148
user_id_type string_to_uid(const char *input)
Definition: types_from_string.hpp:162
item_type char_to_item_type(const char c) noexcept
Definition: item_type.hpp:90
object_id_type string_to_object_id(const char *input)
Definition: types_from_string.hpp:59
num_comments_type string_to_num_comments(const char *input)
Definition: types_from_string.hpp:190
uint32_t object_version_type
Type for OSM object version number.
Definition: types.hpp:47
uint32_t user_id_type
Type for OSM user IDs.
Definition: types.hpp:49
uint32_t changeset_id_type
Type for OSM changeset IDs.
Definition: types.hpp:48
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
item_type
Definition: item_type.hpp:45
object_version_type string_to_object_version(const char *input)
Definition: types_from_string.hpp:134
uint32_t num_comments_type
Type for changeset num_comments.
Definition: types.hpp:52
num_changes_type string_to_num_changes(const char *input)
Definition: types_from_string.hpp:176
uint32_t num_changes_type
Type for changeset num_changes.
Definition: types.hpp:51