summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-04-17 19:11:56 +0000
committerrandomdan <randomdan@localhost>2014-04-17 19:11:56 +0000
commita92bf8266c04709bd5a3d0161513703c51859ebf (patch)
tree063498fb7df888e6fa2391d5816328cd7ccb3cf4
parentAdd missing initializer for depth (diff)
downloadproject2-a92bf8266c04709bd5a3d0161513703c51859ebf.tar.bz2
project2-a92bf8266c04709bd5a3d0161513703c51859ebf.tar.xz
project2-a92bf8266c04709bd5a3d0161513703c51859ebf.zip
Support writing variable types to streams natively
-rw-r--r--project2/common/variableType.cpp14
-rw-r--r--project2/common/variableType.h4
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);