0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Remove variations of serialization from interpretable

I am not even sure any more what this was intended for?
Maybe for the STL connector?
Anyways, not really needed.
This commit is contained in:
Roland Bock 2021-07-30 21:33:29 +02:00
parent 34a8f34821
commit cf87fbd68e
7 changed files with 10 additions and 158 deletions

View File

@ -28,7 +28,7 @@
#define SQLPP11_ALL_OF_H
#include <sqlpp11/alias.h>
#include <sqlpp11/interpret.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/portable_static_assert.h>
namespace sqlpp

View File

@ -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 <sqlpp11/interpreter.h>
namespace sqlpp
{
template <typename T, typename Context>
auto interpret(const T& t, Context& context) -> decltype(interpreter_t<Context, T>::_(t, context))
{
return interpreter_t<Context, T>::_(t, context);
}
} // namespace sqlpp
#endif

View File

@ -28,10 +28,8 @@
#define SQLPP11_INTERPRETABLE_H
#include <memory>
#include <sqlpp11/serializer_context.h>
#include <sqlpp11/parameter_list.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/interpret.h>
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 <typename T>
interpretable_t(T t) : _requires_braces(requires_braces_t<T>::value), _impl(std::make_shared<_impl_t<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 <typename Context>
auto serialize(Context& context) const ->
typename std::enable_if<std::is_same<Context, _serializer_context_t>::value and
not std::is_same<Context, serializer_context_t>::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 <typename T>
@ -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;
};

View File

@ -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 <sqlpp11/wrong.h>
namespace sqlpp
{
template <typename Context, typename T, typename Enable = void>
struct interpreter_t
{
static void _(const T& /*unused*/, Context& /*unused*/)
{
static_assert(wrong_t<interpreter_t>::value, "missing interpreter specialization");
}
};
} // namespace sqlpp
#endif

View File

@ -28,7 +28,6 @@
#define SQLPP11_NAMED_INTERPRETABLE_H
#include <memory>
#include <sqlpp11/serializer_context.h>
#include <sqlpp11/parameter_list.h>
#include <sqlpp11/char_sequence.h>
@ -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 <typename T>
named_interpretable_t(T t) : _requires_braces(requires_braces_t<T>::value), _impl(std::make_shared<_impl_t<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 <typename Context>
auto serialize(Context& context) const ->
typename std::enable_if<std::is_same<Context, _serializer_context_t>::value and
not std::is_same<Context, serializer_context_t>::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<T>::template char_ptr<_interpreter_context_t>();
return name_of<T>::template char_ptr<_serializer_context_t>();
}
T _t;

View File

@ -28,7 +28,7 @@
#define SQLPP11_SCHEMA_QUALIFIED_TABLE_H
#include <sqlpp11/column_fwd.h>
#include <sqlpp11/interpret.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/schema.h>
#include <sqlpp11/table_alias.h>

View File

@ -30,7 +30,7 @@
#include <sqlpp11/alias.h>
#include <sqlpp11/column_fwd.h>
#include <sqlpp11/detail/type_set.h>
#include <sqlpp11/interpret.h>
#include <sqlpp11/serialize.h>
#include <sqlpp11/join.h>
#include <sqlpp11/type_traits.h>