diff options
author | randomdan <randomdan@localhost> | 2014-04-17 19:11:56 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2014-04-17 19:11:56 +0000 |
commit | 60610a1ea5a56160bbaebef94aee45abe0096a87 (patch) | |
tree | 063498fb7df888e6fa2391d5816328cd7ccb3cf4 | |
parent | Add missing initializer for depth (diff) | |
download | project2-60610a1ea5a56160bbaebef94aee45abe0096a87.tar.bz2 project2-60610a1ea5a56160bbaebef94aee45abe0096a87.tar.xz project2-60610a1ea5a56160bbaebef94aee45abe0096a87.zip |
Support writing variable types to streams natively
-rw-r--r-- | project2/common/variableType.cpp | 14 | ||||
-rw-r--r-- | project2/common/variableType.h | 4 |
2 files changed, 18 insertions, 0 deletions
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); |