From db1e2f066393af3e58814417de5bbe7ea08a145d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 31 Dec 2015 04:04:31 +0000 Subject: Basics working, could do with a tidy up around mocking --- libmysqlpp/my-opts.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libmysqlpp/my-opts.cpp (limited to 'libmysqlpp/my-opts.cpp') diff --git a/libmysqlpp/my-opts.cpp b/libmysqlpp/my-opts.cpp new file mode 100644 index 0000000..b0a777d --- /dev/null +++ b/libmysqlpp/my-opts.cpp @@ -0,0 +1,34 @@ +#include "my-opts.h" + +namespace MySQL { + const char * + operator~(const OptString & os) + { + if (os) { + return os->c_str(); + } + return NULL; + } +} + +namespace std { + template + std::istream & + operator>>(std::istream & s, std::vector & o) + { + o.push_back(T()); + return (s >> o.back()); + } + + template + std::istream & + operator>>(std::istream & s, boost::optional & o) + { + o = T(); + return (s >> *o); + } + + template std::istream & operator>>(std::istream & s, boost::optional & o); + template std::istream & operator>>(std::istream & s, std::vector & o); +} + -- cgit v1.2.3