summaryrefslogtreecommitdiff
path: root/libodb-mysql/odb/mysql/details/conversion.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-25 18:52:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-25 18:52:59 +0300
commit3a160a80c788d81e48acf19a2cf68f29cf125dae (patch)
tree8bf000b3ae959d56367c15aa214a95d24b096905 /libodb-mysql/odb/mysql/details/conversion.hxx
parent35bdfb3e3604527f36f046928324346e8b37b46b (diff)
Turn libodb-mysql repository into package for muti-package repositorylibodb-mysql
Diffstat (limited to 'libodb-mysql/odb/mysql/details/conversion.hxx')
-rw-r--r--libodb-mysql/odb/mysql/details/conversion.hxx58
1 files changed, 58 insertions, 0 deletions
diff --git a/libodb-mysql/odb/mysql/details/conversion.hxx b/libodb-mysql/odb/mysql/details/conversion.hxx
new file mode 100644
index 0000000..5d1f575
--- /dev/null
+++ b/libodb-mysql/odb/mysql/details/conversion.hxx
@@ -0,0 +1,58 @@
+// file : odb/mysql/details/conversion.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_MYSQL_DETAILS_CONVERSION_HXX
+#define ODB_MYSQL_DETAILS_CONVERSION_HXX
+
+#include <odb/mysql/traits.hxx>
+
+#include <odb/details/meta/answer.hxx>
+
+namespace odb
+{
+ // @@ Revise this.
+ //
+ namespace details {}
+
+ namespace mysql
+ {
+ namespace details
+ {
+ using namespace odb::details;
+
+ // Detect whether conversion is specified in type_traits.
+ //
+ template <typename T>
+ meta::yes
+ conversion_p_test (typename type_traits<T>::conversion*);
+
+ template <typename T>
+ meta::no
+ conversion_p_test (...);
+
+ template <typename T>
+ struct conversion_p
+ {
+ static const bool value =
+ sizeof (conversion_p_test<T> (0)) == sizeof (meta::yes);
+ };
+
+ template <typename T, bool = conversion_p<T>::value>
+ struct conversion;
+
+ template <typename T>
+ struct conversion<T, true>
+ {
+ static const char* to () {return type_traits<T>::conversion::to ();}
+ };
+
+ template <typename T>
+ struct conversion<T, false>
+ {
+ static const char* to () {return 0;}
+ };
+ }
+ }
+}
+
+#endif // ODB_MYSQL_DETAILS_CONVERSION_HXX