From 6f4f07fea0f98bdb1debffcc40a32d6af61ab5c0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 Apr 2011 18:50:04 +0200 Subject: Implement automatic mapping for C++ enums --- odb/mysql/enum.cxx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 odb/mysql/enum.cxx (limited to 'odb/mysql/enum.cxx') diff --git a/odb/mysql/enum.cxx b/odb/mysql/enum.cxx new file mode 100644 index 0000000..d2c8676 --- /dev/null +++ b/odb/mysql/enum.cxx @@ -0,0 +1,34 @@ +// file : odb/mysql/enums.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include // std::memmove +#include + +#include + +namespace odb +{ + namespace mysql + { + void enum_traits:: + strip_value (const details::buffer& i, unsigned long& size) + { + char* d (const_cast (i.data ())); + + unsigned long p (0); + for (; p < size && d[p] != ' '; ++p) ; + assert (p != size); + + p++; // Skip space; + size -= p; + + std::memmove (d, d + p, size); + } + } +} + +#include + +#endif // ODB_MYSQL_ENUMS_HXX -- cgit v1.1