diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-31 04:04:31 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-04 20:44:40 +0100 |
commit | db1e2f066393af3e58814417de5bbe7ea08a145d (patch) | |
tree | 9d01e48d8ef7d63fbcca6aced2461b3f1e234dfd /libmysqlpp/my-opts.cpp | |
parent | Beginnings of embbeded MySQL (diff) | |
download | libdbpp-mysql-db1e2f066393af3e58814417de5bbe7ea08a145d.tar.bz2 libdbpp-mysql-db1e2f066393af3e58814417de5bbe7ea08a145d.tar.xz libdbpp-mysql-db1e2f066393af3e58814417de5bbe7ea08a145d.zip |
Basics working, could do with a tidy up around mocking
Diffstat (limited to 'libmysqlpp/my-opts.cpp')
-rw-r--r-- | libmysqlpp/my-opts.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
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 <typename T> + std::istream & + operator>>(std::istream & s, std::vector<T> & o) + { + o.push_back(T()); + return (s >> o.back()); + } + + template <typename T> + std::istream & + operator>>(std::istream & s, boost::optional<T> & o) + { + o = T(); + return (s >> *o); + } + + template std::istream & operator>>(std::istream & s, boost::optional<std::string> & o); + template std::istream & operator>>(std::istream & s, std::vector<std::string> & o); +} + |