1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#ifndef VTZERO_OUTPUT_HPP
#define VTZERO_OUTPUT_HPP
/*****************************************************************************
vtzero - Tiny and fast vector tile decoder and encoder in C++.
This file is from https://github.com/mapbox/vtzero where you can find more
documentation.
*****************************************************************************/
/**
* @file output.hpp
*
* @brief Contains overloads of operator<< for basic vtzero types.
*/
#include <vtzero/geometry.hpp>
#include <vtzero/types.hpp>
#include <iosfwd>
namespace vtzero {
/// Overload of the << operator for GeomType
template <typename TChar, typename TTraits>
std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const GeomType type) {
return out << geom_type_name(type);
}
/// Overload of the << operator for property_value_type
template <typename TChar, typename TTraits>
std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const property_value_type type) {
return out << property_value_type_name(type);
}
/// Overload of the << operator for index_value
template <typename TChar, typename TTraits>
std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const index_value index) {
if (index.valid()) {
return out << index.value();
}
return out << "invalid";
}
/// Overload of the << operator for index_value_pair
template <typename TChar, typename TTraits>
std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const index_value_pair index_pair) {
if (index_pair.valid()) {
return out << '[' << index_pair.key() << ',' << index_pair.value() << ']';
}
return out << "invalid";
}
/// Overload of the << operator for points
template <typename TChar, typename TTraits>
std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const point p) {
return out << '(' << p.x << ',' << p.y << ')';
}
} // namespace vtzero
#endif // VTZERO_OUTPUT_HPP
|