diff --git a/include/sqlpp11/all_of.h b/include/sqlpp11/all_of.h index 3172ef8d..bc1e6619 100644 --- a/include/sqlpp11/all_of.h +++ b/include/sqlpp11/all_of.h @@ -28,7 +28,7 @@ #define SQLPP11_ALL_OF_H #include -#include +#include #include namespace sqlpp diff --git a/include/sqlpp11/interpret.h b/include/sqlpp11/interpret.h deleted file mode 100644 index 41fee4e5..00000000 --- a/include/sqlpp11/interpret.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013-2015, Roland Bock - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SQLPP11_INTERPRET_H -#define SQLPP11_INTERPRET_H - -#include - -namespace sqlpp -{ - template - auto interpret(const T& t, Context& context) -> decltype(interpreter_t::_(t, context)) - { - return interpreter_t::_(t, context); - } -} // namespace sqlpp - -#endif diff --git a/include/sqlpp11/interpretable.h b/include/sqlpp11/interpretable.h index 139d2809..cad8d38e 100644 --- a/include/sqlpp11/interpretable.h +++ b/include/sqlpp11/interpretable.h @@ -28,10 +28,8 @@ #define SQLPP11_INTERPRETABLE_H #include -#include #include #include -#include namespace sqlpp { @@ -39,7 +37,6 @@ namespace sqlpp struct interpretable_t { using _serializer_context_t = typename Db::_serializer_context_t; - using _interpreter_context_t = typename Db::_interpreter_context_t; template interpretable_t(T t) : _requires_braces(requires_braces_t::value), _impl(std::make_shared<_impl_t>(t)) @@ -52,35 +49,18 @@ namespace sqlpp interpretable_t& operator=(interpretable_t&&) = default; ~interpretable_t() = default; - serializer_context_t& serialize(serializer_context_t& context) const + _serializer_context_t& serialize(_serializer_context_t& context) const { return _impl->serialize(context); } - // This method only exists if Db::_serializer_context_t and serializer_context_t are not the same - template - auto serialize(Context& context) const -> - typename std::enable_if::value and - not std::is_same::value, - Context&>::type - { - return _impl->db_serialize(context); - } - - _interpreter_context_t& interpret(_interpreter_context_t& context) const - { - return _impl->interpret(context); - } - bool _requires_braces; private: struct _impl_base { virtual ~_impl_base() = default; - virtual serializer_context_t& serialize(serializer_context_t& context) const = 0; - virtual _serializer_context_t& db_serialize(_serializer_context_t& context) const = 0; - virtual _interpreter_context_t& interpret(_interpreter_context_t& context) const = 0; + virtual _serializer_context_t& serialize(_serializer_context_t& context) const = 0; }; template @@ -91,24 +71,12 @@ namespace sqlpp { } - serializer_context_t& serialize(serializer_context_t& context) const + _serializer_context_t& serialize(_serializer_context_t& context) const { ::sqlpp::serialize(_t, context); return context; } - _serializer_context_t& db_serialize(_serializer_context_t& context) const - { - Db::_serialize_interpretable(_t, context); - return context; - } - - _interpreter_context_t& interpret(_interpreter_context_t& context) const - { - Db::_interpret_interpretable(_t, context); - return context; - } - T _t; }; diff --git a/include/sqlpp11/interpreter.h b/include/sqlpp11/interpreter.h deleted file mode 100644 index dc0a160d..00000000 --- a/include/sqlpp11/interpreter.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013-2015, Roland Bock - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SQLPP11_INTERPRETER_H -#define SQLPP11_INTERPRETER_H - -#include - -namespace sqlpp -{ - template - struct interpreter_t - { - static void _(const T& /*unused*/, Context& /*unused*/) - { - static_assert(wrong_t::value, "missing interpreter specialization"); - } - }; -} // namespace sqlpp - -#endif diff --git a/include/sqlpp11/named_interpretable.h b/include/sqlpp11/named_interpretable.h index f75cc8c2..68309024 100644 --- a/include/sqlpp11/named_interpretable.h +++ b/include/sqlpp11/named_interpretable.h @@ -28,7 +28,6 @@ #define SQLPP11_NAMED_INTERPRETABLE_H #include -#include #include #include @@ -38,7 +37,6 @@ namespace sqlpp struct named_interpretable_t { using _serializer_context_t = typename Db::_serializer_context_t; - using _interpreter_context_t = typename Db::_interpreter_context_t; template named_interpretable_t(T t) : _requires_braces(requires_braces_t::value), _impl(std::make_shared<_impl_t>(t)) @@ -51,26 +49,11 @@ namespace sqlpp named_interpretable_t& operator=(named_interpretable_t&&) = default; ~named_interpretable_t() = default; - serializer_context_t& serialize(serializer_context_t& context) const + _serializer_context_t& serialize(_serializer_context_t& context) const { return _impl->serialize(context); } - // This method only exists if Db::_serializer_context_t and serializer_context_t are not the same - template - auto serialize(Context& context) const -> - typename std::enable_if::value and - not std::is_same::value, - Context&>::type - { - return _impl->db_serialize(context); - } - - _interpreter_context_t& interpret(_interpreter_context_t& context) const - { - return _impl->interpret(context); - } - std::string _get_name() const { return _impl->_get_name(); @@ -82,9 +65,7 @@ namespace sqlpp struct _impl_base { virtual ~_impl_base() = default; - virtual serializer_context_t& serialize(serializer_context_t& context) const = 0; - virtual _serializer_context_t& db_serialize(_serializer_context_t& context) const = 0; - virtual _interpreter_context_t& interpret(_interpreter_context_t& context) const = 0; + virtual _serializer_context_t& serialize(_serializer_context_t& context) const = 0; virtual std::string _get_name() const = 0; }; @@ -96,27 +77,15 @@ namespace sqlpp { } - serializer_context_t& serialize(serializer_context_t& context) const + _serializer_context_t& serialize(_serializer_context_t& context) const { ::sqlpp::serialize(_t, context); return context; } - _serializer_context_t& db_serialize(_serializer_context_t& context) const - { - Db::_serialize_interpretable(_t, context); - return context; - } - - _interpreter_context_t& interpret(_interpreter_context_t& context) const - { - Db::_interpret_interpretable(_t, context); - return context; - } - std::string _get_name() const { - return name_of::template char_ptr<_interpreter_context_t>(); + return name_of::template char_ptr<_serializer_context_t>(); } T _t; diff --git a/include/sqlpp11/schema_qualified_table.h b/include/sqlpp11/schema_qualified_table.h index 69f98036..f586d747 100644 --- a/include/sqlpp11/schema_qualified_table.h +++ b/include/sqlpp11/schema_qualified_table.h @@ -28,7 +28,7 @@ #define SQLPP11_SCHEMA_QUALIFIED_TABLE_H #include -#include +#include #include #include #include diff --git a/include/sqlpp11/table_alias.h b/include/sqlpp11/table_alias.h index a73ee89d..f3561f96 100644 --- a/include/sqlpp11/table_alias.h +++ b/include/sqlpp11/table_alias.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include