From fcdca58617caf6a8c034a91588d6abb399be6b57 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 18 May 2021 00:06:37 +0100 Subject: Initial commit, still lots to do! --- lib/streamSupport.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lib/streamSupport.h (limited to 'lib/streamSupport.h') diff --git a/lib/streamSupport.h b/lib/streamSupport.h new file mode 100644 index 0000000..0723faf --- /dev/null +++ b/lib/streamSupport.h @@ -0,0 +1,68 @@ +#ifndef MYGRATE_STREAM_SUPPORT_H +#define MYGRATE_STREAM_SUPPORT_H + +#include +#include +#include +#include +#include +#include +#include + +#include "mysql_types.h" +#include + +namespace std { + std::ostream & operator<<(std::ostream & strm, const std::byte byt); + + std::ostream & operator<<(std::ostream & s, const MARIADB_STRING & str); + + std::ostream & operator<<(std::ostream & s, const tm & tm); + + std::ostream & operator<<(std::ostream & s, const timespec & ts); + + std::ostream & operator<<(std::ostream & s, const MyGrate::MySQL::Date & d); + + std::ostream & operator<<(std::ostream & s, const MyGrate::MySQL::Time & t); + + std::ostream & operator<<(std::ostream & s, const MyGrate::MySQL::DateTime & dt); + + std::ostream & operator<<(std::ostream & s, const MyGrate::BitSet & bs); + + template + inline std::ostream & + operator<<(std::ostream & strm, const std::pair range) + { + strm << '['; + for (auto i {range.first}; i != range.second; i++) { + if (i != range.first) { + strm << ','; + } + strm << *i; + } + return strm << ']'; + } + + template + std::ostream & + operator<<(std::ostream & strm, const std::span spn) + { + return strm << std::make_pair(spn.begin(), spn.end()); + } + + template + std::ostream & + operator<<(std::ostream & strm, const std::vector & v) + { + return strm << std::span(v.data(), v.size()); + } + + template + std::ostream & + operator<<(std::ostream & strm, const std::array & a) + { + return strm << std::span(a.begin(), a.end()); + } +} + +#endif -- cgit v1.2.3