summaryrefslogtreecommitdiff
path: root/libodb-pgsql/odb/pgsql/details/conversion.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-25 17:28:38 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-25 17:28:38 +0300
commitd9f372d7b1bc1abbff5fdf9735118290cd024d5e (patch)
tree49bc3160ea184e19cd5cb6a7404dee42311c0fd7 /libodb-pgsql/odb/pgsql/details/conversion.hxx
parent55e14d8f9697adeeb05fcd23cf8f19c33452bb56 (diff)
Turn libodb-pgsql repository into package for muti-package repositorylibodb-pgsql
Diffstat (limited to 'libodb-pgsql/odb/pgsql/details/conversion.hxx')
-rw-r--r--libodb-pgsql/odb/pgsql/details/conversion.hxx58
1 files changed, 58 insertions, 0 deletions
diff --git a/libodb-pgsql/odb/pgsql/details/conversion.hxx b/libodb-pgsql/odb/pgsql/details/conversion.hxx
new file mode 100644
index 0000000..b4d7e4f
--- /dev/null
+++ b/libodb-pgsql/odb/pgsql/details/conversion.hxx
@@ -0,0 +1,58 @@
+// file : odb/pgsql/details/conversion.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_PGSQL_DETAILS_CONVERSION_HXX
+#define ODB_PGSQL_DETAILS_CONVERSION_HXX
+
+#include <odb/pgsql/traits.hxx>
+
+#include <odb/details/meta/answer.hxx>
+
+namespace odb
+{
+ // @@ Revise this.
+ //
+ namespace details {}
+
+ namespace pgsql
+ {
+ 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_PGSQL_DETAILS_CONVERSION_HXX