diff options
Diffstat (limited to 'Swiften/Base/LogSerializers.h')
-rw-r--r-- | Swiften/Base/LogSerializers.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Swiften/Base/LogSerializers.h b/Swiften/Base/LogSerializers.h index b804808..7f73686 100644 --- a/Swiften/Base/LogSerializers.h +++ b/Swiften/Base/LogSerializers.h @@ -8,2 +8,3 @@ +#include <map> #include <memory> @@ -11,2 +12,3 @@ #include <string> +#include <utility> #include <vector> @@ -42,3 +44,3 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vec) { } - } + } stream << "]"; @@ -47,2 +49,24 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vec) { +template <typename KEY, typename VALUE> +std::ostream& operator<<(std::ostream& stream, const std::pair<KEY, VALUE>& pair) { + stream << pair.first << ":" << pair.second; + return stream; +} + +template <typename KEY, typename VALUE> +std::ostream& operator<<(std::ostream& stream, const std::map<KEY, VALUE>& map) { + stream << "{"; + if (!map.empty()) { + auto it = std::begin(map); + stream << *it; + + ++it; + for (auto end = std::end(map); it != end; ++it) { + stream << ", " << *it; + } + } + stream << "}"; + return stream; +} + std::ostream& operator<<(std::ostream& stream, const Presence& presence); |