diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-18 18:50:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-18 18:50:04 +0200 |
commit | 6f4f07fea0f98bdb1debffcc40a32d6af61ab5c0 (patch) | |
tree | 525de2a9e700871befc4ff92ed814cbccf5d27c1 /odb/mysql/enum.cxx | |
parent | 1e1a40eb86919a19b0c6738741be50ec084be596 (diff) |
Implement automatic mapping for C++ enums
Diffstat (limited to 'odb/mysql/enum.cxx')
-rw-r--r-- | odb/mysql/enum.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
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 <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <cstring> // std::memmove +#include <cassert> + +#include <odb/mysql/enum.hxx> + +namespace odb +{ + namespace mysql + { + void enum_traits:: + strip_value (const details::buffer& i, unsigned long& size) + { + char* d (const_cast<char*> (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 <odb/post.hxx> + +#endif // ODB_MYSQL_ENUMS_HXX |