[libosmium] 02/04: Imported Upstream version 2.5.1
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Thu Nov 5 23:15:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository libosmium.
commit c62edf156e516064cba66f41dd03c4cd90c7d5be
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Thu Nov 5 23:40:25 2015 +0100
Imported Upstream version 2.5.1
---
CHANGELOG.md | 26 ++++++++++-
CMakeLists.txt | 30 ++++++++++--
CONTRIBUTING.md | 47 +++++++++++--------
README.md | 12 +++--
include/osmium/area/multipolygon_collector.hpp | 2 +-
include/osmium/builder/builder.hpp | 4 +-
include/osmium/builder/osm_object_builder.hpp | 4 +-
include/osmium/diff_iterator.hpp | 2 +-
include/osmium/diff_visitor.hpp | 12 ++---
include/osmium/dynamic_handler.hpp | 21 ++++-----
include/osmium/experimental/flex_reader.hpp | 2 +-
include/osmium/{io/overwrite.hpp => fwd.hpp} | 54 +++++++++++++---------
include/osmium/geom/factory.hpp | 14 +++---
include/osmium/geom/geojson.hpp | 2 +-
include/osmium/geom/geos.hpp | 2 +-
include/osmium/geom/ogr.hpp | 2 +-
include/osmium/geom/rapid_geojson.hpp | 4 +-
include/osmium/geom/wkb.hpp | 2 +-
include/osmium/geom/wkt.hpp | 2 +-
include/osmium/handler.hpp | 15 +-----
include/osmium/handler/chain.hpp | 10 ++--
include/osmium/handler/node_locations_for_ways.hpp | 2 +-
include/osmium/index/detail/create_map_with_fd.hpp | 2 +-
include/osmium/index/detail/vector_map.hpp | 2 +-
include/osmium/io/bzip2_compression.hpp | 2 +-
include/osmium/io/compression.hpp | 2 +-
include/osmium/io/detail/queue_util.hpp | 8 ++--
include/osmium/io/detail/read_write.hpp | 2 +-
include/osmium/io/detail/xml_input_format.hpp | 2 +-
include/osmium/io/gzip_compression.hpp | 2 +-
include/osmium/io/input_iterator.hpp | 6 +--
include/osmium/io/output_iterator.hpp | 23 +++------
include/osmium/io/overwrite.hpp | 25 +---------
include/osmium/io/writer.hpp | 29 ++++++------
.../io/{overwrite.hpp => writer_options.hpp} | 6 +--
include/osmium/memory/buffer.hpp | 26 +++++------
include/osmium/memory/collection.hpp | 4 +-
include/osmium/memory/item.hpp | 4 +-
include/osmium/memory/item_iterator.hpp | 6 +--
include/osmium/object_pointer_collection.hpp | 2 +-
include/osmium/osm/changeset.hpp | 4 +-
include/osmium/osm/crc.hpp | 2 +-
include/osmium/osm/diff_object.hpp | 7 +--
include/osmium/osm/entity.hpp | 2 +-
include/osmium/osm/node.hpp | 2 +-
include/osmium/osm/object.hpp | 16 +++----
include/osmium/osm/relation.hpp | 4 +-
include/osmium/osm/tag.hpp | 2 +-
include/osmium/osm/way.hpp | 2 +-
include/osmium/relations/collector.hpp | 10 ++--
include/osmium/relations/detail/member_meta.hpp | 2 +-
include/osmium/tags/filter.hpp | 8 ++--
include/osmium/tags/taglist.hpp | 6 +--
include/osmium/thread/util.hpp | 4 +-
include/osmium/util/compatibility.hpp | 9 ++++
include/osmium/visitor.hpp | 26 +++++------
56 files changed, 282 insertions(+), 248 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5081c6..715280f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,28 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
+### Changed
+
+### Fixed
+
+
+## [2.5.1] - 2015-11-05
+
+### Added
+
+- Header `osmium/fwd.hpp` with forward declarations of the most commonly
+ used Osmium classes.
+
+### Changed
+
+- Moved `osmium/io/overwrite.hpp` to `osmium/io/writer_options.hpp`
+ If you still include the old file, you'll get a warning.
+
+
+## [2.5.0] - 2015-11-04
+
+### Added
+
- Helper functions to make input iterator ranges and output iterators.
- Add support for reading o5m and o5c files.
- Option for osmium::io::Writer to fsync file after writing.
@@ -166,7 +188,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
-[unreleased]: https://github.com/osmcode/libosmium/compare/v2.4.1...HEAD
+[unreleased]: https://github.com/osmcode/libosmium/compare/v2.5.1...HEAD
+[2.5.1]: https://github.com/osmcode/libosmium/compare/v2.5.0...v2.5.1
+[2.5.0]: https://github.com/osmcode/libosmium/compare/v2.4.1...v2.5.0
[2.4.1]: https://github.com/osmcode/libosmium/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/osmcode/libosmium/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/osmcode/libosmium/compare/v2.2.0...v2.3.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da60fad..4382311 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 5)
-set(LIBOSMIUM_VERSION_PATCH 0)
+set(LIBOSMIUM_VERSION_PATCH 1)
set(LIBOSMIUM_VERSION
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
@@ -54,6 +54,10 @@ option(BUILD_HEADERS "compile every header file on its own" ${dev_build})
option(BUILD_BENCHMARKS "compile benchmark programs" ${dev_build})
option(BUILD_DATA_TESTS "compile data tests, please run them with ctest" ${dev_build})
+option(INSTALL_GDALCPP "also install gdalcpp headers" OFF)
+option(INSTALL_PROTOZERO "also install protozero headers" OFF)
+option(INSTALL_UTFCPP "also install utfcpp headers" OFF)
+
#-----------------------------------------------------------------------------
#
@@ -353,11 +357,29 @@ if(BUILD_HEADERS)
endforeach()
endif()
+
+#-----------------------------------------------------------------------------
+#
+# Installation
+#
+# External libraries are only installed if the options are set in case they
+# are installed from somewhere else.
+#
+#-----------------------------------------------------------------------------
install(DIRECTORY include/osmium DESTINATION include)
-# We only have a copy of this file so we can use older boost versions which
-# don't have it. We probably don't want to install it.
-#install(FILES include/boost_unicode_iterator.hpp DESTINATION include)
+if(INSTALL_GDALCPP)
+ install(include/gdalcpp.hpp DESTINATION include)
+endif()
+
+if(INSTALL_PROTOZERO)
+ install(DIRECTORY include/protozero DESTINATION include)
+endif()
+
+if(INSTALL_UTFCPP)
+ install(include/utf8.hpp DESTINATION include)
+ install(DIRECTORY include/utf8 DESTINATION include)
+endif()
#-----------------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 323c847..1064b94 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,22 +36,21 @@ different.
* Class names begin with uppercase chars and use CamelCase. Smaller helper
classes are usually defined as struct and have lowercase names.
* Macros (and only macros) are all uppercase. Use macros sparingly, usually
- a constexpr is better.
+ a simple (maybe constexpr) inline function is better. Undef macros after use
+ if possible.
+* Macros should only be used for controlling which parts of the code should be
+ included when compiling or to avoid major code repetitions.
* Variables, attributes, and function names are lowercase with
`underscores_between_words`.
* Class attribute names start with `m_` (member).
-* Template parameters are single uppercase letters or start with uppercase `T`
- and use CamelCase.
-* Typedefs have `names_like_this_type` which end in `_type`.
-* Macros should only be used for controlling which parts of the code should be
- included when compiling.
* Use `descriptive_variable_names`, exceptions are well-established conventions
like `i` for a loop variable. Iterators are usually called `it`.
* Declare variables where they are first used (C++ style), not at the beginning
of a function (old C style).
* Names from external namespaces (even `std`) are always mentioned explicitly.
Do not use `using` (except for `std::swap`). This way we can't even by
- accident pollute the namespace of the code including Osmium.
+ accident pollute the namespace of the code using Osmium.
+* Always use the standard swap idiom: `using std::swap; swap(foo, bar);`.
* `#include` directives appear in three "blocks" after the copyright notice.
The blocks are separated by blank lines. First block contains `#include`s for
standard C/C++ includes, second block for any external libs used, third
@@ -64,8 +63,20 @@ different.
* All files have suffix `.hpp`.
* Closing } of all classes and namespaces should have a trailing comment
with the name of the class/namespace.
-* All constructors with one or more arguments should be declared "explicit"
- unless there is a reason for them not to be. Document that reason.
+* All constructors with one (or more arguments if they have a default) should
+ be declared "explicit" unless there is a reason for them not to be. Document
+ that reason.
+* If a class has any of the special methods (copy/move constructor/assigment,
+ destructor) it should have all of them, possibly marking them as default or
+ deleted.
+* Typedefs have `names_like_this_type` which end in `_type`. Typedefs should
+ use the new `using foo_type = bar` syntax instead of the old
+ `typedef bar foo_type`.
+* Template parameters are single uppercase letters or start with uppercase `T`
+ and use CamelCase.
+* Always use `typename` in templates, not `class`: `template <typename T>`.
+* The ellipsis in variadic template never has a space to the left of it and
+ always has a space to the right: `template <typename... TArgs>` etc.
Keep to the indentation and other styles used in the code. Use `make indent`
in the toplevel directory to fix indentation and styling. It calls `astyle`
@@ -81,15 +92,15 @@ about which compilers support which feature and what operating system versions
or distributions have which versions of these compilers installed.
GCC 4.6 - too old, not supported (Ubuntu 12.04 LTS)
-GCC 4.7.2 - can probably not be supported (Debian wheezy/stable)
-GCC 4.7.3 - works
-GCC 4.8 - works
-clang 3.0 - too old, not supported (Debian wheezy/stable, Ubuntu 12.04 LTS)
-clang 3.2 - works
-
-C++11 features you should not use:
-* Inherited Constructors (works only in GCC 4.8+ and clang 3.3+, not in Visual
- Studio)
+GCC 4.7.2 - can probably not be supported (Debian wheezy)
+GCC 4.7.3 - probably works
+GCC 4.8 - works and is supported from here on
+clang 3.0 - too old, not supported (Debian wheezy, Ubuntu 12.04 LTS)
+clang 3.2 - probably works
+clang 3.5 - works and is supported from here on
+
+Use `include/osmium/util/compatibility.hpp` if there are compatibility problems
+between compilers due to different C++11 support.
## Checking your code
diff --git a/README.md b/README.md
index 9ac5a70..68fc2f6 100644
--- a/README.md
+++ b/README.md
@@ -27,9 +27,15 @@ you need for your programs.
For details see the
[list of dependencies](https://github.com/osmcode/libosmium/wiki/Libosmium-dependencies).
-The [protozero](https://github.com/mapbox/protozero) and
-[utf8-cpp](http://utfcpp.sourceforge.net/) header-only libraries are included
-in the libosmium repository.
+The following external (header-only) libraries are included in the libosmium
+repository:
+* [gdalcpp](https://github.com/joto/gdalcpp)
+* [protozero](https://github.com/mapbox/protozero)
+* [utfcpp](http://utfcpp.sourceforge.net/)
+
+If you want (some of) those libraries to be installed along with libosmium
+itself when calling `make install`, you have to use the CMake options
+`INSTALL_GDALCPP`, `INSTALL_PROTOZERO`, and/or `INSTALL_UTFCPP`.
## Directories
diff --git a/include/osmium/area/multipolygon_collector.hpp b/include/osmium/area/multipolygon_collector.hpp
index 6761ec6..c4155db 100644
--- a/include/osmium/area/multipolygon_collector.hpp
+++ b/include/osmium/area/multipolygon_collector.hpp
@@ -71,7 +71,7 @@ namespace osmium {
*
* @tparam TAssembler Multipolygon Assembler class.
*/
- template <class TAssembler>
+ template <typename TAssembler>
class MultipolygonCollector : public osmium::relations::Collector<MultipolygonCollector<TAssembler>, false, true, false> {
typedef typename osmium::relations::Collector<MultipolygonCollector<TAssembler>, false, true, false> collector_type;
diff --git a/include/osmium/builder/builder.hpp b/include/osmium/builder/builder.hpp
index 4424d88..63eb4bb 100644
--- a/include/osmium/builder/builder.hpp
+++ b/include/osmium/builder/builder.hpp
@@ -134,7 +134,7 @@ namespace osmium {
* Reserve space for an object of class T in buffer and return
* pointer to it.
*/
- template <class T>
+ template <typename T>
T* reserve_space_for() {
assert(m_buffer.is_aligned());
return reinterpret_cast<T*>(m_buffer.reserve_space(sizeof(T)));
@@ -182,7 +182,7 @@ namespace osmium {
}; // class Builder
- template <class TItem>
+ template <typename TItem>
class ObjectBuilder : public Builder {
static_assert(std::is_base_of<osmium::memory::Item, TItem>::value, "ObjectBuilder can only build objects derived from osmium::memory::Item");
diff --git a/include/osmium/builder/osm_object_builder.hpp b/include/osmium/builder/osm_object_builder.hpp
index 343f51f..6aa43ac 100644
--- a/include/osmium/builder/osm_object_builder.hpp
+++ b/include/osmium/builder/osm_object_builder.hpp
@@ -125,7 +125,7 @@ namespace osmium {
}; // class TagListBuilder
- template <class T>
+ template <typename T>
class NodeRefListBuilder : public ObjectBuilder<T> {
public:
@@ -296,7 +296,7 @@ namespace osmium {
}; // class ChangesetDiscussionBuilder
- template <class T>
+ template <typename T>
class OSMObjectBuilder : public ObjectBuilder<T> {
public:
diff --git a/include/osmium/diff_iterator.hpp b/include/osmium/diff_iterator.hpp
index 0ddf7ff..4ee67f7 100644
--- a/include/osmium/diff_iterator.hpp
+++ b/include/osmium/diff_iterator.hpp
@@ -43,7 +43,7 @@ namespace osmium {
class OSMObject;
- template <class TBasicIterator>
+ template <typename TBasicIterator>
class DiffIterator : public std::iterator<std::input_iterator_tag, const osmium::DiffObject> {
static_assert(std::is_base_of<osmium::OSMObject, typename TBasicIterator::value_type>::value, "TBasicIterator::value_type must derive from osmium::OSMObject");
diff --git a/include/osmium/diff_visitor.hpp b/include/osmium/diff_visitor.hpp
index 5e72a7b..e7dc576 100644
--- a/include/osmium/diff_visitor.hpp
+++ b/include/osmium/diff_visitor.hpp
@@ -43,7 +43,7 @@ namespace osmium {
namespace detail {
- template <class THandler>
+ template <typename THandler>
inline void apply_diff_iterator_recurse(const osmium::DiffObject& diff, THandler& handler) {
switch (diff.type()) {
case osmium::item_type::node:
@@ -60,7 +60,7 @@ namespace osmium {
}
}
- template <class THandler, class ...TRest>
+ template <typename THandler, typename... TRest>
inline void apply_diff_iterator_recurse(const osmium::DiffObject& diff, THandler& handler, TRest&... more) {
apply_diff_iterator_recurse(diff, handler);
apply_diff_iterator_recurse(diff, more...);
@@ -68,7 +68,7 @@ namespace osmium {
} // namespace detail
- template <class TIterator, class ...THandlers>
+ template <typename TIterator, typename... THandlers>
inline void apply_diff(TIterator it, TIterator end, THandlers&... handlers) {
typedef osmium::DiffIterator<TIterator> diff_iterator;
@@ -82,19 +82,19 @@ namespace osmium {
class OSMObject;
- template <class TSource, class ...THandlers>
+ template <typename TSource, typename... THandlers>
inline void apply_diff(TSource& source, THandlers&... handlers) {
apply_diff(osmium::io::InputIterator<TSource, osmium::OSMObject> {source},
osmium::io::InputIterator<TSource, osmium::OSMObject> {},
handlers...);
}
- template <class ...THandlers>
+ template <typename... THandlers>
inline void apply_diff(osmium::memory::Buffer& buffer, THandlers&... handlers) {
apply_diff(buffer.begin(), buffer.end(), handlers...);
}
- template <class ...THandlers>
+ template <typename... THandlers>
inline void apply_diff(const osmium::memory::Buffer& buffer, THandlers&... handlers) {
apply_diff(buffer.cbegin(), buffer.cend(), handlers...);
}
diff --git a/include/osmium/dynamic_handler.hpp b/include/osmium/dynamic_handler.hpp
index 9d0bd66..39baba5 100644
--- a/include/osmium/dynamic_handler.hpp
+++ b/include/osmium/dynamic_handler.hpp
@@ -36,16 +36,11 @@ DEALINGS IN THE SOFTWARE.
#include <memory>
#include <utility>
+#include <osmium/fwd.hpp>
#include <osmium/handler.hpp>
namespace osmium {
- class Node;
- class Way;
- class Relation;
- class Area;
- class Changeset;
-
namespace handler {
namespace detail {
@@ -83,11 +78,11 @@ namespace osmium {
// to either call handler style functions or visitor style operator().
#define OSMIUM_DYNAMIC_HANDLER_DISPATCH(_name_, _type_) \
-template <class THandler> \
+template <typename THandler> \
auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, int) -> decltype(handler._name_(object), void()) { \
handler._name_(object); \
} \
-template <class THandler> \
+template <typename THandler> \
auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) -> decltype(handler(object), void()) { \
handler(object); \
}
@@ -98,22 +93,22 @@ auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) ->
OSMIUM_DYNAMIC_HANDLER_DISPATCH(changeset, Changeset)
OSMIUM_DYNAMIC_HANDLER_DISPATCH(area, Area)
- template <class THandler>
+ template <typename THandler>
auto flush_dispatch(THandler& handler, int) -> decltype(handler.flush(), void()) {
handler.flush();
}
- template <class THandler>
+ template <typename THandler>
void flush_dispatch(THandler&, long) {}
- template <class THandler>
+ template <typename THandler>
class HandlerWrapper : public HandlerWrapperBase {
THandler m_handler;
public:
- template <class... TArgs>
+ template <typename... TArgs>
HandlerWrapper(TArgs&&... args) :
m_handler(std::forward<TArgs>(args)...) {
}
@@ -157,7 +152,7 @@ auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) ->
m_impl(impl_ptr(new osmium::handler::detail::HandlerWrapperBase)) {
}
- template <class THandler, class... TArgs>
+ template <typename THandler, typename... TArgs>
void set(TArgs&&... args) {
m_impl = impl_ptr(new osmium::handler::detail::HandlerWrapper<THandler>(std::forward<TArgs>(args)...));
}
diff --git a/include/osmium/experimental/flex_reader.hpp b/include/osmium/experimental/flex_reader.hpp
index e99811e..c1d2357 100644
--- a/include/osmium/experimental/flex_reader.hpp
+++ b/include/osmium/experimental/flex_reader.hpp
@@ -53,7 +53,7 @@ namespace osmium {
*/
namespace experimental {
- template <class TLocationHandler>
+ template <typename TLocationHandler>
class FlexReader {
bool m_with_areas;
diff --git a/include/osmium/io/overwrite.hpp b/include/osmium/fwd.hpp
similarity index 71%
copy from include/osmium/io/overwrite.hpp
copy to include/osmium/fwd.hpp
index 0311aed..bfcb5f5 100644
--- a/include/osmium/io/overwrite.hpp
+++ b/include/osmium/fwd.hpp
@@ -1,5 +1,5 @@
-#ifndef OSMIUM_IO_OVERWRITE_HPP
-#define OSMIUM_IO_OVERWRITE_HPP
+#ifndef OSMIUM_FWD_HPP
+#define OSMIUM_FWD_HPP
/*
@@ -33,28 +33,38 @@ DEALINGS IN THE SOFTWARE.
*/
-namespace osmium {
-
- namespace io {
+/**
+ *
+ * @file
+ *
+ * This file contains forward declarations for commonly used Osmium classes.
+ *
+ */
- /**
- * Allow overwriting of existing file?
- */
- enum class overwrite : bool {
- no = false,
- allow = true
- };
-
- /**
- * Should writer do an fsync before closing the file?
- */
- enum class fsync : bool {
- no = false,
- yes = true
- };
+namespace osmium {
- } // namespace io
+ class Area;
+ class Box;
+ class Changeset;
+ class ChangesetComment;
+ class ChangesetDiscussion;
+ class InnerRing;
+ class Location;
+ class Node;
+ class NodeRef;
+ class NodeRefList;
+ class OSMEntity;
+ class OSMObject;
+ class OuterRing;
+ class Relation;
+ class RelationMemberList;
+ class Segment;
+ class Tag;
+ class TagList;
+ class Timestamp;
+ class Way;
+ class WayNodeList;
} // namespace osmium
-#endif // OSMIUM_IO_OVERWRITE_HPP
+#endif // OSMIUM_FWD_HPP
diff --git a/include/osmium/geom/factory.hpp b/include/osmium/geom/factory.hpp
index ef75704..49dc78c 100644
--- a/include/osmium/geom/factory.hpp
+++ b/include/osmium/geom/factory.hpp
@@ -142,7 +142,7 @@ namespace osmium {
/**
* Geometry factory.
*/
- template <class TGeomImpl, class TProjection = IdentityProjection>
+ template <typename TGeomImpl, typename TProjection = IdentityProjection>
class GeometryFactory {
/**
@@ -166,7 +166,7 @@ namespace osmium {
/**
* Constructor for default initialized projection.
*/
- template <class... TArgs>
+ template <typename... TArgs>
GeometryFactory<TGeomImpl, TProjection>(TArgs&&... args) :
m_projection(),
m_impl(std::forward<TArgs>(args)...) {
@@ -176,7 +176,7 @@ namespace osmium {
* Constructor for explicitly initialized projection. Note that the
* projection is moved into the GeometryFactory.
*/
- template <class... TArgs>
+ template <typename... TArgs>
GeometryFactory<TGeomImpl, TProjection>(TProjection&& projection, TArgs&&... args) :
m_projection(std::move(projection)),
m_impl(std::forward<TArgs>(args)...) {
@@ -227,7 +227,7 @@ namespace osmium {
m_impl.linestring_start();
}
- template <class TIter>
+ template <typename TIter>
size_t fill_linestring(TIter it, TIter end) {
size_t num_points = 0;
for (; it != end; ++it, ++num_points) {
@@ -236,7 +236,7 @@ namespace osmium {
return num_points;
}
- template <class TIter>
+ template <typename TIter>
size_t fill_linestring_unique(TIter it, TIter end) {
size_t num_points = 0;
osmium::Location last_location;
@@ -301,7 +301,7 @@ namespace osmium {
m_impl.polygon_start();
}
- template <class TIter>
+ template <typename TIter>
size_t fill_polygon(TIter it, TIter end) {
size_t num_points = 0;
for (; it != end; ++it, ++num_points) {
@@ -310,7 +310,7 @@ namespace osmium {
return num_points;
}
- template <class TIter>
+ template <typename TIter>
size_t fill_polygon_unique(TIter it, TIter end) {
size_t num_points = 0;
osmium::Location last_location;
diff --git a/include/osmium/geom/geojson.hpp b/include/osmium/geom/geojson.hpp
index 96ddcd9..e5b5a9c 100644
--- a/include/osmium/geom/geojson.hpp
+++ b/include/osmium/geom/geojson.hpp
@@ -150,7 +150,7 @@ namespace osmium {
} // namespace detail
- template <class TProjection = IdentityProjection>
+ template <typename TProjection = IdentityProjection>
using GeoJSONFactory = GeometryFactory<osmium::geom::detail::GeoJSONFactoryImpl, TProjection>;
} // namespace geom
diff --git a/include/osmium/geom/geos.hpp b/include/osmium/geom/geos.hpp
index 771b087..49b1fd7 100644
--- a/include/osmium/geom/geos.hpp
+++ b/include/osmium/geom/geos.hpp
@@ -228,7 +228,7 @@ namespace osmium {
} // namespace detail
- template <class TProjection = IdentityProjection>
+ template <typename TProjection = IdentityProjection>
using GEOSFactory = GeometryFactory<osmium::geom::detail::GEOSFactoryImpl, TProjection>;
} // namespace geom
diff --git a/include/osmium/geom/ogr.hpp b/include/osmium/geom/ogr.hpp
index 7f726ed..4d5995c 100644
--- a/include/osmium/geom/ogr.hpp
+++ b/include/osmium/geom/ogr.hpp
@@ -168,7 +168,7 @@ namespace osmium {
} // namespace detail
- template <class TProjection = IdentityProjection>
+ template <typename TProjection = IdentityProjection>
using OGRFactory = GeometryFactory<osmium::geom::detail::OGRFactoryImpl, TProjection>;
} // namespace geom
diff --git a/include/osmium/geom/rapid_geojson.hpp b/include/osmium/geom/rapid_geojson.hpp
index a3d4687..87e479b 100644
--- a/include/osmium/geom/rapid_geojson.hpp
+++ b/include/osmium/geom/rapid_geojson.hpp
@@ -46,7 +46,7 @@ namespace osmium {
* A geometry factory implementation that can be used with the
* RapidJSON (https://github.com/miloyip/rapidjson) JSON writer.
*/
- template <class TWriter>
+ template <typename TWriter>
class RapidGeoJSONFactoryImpl {
TWriter* m_writer;
@@ -180,7 +180,7 @@ namespace osmium {
} // namespace detail
- template <class TWriter, class TProjection = IdentityProjection>
+ template <typename TWriter, typename TProjection = IdentityProjection>
using RapidGeoJSONFactory = GeometryFactory<detail::RapidGeoJSONFactoryImpl<TWriter>, TProjection>;
} // namespace geom
diff --git a/include/osmium/geom/wkb.hpp b/include/osmium/geom/wkb.hpp
index d2145b1..49833e6 100644
--- a/include/osmium/geom/wkb.hpp
+++ b/include/osmium/geom/wkb.hpp
@@ -263,7 +263,7 @@ namespace osmium {
} // namespace detail
- template <class TProjection = IdentityProjection>
+ template <typename TProjection = IdentityProjection>
using WKBFactory = GeometryFactory<osmium::geom::detail::WKBFactoryImpl, TProjection>;
} // namespace geom
diff --git a/include/osmium/geom/wkt.hpp b/include/osmium/geom/wkt.hpp
index 5e1e9a7..9cf5371 100644
--- a/include/osmium/geom/wkt.hpp
+++ b/include/osmium/geom/wkt.hpp
@@ -146,7 +146,7 @@ namespace osmium {
} // namespace detail
- template <class TProjection = IdentityProjection>
+ template <typename TProjection = IdentityProjection>
using WKTFactory = GeometryFactory<osmium::geom::detail::WKTFactoryImpl, TProjection>;
} // namespace geom
diff --git a/include/osmium/handler.hpp b/include/osmium/handler.hpp
index a90d779..f366197 100644
--- a/include/osmium/handler.hpp
+++ b/include/osmium/handler.hpp
@@ -33,20 +33,9 @@ DEALINGS IN THE SOFTWARE.
*/
-namespace osmium {
+#include <osmium/fwd.hpp>
- class OSMObject;
- class Node;
- class Way;
- class Relation;
- class Area;
- class Changeset;
- class ChangesetDiscussion;
- class TagList;
- class WayNodeList;
- class RelationMemberList;
- class OuterRing;
- class InnerRing;
+namespace osmium {
/**
* @brief Osmium handlers provide callbacks for OSM objects
diff --git a/include/osmium/handler/chain.hpp b/include/osmium/handler/chain.hpp
index 1af3962..4f3291c 100644
--- a/include/osmium/handler/chain.hpp
+++ b/include/osmium/handler/chain.hpp
@@ -38,14 +38,14 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/handler.hpp>
#define OSMIUM_CHAIN_HANDLER_CALL(_func_, _type_) \
- template <int N, int SIZE, class THandlers> \
+ template <int N, int SIZE, typename THandlers> \
struct call_ ## _func_ { \
void operator()(THandlers& handlers, osmium::_type_& object) { \
std::get<N>(handlers)._func_(object); \
call_ ## _func_<N+1, SIZE, THandlers>()(handlers, object); \
} \
}; \
- template <int SIZE, class THandlers> \
+ template <int SIZE, typename THandlers> \
struct call_ ## _func_<SIZE, SIZE, THandlers> { \
void operator()(THandlers&, osmium::_type_&) {} \
};
@@ -64,13 +64,13 @@ namespace osmium {
* This handler allows chaining of any number of handlers into a single
* handler.
*/
- template <class ...THandler>
+ template <typename... THandler>
class ChainHandler : public osmium::handler::Handler {
typedef std::tuple<THandler&...> handlers_type;
handlers_type m_handlers;
- template <int N, int SIZE, class THandlers>
+ template <int N, int SIZE, typename THandlers>
struct call_flush {
void operator()(THandlers& handlers) {
std::get<N>(handlers).flush();
@@ -78,7 +78,7 @@ namespace osmium {
}
}; // struct call_flush
- template <int SIZE, class THandlers>
+ template <int SIZE, typename THandlers>
struct call_flush<SIZE, SIZE, THandlers> {
void operator()(THandlers&) {}
}; // struct call_flush
diff --git a/include/osmium/handler/node_locations_for_ways.hpp b/include/osmium/handler/node_locations_for_ways.hpp
index 9b9fcbf..8d31310 100644
--- a/include/osmium/handler/node_locations_for_ways.hpp
+++ b/include/osmium/handler/node_locations_for_ways.hpp
@@ -60,7 +60,7 @@ namespace osmium {
* get(id) methods.
* @tparam TStorageNegIDs Same but for negative IDs.
*/
- template <class TStoragePosIDs, class TStorageNegIDs = dummy_type>
+ template <typename TStoragePosIDs, typename TStorageNegIDs = dummy_type>
class NodeLocationsForWays : public osmium::handler::Handler {
static_assert(std::is_base_of<osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>, TStoragePosIDs>::value, "Index class must be derived from osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>");
diff --git a/include/osmium/index/detail/create_map_with_fd.hpp b/include/osmium/index/detail/create_map_with_fd.hpp
index 5ccbfc8..5eb6cd0 100644
--- a/include/osmium/index/detail/create_map_with_fd.hpp
+++ b/include/osmium/index/detail/create_map_with_fd.hpp
@@ -47,7 +47,7 @@ namespace osmium {
namespace detail {
- template <class T>
+ template <typename T>
inline T* create_map_with_fd(const std::vector<std::string>& config) {
if (config.size() == 1) {
return new T();
diff --git a/include/osmium/index/detail/vector_map.hpp b/include/osmium/index/detail/vector_map.hpp
index e4f64ac..48b0f62 100644
--- a/include/osmium/index/detail/vector_map.hpp
+++ b/include/osmium/index/detail/vector_map.hpp
@@ -48,7 +48,7 @@ namespace osmium {
namespace map {
- template <class TVector, typename TId, typename TValue>
+ template <typename TVector, typename TId, typename TValue>
class VectorBasedDenseMap : public Map<TId, TValue> {
TVector m_vector;
diff --git a/include/osmium/io/bzip2_compression.hpp b/include/osmium/io/bzip2_compression.hpp
index 058d993..ad4b877 100644
--- a/include/osmium/io/bzip2_compression.hpp
+++ b/include/osmium/io/bzip2_compression.hpp
@@ -57,7 +57,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/io/compression.hpp>
#include <osmium/io/error.hpp>
#include <osmium/io/file_compression.hpp>
-#include <osmium/io/overwrite.hpp>
+#include <osmium/io/writer_options.hpp>
#include <osmium/util/cast.hpp>
#include <osmium/util/compatibility.hpp>
diff --git a/include/osmium/io/compression.hpp b/include/osmium/io/compression.hpp
index 64e59cc..4a69be7 100644
--- a/include/osmium/io/compression.hpp
+++ b/include/osmium/io/compression.hpp
@@ -52,7 +52,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/io/detail/read_write.hpp>
#include <osmium/io/error.hpp>
#include <osmium/io/file_compression.hpp>
-#include <osmium/io/overwrite.hpp>
+#include <osmium/io/writer_options.hpp>
#include <osmium/util/compatibility.hpp>
namespace osmium {
diff --git a/include/osmium/io/detail/queue_util.hpp b/include/osmium/io/detail/queue_util.hpp
index 47f30da..d410df1 100644
--- a/include/osmium/io/detail/queue_util.hpp
+++ b/include/osmium/io/detail/queue_util.hpp
@@ -73,21 +73,21 @@ namespace osmium {
*/
using future_string_queue_type = osmium::thread::Queue<std::future<std::string>>;
- template <class T>
+ template <typename T>
inline void add_to_queue(osmium::thread::Queue<std::future<T>>& queue, T&& data) {
std::promise<T> promise;
queue.push(promise.get_future());
promise.set_value(std::forward<T>(data));
}
- template <class T>
+ template <typename T>
inline void add_to_queue(osmium::thread::Queue<std::future<T>>& queue, std::exception_ptr&& exception) {
std::promise<T> promise;
queue.push(promise.get_future());
promise.set_exception(std::move(exception));
}
- template <class T>
+ template <typename T>
inline void add_end_of_data_to_queue(osmium::thread::Queue<std::future<T>>& queue) {
add_to_queue<T>(queue, T{});
}
@@ -100,7 +100,7 @@ namespace osmium {
return !buffer;
}
- template <class T>
+ template <typename T>
class queue_wrapper {
using queue_type = osmium::thread::Queue<std::future<T>>;
diff --git a/include/osmium/io/detail/read_write.hpp b/include/osmium/io/detail/read_write.hpp
index 815c6bb..5d1fa26 100644
--- a/include/osmium/io/detail/read_write.hpp
+++ b/include/osmium/io/detail/read_write.hpp
@@ -46,7 +46,7 @@ DEALINGS IN THE SOFTWARE.
# include <io.h>
#endif
-#include <osmium/io/overwrite.hpp>
+#include <osmium/io/writer_options.hpp>
namespace osmium {
diff --git a/include/osmium/io/detail/xml_input_format.hpp b/include/osmium/io/detail/xml_input_format.hpp
index 23caa8f..45dbde0 100644
--- a/include/osmium/io/detail/xml_input_format.hpp
+++ b/include/osmium/io/detail/xml_input_format.hpp
@@ -175,7 +175,7 @@ namespace osmium {
/**
* A C++ wrapper for the Expat parser that makes sure no memory is leaked.
*/
- template <class T>
+ template <typename T>
class ExpatXMLParser {
XML_Parser m_parser;
diff --git a/include/osmium/io/gzip_compression.hpp b/include/osmium/io/gzip_compression.hpp
index c0fdd93..705f416 100644
--- a/include/osmium/io/gzip_compression.hpp
+++ b/include/osmium/io/gzip_compression.hpp
@@ -51,7 +51,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/io/compression.hpp>
#include <osmium/io/error.hpp>
#include <osmium/io/file_compression.hpp>
-#include <osmium/io/overwrite.hpp>
+#include <osmium/io/writer_options.hpp>
#include <osmium/util/cast.hpp>
#include <osmium/util/compatibility.hpp>
diff --git a/include/osmium/io/input_iterator.hpp b/include/osmium/io/input_iterator.hpp
index b0bf56c..8647763 100644
--- a/include/osmium/io/input_iterator.hpp
+++ b/include/osmium/io/input_iterator.hpp
@@ -52,7 +52,7 @@ namespace osmium {
* source. It hides all the buffer handling and makes the contents of a
* source accessible as a normal STL input iterator.
*/
- template <class TSource, class TItem = osmium::memory::Item>
+ template <typename TSource, typename TItem = osmium::memory::Item>
class InputIterator {
static_assert(std::is_base_of<osmium::memory::Item, TItem>::value, "TItem must derive from osmium::buffer::Item");
@@ -133,7 +133,7 @@ namespace osmium {
}; // class InputIterator
- template <class TSource, class TItem = osmium::memory::Item>
+ template <typename TSource, typename TItem = osmium::memory::Item>
class InputIteratorRange {
InputIterator<TSource, TItem> m_begin;
@@ -165,7 +165,7 @@ namespace osmium {
}; // class InputIteratorRange
- template <class TItem, class TSource>
+ template <typename TItem, typename TSource>
InputIteratorRange<TSource, TItem> make_input_iterator_range(TSource& source) {
using it_type = InputIterator<TSource, TItem>;
return InputIteratorRange<TSource, TItem>(it_type{source}, it_type{});
diff --git a/include/osmium/io/output_iterator.hpp b/include/osmium/io/output_iterator.hpp
index 8f2203a..3d60fe6 100644
--- a/include/osmium/io/output_iterator.hpp
+++ b/include/osmium/io/output_iterator.hpp
@@ -40,14 +40,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/memory/buffer.hpp>
#include <osmium/osm/diff_object.hpp>
-
-#ifdef __GNUC__
-# define DEPRECATED __attribute__((deprecated))
-#elif defined(_MSC_VER)
-# define DEPRECATED __declspec(deprecated)
-#else
-# define DEPRECATED
-#endif
+#include <osmium/util/compatibility.hpp>
namespace osmium {
@@ -57,7 +50,7 @@ namespace osmium {
namespace io {
- template <class TDest>
+ template <typename TDest>
class OutputIterator : public std::iterator<std::output_iterator_tag, osmium::memory::Item> {
TDest* m_destination;
@@ -73,7 +66,7 @@ namespace osmium {
* constructor is deprecated. Call Writer::set_buffer_size()
* instead if you want to change the default.
*/
- DEPRECATED OutputIterator(TDest& destination, const size_t buffer_size) :
+ OSMIUM_DEPRECATED OutputIterator(TDest& destination, const size_t buffer_size) :
m_destination(&destination) {
destination.set_buffer_size(buffer_size);
}
@@ -90,7 +83,7 @@ namespace osmium {
* Warning! Calling OutputIterator<Writer>::flush() is usually not
* needed any more. Call flush() on the Writer instead if needed.
*/
- DEPRECATED void flush() {
+ OSMIUM_DEPRECATED void flush() {
m_destination->flush();
}
@@ -117,7 +110,7 @@ namespace osmium {
}; // class OutputIterator
- template <class TDest>
+ template <typename TDest>
OutputIterator<TDest> make_output_iterator(TDest& destination) {
return OutputIterator<TDest>{destination};
}
@@ -127,8 +120,8 @@ namespace osmium {
* deprecated. Call Writer::set_buffer_size() instead if you want to
* change the default.
*/
- template <class TDest>
- DEPRECATED OutputIterator<TDest> make_output_iterator(TDest& destination, const size_t buffer_size) {
+ template <typename TDest>
+ OSMIUM_DEPRECATED OutputIterator<TDest> make_output_iterator(TDest& destination, const size_t buffer_size) {
destination.set_buffer_size(buffer_size);
return OutputIterator<TDest>{destination};
}
@@ -137,6 +130,4 @@ namespace osmium {
} // namespace osmium
-#undef DEPRECATED
-
#endif // OSMIUM_IO_OUTPUT_ITERATOR_HPP
diff --git a/include/osmium/io/overwrite.hpp b/include/osmium/io/overwrite.hpp
index 0311aed..f9fbc71 100644
--- a/include/osmium/io/overwrite.hpp
+++ b/include/osmium/io/overwrite.hpp
@@ -33,28 +33,7 @@ DEALINGS IN THE SOFTWARE.
*/
-namespace osmium {
-
- namespace io {
-
- /**
- * Allow overwriting of existing file?
- */
- enum class overwrite : bool {
- no = false,
- allow = true
- };
-
- /**
- * Should writer do an fsync before closing the file?
- */
- enum class fsync : bool {
- no = false,
- yes = true
- };
-
- } // namespace io
-
-} // namespace osmium
+#pragma message("Including overwrite.hpp is deprecated, #include <osmium/io/writer_options.hpp> instead.")
+#include <osmium/io/writer_options.hpp>
#endif // OSMIUM_IO_OVERWRITE_HPP
diff --git a/include/osmium/io/writer.hpp b/include/osmium/io/writer.hpp
index 4b8823e..09c605c 100644
--- a/include/osmium/io/writer.hpp
+++ b/include/osmium/io/writer.hpp
@@ -49,7 +49,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/io/error.hpp>
#include <osmium/io/file.hpp>
#include <osmium/io/header.hpp>
-#include <osmium/io/overwrite.hpp>
+#include <osmium/io/writer_options.hpp>
#include <osmium/memory/buffer.hpp>
#include <osmium/thread/util.hpp>
@@ -131,7 +131,7 @@ namespace osmium {
}
}
- template <typename TFunction, typename ...TArgs>
+ template <typename TFunction, typename... TArgs>
void ensure_cleanup(TFunction func, TArgs&&... args) {
if (m_status != status::okay) {
throw io_error("Can not write to writer when in status 'closed' or 'error'");
@@ -172,18 +172,21 @@ namespace osmium {
* The constructor of the Writer object opens a file and writes the
* header to it.
*
- * All parameters except the first one can be in any order.
- *
* @param file File (contains name and format info) to open.
- * @param header Optional header data. If this is not given sensible
- * defaults will be used. See the default constructor
- * of osmium::io::Header for details.
- * @param allow_overwrite Allow overwriting of existing file? Can be
- * osmium::io::overwrite::allow or osmium::io::overwrite::no
- * (default).
- * @param fsync Should fsync be called on the file before closing it?
- * Can be osmium::io::fsync::yes or
- * osmium::io::fsync::no (default).
+ * @param args All further arguments are optional and can appear
+ * in any order:
+ *
+ * * osmium::io::Header: Optional header data. If this is
+ * not given, a default constructed osmium::io::Header
+ * object will be used.
+ *
+ * * osmium::io::overwrite: Allow overwriting of existing file?
+ * Can be osmium::io::overwrite::allow or
+ * osmium::io::overwrite::no (default).
+ *
+ * * osmium::io::fsync: Should fsync be called on the file
+ * before closing it? Can be osmium::io::fsync::yes or
+ * osmium::io::fsync::no (default).
*
* @throws osmium::io_error If there was an error.
* @throws std::system_error If the file could not be opened.
diff --git a/include/osmium/io/overwrite.hpp b/include/osmium/io/writer_options.hpp
similarity index 94%
copy from include/osmium/io/overwrite.hpp
copy to include/osmium/io/writer_options.hpp
index 0311aed..ef19553 100644
--- a/include/osmium/io/overwrite.hpp
+++ b/include/osmium/io/writer_options.hpp
@@ -1,5 +1,5 @@
-#ifndef OSMIUM_IO_OVERWRITE_HPP
-#define OSMIUM_IO_OVERWRITE_HPP
+#ifndef OSMIUM_IO_WRITER_OPTIONS_HPP
+#define OSMIUM_IO_WRITER_OPTIONS_HPP
/*
@@ -57,4 +57,4 @@ namespace osmium {
} // namespace osmium
-#endif // OSMIUM_IO_OVERWRITE_HPP
+#endif // OSMIUM_IO_WRITER_OPTIONS_HPP
diff --git a/include/osmium/memory/buffer.hpp b/include/osmium/memory/buffer.hpp
index 949f005..11a4c97 100644
--- a/include/osmium/memory/buffer.hpp
+++ b/include/osmium/memory/buffer.hpp
@@ -331,7 +331,7 @@ namespace osmium {
* @tparam T Type we want to the data to be interpreted as.
* @returns Reference of given type pointing to the data in the buffer.
*/
- template <class T>
+ template <typename T>
T& get(const size_t offset) const {
assert(m_data);
return *reinterpret_cast<T*>(&m_data[offset]);
@@ -400,7 +400,7 @@ namespace osmium {
* @param item Reference to the item to be copied.
* @returns Reference to newly copied data in the buffer.
*/
- template <class T>
+ template <typename T>
T& add_item(const T& item) {
assert(m_data);
unsigned char* target = reserve_space(item.padded_size());
@@ -440,16 +440,16 @@ namespace osmium {
* These iterators can be used to iterate over all items in
* a buffer.
*/
- template <class T>
+ template <typename T>
using t_iterator = osmium::memory::ItemIterator<T>;
- template <class T>
+ template <typename T>
using t_const_iterator = osmium::memory::ItemIterator<const T>;
typedef t_iterator<osmium::OSMEntity> iterator;
typedef t_const_iterator<osmium::OSMEntity> const_iterator;
- template <class T>
+ template <typename T>
t_iterator<T> begin() {
assert(m_data);
return t_iterator<T>(m_data, m_data + m_committed);
@@ -460,7 +460,7 @@ namespace osmium {
return iterator(m_data, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_iterator<T> get_iterator(size_t offset) {
assert(m_data);
return t_iterator<T>(m_data + offset, m_data + m_committed);
@@ -471,7 +471,7 @@ namespace osmium {
return iterator(m_data + offset, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_iterator<T> end() {
assert(m_data);
return t_iterator<T>(m_data + m_committed, m_data + m_committed);
@@ -482,7 +482,7 @@ namespace osmium {
return iterator(m_data + m_committed, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_const_iterator<T> cbegin() const {
assert(m_data);
return t_const_iterator<T>(m_data, m_data + m_committed);
@@ -493,7 +493,7 @@ namespace osmium {
return const_iterator(m_data, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_const_iterator<T> get_iterator(size_t offset) const {
assert(m_data);
return t_const_iterator<T>(m_data + offset, m_data + m_committed);
@@ -504,7 +504,7 @@ namespace osmium {
return const_iterator(m_data + offset, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_const_iterator<T> cend() const {
assert(m_data);
return t_const_iterator<T>(m_data + m_committed, m_data + m_committed);
@@ -515,7 +515,7 @@ namespace osmium {
return const_iterator(m_data + m_committed, m_data + m_committed);
}
- template <class T>
+ template <typename T>
t_const_iterator<T> begin() const {
return cbegin<T>();
}
@@ -524,7 +524,7 @@ namespace osmium {
return cbegin();
}
- template <class T>
+ template <typename T>
t_const_iterator<T> end() const {
return cend<T>();
}
@@ -567,7 +567,7 @@ namespace osmium {
* The behaviour is undefined if you call this on an invalid
* buffer.
*/
- template <class TCallbackClass>
+ template <typename TCallbackClass>
void purge_removed(TCallbackClass* callback) {
assert(m_data);
if (begin() == end()) {
diff --git a/include/osmium/memory/collection.hpp b/include/osmium/memory/collection.hpp
index 5cf3cc6..54a97f5 100644
--- a/include/osmium/memory/collection.hpp
+++ b/include/osmium/memory/collection.hpp
@@ -43,7 +43,7 @@ namespace osmium {
namespace memory {
- template <class TMember>
+ template <typename TMember>
class CollectionIterator : public std::iterator<std::forward_iterator_tag, TMember> {
// This data_type is either 'unsigned char*' or 'const unsigned char*' depending
@@ -101,7 +101,7 @@ namespace osmium {
}; // class CollectionIterator
- template <class TMember, osmium::item_type TCollectionItemType>
+ template <typename TMember, osmium::item_type TCollectionItemType>
class Collection : public Item {
public:
diff --git a/include/osmium/memory/item.hpp b/include/osmium/memory/item.hpp
index dc54404..30c5377 100644
--- a/include/osmium/memory/item.hpp
+++ b/include/osmium/memory/item.hpp
@@ -102,10 +102,10 @@ namespace osmium {
uint16_t m_removed : 1;
uint16_t m_padding : 15;
- template <class TMember>
+ template <typename TMember>
friend class CollectionIterator;
- template <class TMember>
+ template <typename TMember>
friend class ItemIterator;
friend class osmium::builder::Builder;
diff --git a/include/osmium/memory/item_iterator.hpp b/include/osmium/memory/item_iterator.hpp
index 3e5b5fa..c6b4205 100644
--- a/include/osmium/memory/item_iterator.hpp
+++ b/include/osmium/memory/item_iterator.hpp
@@ -60,7 +60,7 @@ namespace osmium {
namespace detail {
- template <class T>
+ template <typename T>
inline bool type_is_compatible(osmium::item_type) noexcept {
return true;
}
@@ -127,7 +127,7 @@ namespace osmium {
} // namespace detail
- template <class TMember>
+ template <typename TMember>
class ItemIterator : public std::iterator<std::forward_iterator_tag, TMember> {
static_assert(std::is_base_of<osmium::memory::Item, TMember>::value, "TMember must derive from osmium::memory::Item");
@@ -160,7 +160,7 @@ namespace osmium {
advance_to_next_item_of_right_type();
}
- template <class T>
+ template <typename T>
ItemIterator<T> cast() const {
return ItemIterator<T>(m_data, m_end);
}
diff --git a/include/osmium/object_pointer_collection.hpp b/include/osmium/object_pointer_collection.hpp
index 7524703..85566b6 100644
--- a/include/osmium/object_pointer_collection.hpp
+++ b/include/osmium/object_pointer_collection.hpp
@@ -84,7 +84,7 @@ namespace osmium {
/**
* Sort objects according to the given order functor.
*/
- template <class TCompare>
+ template <typename TCompare>
void sort(TCompare&& compare) {
std::sort(m_objects.begin(), m_objects.end(), std::forward<TCompare>(compare));
}
diff --git a/include/osmium/osm/changeset.hpp b/include/osmium/osm/changeset.hpp
index c5e8358..051b525 100644
--- a/include/osmium/osm/changeset.hpp
+++ b/include/osmium/osm/changeset.hpp
@@ -49,7 +49,7 @@ namespace osmium {
namespace builder {
class ChangesetDiscussionBuilder;
- template <class T> class ObjectBuilder;
+ template <typename T> class ObjectBuilder;
}
class Changeset;
@@ -77,7 +77,7 @@ namespace osmium {
return data() + osmium::memory::padded_length(sizeof(ChangesetComment) + m_user_size + m_text_size);
}
- template <class TMember>
+ template <typename TMember>
friend class osmium::memory::CollectionIterator;
unsigned char* next() {
diff --git a/include/osmium/osm/crc.hpp b/include/osmium/osm/crc.hpp
index cf81476..309f50a 100644
--- a/include/osmium/osm/crc.hpp
+++ b/include/osmium/osm/crc.hpp
@@ -79,7 +79,7 @@ namespace osmium {
}
- template <class TCRC>
+ template <typename TCRC>
class CRC {
TCRC m_crc;
diff --git a/include/osmium/osm/diff_object.hpp b/include/osmium/osm/diff_object.hpp
index 1e053fd..96e07bc 100644
--- a/include/osmium/osm/diff_object.hpp
+++ b/include/osmium/osm/diff_object.hpp
@@ -33,6 +33,7 @@ DEALINGS IN THE SOFTWARE.
*/
+#include <osmium/fwd.hpp>
#include <osmium/osm/item_type.hpp>
#include <osmium/osm/object.hpp>
#include <osmium/osm/timestamp.hpp>
@@ -40,10 +41,6 @@ DEALINGS IN THE SOFTWARE.
namespace osmium {
- class Node;
- class Way;
- class Relation;
-
class DiffObject {
protected:
@@ -145,7 +142,7 @@ namespace osmium {
}; // class DiffObject
- template <class T>
+ template <typename T>
class DiffObjectDerived : public DiffObject {
public:
diff --git a/include/osmium/osm/entity.hpp b/include/osmium/osm/entity.hpp
index ce292c8..c7f7055 100644
--- a/include/osmium/osm/entity.hpp
+++ b/include/osmium/osm/entity.hpp
@@ -41,7 +41,7 @@ namespace osmium {
namespace detail {
- template <class TSubitem, class TIter>
+ template <typename TSubitem, typename TIter>
inline TSubitem& subitem_of_type(TIter it, TIter end) {
for (; it != end; ++it) {
if (it->type() == TSubitem::itemtype) {
diff --git a/include/osmium/osm/node.hpp b/include/osmium/osm/node.hpp
index 123bfc4..e9facef 100644
--- a/include/osmium/osm/node.hpp
+++ b/include/osmium/osm/node.hpp
@@ -41,7 +41,7 @@ DEALINGS IN THE SOFTWARE.
namespace osmium {
namespace builder {
- template <class T> class ObjectBuilder;
+ template <typename T> class ObjectBuilder;
}
class Node : public OSMObject {
diff --git a/include/osmium/osm/object.hpp b/include/osmium/osm/object.hpp
index 039e741..c0f46ad 100644
--- a/include/osmium/osm/object.hpp
+++ b/include/osmium/osm/object.hpp
@@ -355,38 +355,38 @@ namespace osmium {
return cend();
}
- template <class T>
+ template <typename T>
using t_iterator = osmium::memory::ItemIterator<T>;
- template <class T>
+ template <typename T>
using t_const_iterator = osmium::memory::ItemIterator<const T>;
- template <class T>
+ template <typename T>
t_iterator<T> begin() {
return t_iterator<T>(subitems_position(), next());
}
- template <class T>
+ template <typename T>
t_iterator<T> end() {
return t_iterator<T>(next(), next());
}
- template <class T>
+ template <typename T>
t_const_iterator<T> cbegin() const {
return t_const_iterator<T>(subitems_position(), next());
}
- template <class T>
+ template <typename T>
t_const_iterator<T> cend() const {
return t_const_iterator<T>(next(), next());
}
- template <class T>
+ template <typename T>
t_const_iterator<T> begin() const {
return cbegin<T>();
}
- template <class T>
+ template <typename T>
t_const_iterator<T> end() const {
return cend<T>();
}
diff --git a/include/osmium/osm/relation.hpp b/include/osmium/osm/relation.hpp
index 99a4f4c..1a8b686 100644
--- a/include/osmium/osm/relation.hpp
+++ b/include/osmium/osm/relation.hpp
@@ -47,7 +47,7 @@ DEALINGS IN THE SOFTWARE.
namespace osmium {
namespace builder {
- template <class> class ObjectBuilder;
+ template <typename> class ObjectBuilder;
class RelationMemberListBuilder;
}
@@ -74,7 +74,7 @@ namespace osmium {
return data() + osmium::memory::padded_length(sizeof(RelationMember) + m_role_size);
}
- template <class TMember>
+ template <typename TMember>
friend class osmium::memory::CollectionIterator;
unsigned char* next() {
diff --git a/include/osmium/osm/tag.hpp b/include/osmium/osm/tag.hpp
index 2e93ede..30e670d 100644
--- a/include/osmium/osm/tag.hpp
+++ b/include/osmium/osm/tag.hpp
@@ -53,7 +53,7 @@ namespace osmium {
Tag& operator=(const Tag&) = delete;
Tag& operator=(Tag&&) = delete;
- template <class TMember>
+ template <typename TMember>
friend class osmium::memory::CollectionIterator;
static unsigned char* after_null(unsigned char* ptr) {
diff --git a/include/osmium/osm/way.hpp b/include/osmium/osm/way.hpp
index 3c5f1f6..89380e4 100644
--- a/include/osmium/osm/way.hpp
+++ b/include/osmium/osm/way.hpp
@@ -43,7 +43,7 @@ DEALINGS IN THE SOFTWARE.
namespace osmium {
namespace builder {
- template <class T> class ObjectBuilder;
+ template <typename T> class ObjectBuilder;
}
/**
diff --git a/include/osmium/relations/collector.hpp b/include/osmium/relations/collector.hpp
index 040e392..e7f76a2 100644
--- a/include/osmium/relations/collector.hpp
+++ b/include/osmium/relations/collector.hpp
@@ -42,6 +42,7 @@ DEALINGS IN THE SOFTWARE.
//#include <iostream>
#include <vector>
+#include <osmium/fwd.hpp>
#include <osmium/osm/item_type.hpp>
#include <osmium/osm/object.hpp>
#include <osmium/osm/relation.hpp> // IWYU pragma: keep
@@ -55,9 +56,6 @@ DEALINGS IN THE SOFTWARE.
namespace osmium {
- class Node;
- class Way;
-
/**
* @brief Code related to the assembly of OSM relations
*/
@@ -91,7 +89,7 @@ namespace osmium {
*
* @tparam TRelations Are we interested in member relations?
*/
- template <class TCollector, bool TNodes, bool TWays, bool TRelations>
+ template <typename TCollector, bool TNodes, bool TWays, bool TRelations>
class Collector {
/**
@@ -474,14 +472,14 @@ namespace osmium {
return range.first->buffer_offset();
}
- template <class TIter>
+ template <typename TIter>
void read_relations(TIter begin, TIter end) {
HandlerPass1 handler(*static_cast<TCollector*>(this));
osmium::apply(begin, end, handler);
sort_member_meta();
}
- template <class TSource>
+ template <typename TSource>
void read_relations(TSource& source) {
read_relations(std::begin(source), std::end(source));
source.close();
diff --git a/include/osmium/relations/detail/member_meta.hpp b/include/osmium/relations/detail/member_meta.hpp
index a45088e..ea86734 100644
--- a/include/osmium/relations/detail/member_meta.hpp
+++ b/include/osmium/relations/detail/member_meta.hpp
@@ -144,7 +144,7 @@ namespace osmium {
* @param begin Begin of iterator range
* @param end End of iterator range
*/
- template <class TIter>
+ template <typename TIter>
inline typename std::iterator_traits<TIter>::difference_type count_not_removed(TIter begin, TIter end) {
return std::count_if(begin, end, [](MemberMeta& mm) {
return !mm.removed();
diff --git a/include/osmium/tags/filter.hpp b/include/osmium/tags/filter.hpp
index 3c1946c..0d3fc4e 100644
--- a/include/osmium/tags/filter.hpp
+++ b/include/osmium/tags/filter.hpp
@@ -46,7 +46,7 @@ namespace osmium {
namespace tags {
- template <class TKey>
+ template <typename TKey>
struct match_key {
bool operator()(const TKey& rule_key, const char* tag_key) {
return rule_key == tag_key;
@@ -59,7 +59,7 @@ namespace osmium {
}
}; // struct match_key_prefix
- template <class TValue>
+ template <typename TValue>
struct match_value {
bool operator()(const TValue& rule_value, const char* tag_value) {
return rule_value == tag_value;
@@ -73,7 +73,7 @@ namespace osmium {
}
}; // struct match_value<void>
- template <class TKey, class TValue=void, class TKeyComp=match_key<TKey>, class TValueComp=match_value<TValue>>
+ template <typename TKey, typename TValue=void, typename TKeyComp=match_key<TKey>, typename TValueComp=match_value<TValue>>
class Filter {
typedef TKey key_type;
@@ -115,7 +115,7 @@ namespace osmium {
m_default_result(default_result) {
}
- template <class V=TValue, typename std::enable_if<!std::is_void<V>::value, int>::type = 0>
+ template <typename V=TValue, typename std::enable_if<!std::is_void<V>::value, int>::type = 0>
Filter& add(bool result, const key_type& key, const value_type& value) {
m_rules.emplace_back(result, false, key, value);
return *this;
diff --git a/include/osmium/tags/taglist.hpp b/include/osmium/tags/taglist.hpp
index d7c78dc..8fc9c68 100644
--- a/include/osmium/tags/taglist.hpp
+++ b/include/osmium/tags/taglist.hpp
@@ -45,17 +45,17 @@ namespace osmium {
*/
namespace tags {
- template <class TFilter>
+ template <typename TFilter>
inline bool match_any_of(const osmium::TagList& tag_list, TFilter&& filter) {
return std::any_of(tag_list.cbegin(), tag_list.cend(), std::forward<TFilter>(filter));
}
- template <class TFilter>
+ template <typename TFilter>
inline bool match_all_of(const osmium::TagList& tag_list, TFilter&& filter) {
return std::all_of(tag_list.cbegin(), tag_list.cend(), std::forward<TFilter>(filter));
}
- template <class TFilter>
+ template <typename TFilter>
inline bool match_none_of(const osmium::TagList& tag_list, TFilter&& filter) {
return std::none_of(tag_list.cbegin(), tag_list.cend(), std::forward<TFilter>(filter));
}
diff --git a/include/osmium/thread/util.hpp b/include/osmium/thread/util.hpp
index 5a1ab16..00de0d8 100644
--- a/include/osmium/thread/util.hpp
+++ b/include/osmium/thread/util.hpp
@@ -49,7 +49,7 @@ namespace osmium {
* the exception stored in the future if there was one. Otherwise it
* will just return.
*/
- template <class T>
+ template <typename T>
inline void check_for_exception(std::future<T>& future) {
if (future.valid() && future.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
future.get();
@@ -60,7 +60,7 @@ namespace osmium {
* Wait until the given future becomes ready. Will block if the future
* is not ready. Can be called more than once unlike future.get().
*/
- template <class T>
+ template <typename T>
inline void wait_until_done(std::future<T>& future) {
if (future.valid()) {
future.get();
diff --git a/include/osmium/util/compatibility.hpp b/include/osmium/util/compatibility.hpp
index 90d85c5..23753ce 100644
--- a/include/osmium/util/compatibility.hpp
+++ b/include/osmium/util/compatibility.hpp
@@ -44,4 +44,13 @@ DEALINGS IN THE SOFTWARE.
# define OSMIUM_NORETURN [[noreturn]]
#endif
+// [[deprecated]] is only available in C++14, use this for the time being
+#ifdef __GNUC__
+# define OSMIUM_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER)
+# define OSMIUM_DEPRECATED __declspec(deprecated)
+#else
+# define OSMIUM_DEPRECATED
+#endif
+
#endif // OSMIUM_UTIL_COMPATIBILITY_HPP
diff --git a/include/osmium/visitor.hpp b/include/osmium/visitor.hpp
index a52e8c3..35fcb4e 100644
--- a/include/osmium/visitor.hpp
+++ b/include/osmium/visitor.hpp
@@ -58,7 +58,7 @@ namespace osmium {
template <typename T, typename U>
using ConstIfConst = typename std::conditional<std::is_const<T>::value, typename std::add_const<U>::type, U>::type;
- template <class THandler, class TItem>
+ template <typename THandler, typename TItem>
inline void apply_item_recurse(TItem& item, THandler& handler) {
switch (item.type()) {
case osmium::item_type::undefined:
@@ -104,7 +104,7 @@ namespace osmium {
}
}
- template <class THandler>
+ template <typename THandler>
inline void apply_item_recurse(const osmium::OSMEntity& item, THandler& handler) {
switch (item.type()) {
case osmium::item_type::node:
@@ -131,7 +131,7 @@ namespace osmium {
}
}
- template <class THandler>
+ template <typename THandler>
inline void apply_item_recurse(osmium::OSMEntity& item, THandler& handler) {
switch (item.type()) {
case osmium::item_type::node:
@@ -158,7 +158,7 @@ namespace osmium {
}
}
- template <class THandler>
+ template <typename THandler>
inline void apply_item_recurse(const osmium::OSMObject& item, THandler& handler) {
switch (item.type()) {
case osmium::item_type::node:
@@ -182,7 +182,7 @@ namespace osmium {
}
}
- template <class THandler>
+ template <typename THandler>
inline void apply_item_recurse(osmium::OSMObject& item, THandler& handler) {
switch (item.type()) {
case osmium::item_type::node:
@@ -206,18 +206,18 @@ namespace osmium {
}
}
- template <class THandler, class TItem, class ...TRest>
+ template <typename THandler, typename TItem, typename... TRest>
inline void apply_item_recurse(TItem& item, THandler& handler, TRest&... more) {
apply_item_recurse(item, handler);
apply_item_recurse(item, more...);
}
- template <class THandler>
+ template <typename THandler>
inline void flush_recurse(THandler& handler) {
handler.flush();
}
- template <class THandler, class ...TRest>
+ template <typename THandler, typename... TRest>
inline void flush_recurse(THandler& handler, TRest&... more) {
flush_recurse(handler);
flush_recurse(more...);
@@ -225,17 +225,17 @@ namespace osmium {
} // namespace detail
- template <class ...THandlers>
+ template <typename... THandlers>
inline void apply_item(const osmium::memory::Item& item, THandlers&... handlers) {
detail::apply_item_recurse(item, handlers...);
}
- template <class ...THandlers>
+ template <typename... THandlers>
inline void apply_item(osmium::memory::Item& item, THandlers&... handlers) {
detail::apply_item_recurse(item, handlers...);
}
- template <class TIterator, class ...THandlers>
+ template <typename TIterator, typename... THandlers>
inline void apply(TIterator it, TIterator end, THandlers&... handlers) {
for (; it != end; ++it) {
detail::apply_item_recurse(*it, handlers...);
@@ -243,12 +243,12 @@ namespace osmium {
detail::flush_recurse(handlers...);
}
- template <class TContainer, class ...THandlers>
+ template <typename TContainer, typename... THandlers>
inline void apply(TContainer& c, THandlers&... handlers) {
apply(std::begin(c), std::end(c), handlers...);
}
- template <class ...THandlers>
+ template <typename... THandlers>
inline void apply(const osmium::memory::Buffer& buffer, THandlers&... handlers) {
apply(buffer.cbegin(), buffer.cend(), handlers...);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libosmium.git
More information about the Pkg-grass-devel
mailing list