From 60610a1ea5a56160bbaebef94aee45abe0096a87 Mon Sep 17 00:00:00 2001 From: randomdan <randomdan@localhost> Date: Thu, 17 Apr 2014 19:11:56 +0000 Subject: Support writing variable types to streams natively --- project2/common/variableType.cpp | 14 ++++++++++++++ project2/common/variableType.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/project2/common/variableType.cpp b/project2/common/variableType.cpp index b19d2fd..2902638 100644 --- a/project2/common/variableType.cpp +++ b/project2/common/variableType.cpp @@ -264,3 +264,17 @@ VariableType::isNull() const return (get<Null>()); } +std::basic_ostream<char> & +operator<<(std::basic_ostream<char> & s, const Null &) +{ + s << "(null)"; + return s; +} + +std::basic_ostream<unsigned char> & +operator<<(std::basic_ostream<unsigned char> & s, const Null &) +{ + s << "(null)"; + return s; +} + diff --git a/project2/common/variableType.h b/project2/common/variableType.h index 5bf4c53..f2a6890 100644 --- a/project2/common/variableType.h +++ b/project2/common/variableType.h @@ -3,6 +3,7 @@ #include <boost/any.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/posix_time_io.hpp> #include <glibmm/ustring.h> #include <boost/variant.hpp> #include <boost/optional.hpp> @@ -28,6 +29,9 @@ class Null { bool operator==(const Null &) const { return true; } }; +std::basic_ostream<char> & operator<<(std::basic_ostream<char> &, const Null &); +std::basic_ostream<unsigned char> & operator<<(std::basic_ostream<unsigned char> &, const Null &); + class Boolean { public: Boolean(bool v); -- cgit v1.2.3