1 #include <mbgl/tile/tile_id.hpp>
2 #include <mbgl/util/string.hpp>
3 
4 #include <iostream>
5 
6 namespace mbgl {
7 
operator <<(::std::ostream & os,const CanonicalTileID & rhs)8 ::std::ostream& operator<<(::std::ostream& os, const CanonicalTileID& rhs) {
9     // Uncomment this to create code instead of shorthands.
10     // return os << "CanonicalTileID{ " << uint32_t(rhs.z) << ", " << rhs.x << ", " << rhs.y << " }";
11     return os << uint32_t(rhs.z) << "/" << rhs.x << "/" << rhs.y;
12 }
13 
14 namespace util {
toString(const CanonicalTileID & rhs)15 std::string toString(const CanonicalTileID& rhs) {
16     return util::toString(rhs.z) + "/" + util::toString(rhs.x) + "/" + util::toString(rhs.y);
17 }
18 } // namespace util
19 
operator <<(::std::ostream & os,const OverscaledTileID & rhs)20 ::std::ostream& operator<<(::std::ostream& os, const OverscaledTileID& rhs) {
21     return os << rhs.canonical << "=>" << uint32_t(rhs.overscaledZ);
22 }
23 
24 namespace util {
toString(const OverscaledTileID & rhs)25 std::string toString(const OverscaledTileID& rhs) {
26     return util::toString(rhs.canonical) + "=>" + util::toString(rhs.overscaledZ);
27 }
28 } // namespace util
29 
operator <<(::std::ostream & os,const UnwrappedTileID & rhs)30 ::std::ostream& operator<<(::std::ostream& os, const UnwrappedTileID& rhs) {
31     // Uncomment this to create code instead of shorthands.
32     // return os << "UnwrappedTileID{ " << uint32_t(rhs.wrap) << ", { " << uint32_t(rhs.canonical.z)
33     //           << ", " << rhs.canonical.x << ", " << rhs.canonical.y << " } }";
34     return os << rhs.canonical << (rhs.wrap >= 0 ? "+" : "") << rhs.wrap;
35 }
36 
37 namespace util {
toString(const UnwrappedTileID & rhs)38 std::string toString(const UnwrappedTileID& rhs) {
39     return util::toString(rhs.canonical) + (rhs.wrap >= 0 ? "+" : "") + util::toString(rhs.wrap);
40 }
41 } // namespace util
42 
43 } // namespace mbgl
44