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

Moved "wrong" template to namespace vendor

This commit is contained in:
rbock 2014-01-29 14:28:07 +01:00
parent b90eb7192a
commit 9bcae0867f
13 changed files with 51 additions and 41 deletions

View File

@ -36,7 +36,7 @@
#include <sqlpp11/vendor/assignment.h>
#include <sqlpp11/vendor/expression.h>
#include <sqlpp11/vendor/interpreter.h>
#include <sqlpp11/detail/wrong.h>
#include <sqlpp11/vendor/wrong.h>
namespace sqlpp
{

View File

@ -28,7 +28,7 @@
#define SQLPP_DETAIL_SET_H
#include <type_traits>
#include <sqlpp11/detail/wrong.h>
#include <sqlpp11/vendor/wrong.h>
namespace sqlpp
{
@ -76,7 +76,7 @@ namespace sqlpp
template<typename T>
struct is_superset_of
{
static_assert(wrong<T>::value, "invalid argument for is_superset_of");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for is_superset_of");
};
template<typename... T>
@ -86,7 +86,7 @@ namespace sqlpp
template<typename T>
struct join
{
static_assert(wrong<T>::value, "invalid argument for set::join");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for set::join");
};
template<typename... T>
@ -96,7 +96,7 @@ namespace sqlpp
template<typename T>
struct is_disjunct_from
{
static_assert(wrong<T>::value, "invalid argument for is_disjunct_from");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for is_disjunct_from");
};
template<typename... T>
@ -106,7 +106,7 @@ namespace sqlpp
template<typename T>
struct is_subset_of
{
static_assert(wrong<T>::value, "invalid argument for is_subset_of");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for is_subset_of");
};
template<typename... T>
@ -116,7 +116,7 @@ namespace sqlpp
template<typename T>
struct equals
{
static_assert(wrong<T>::value, "invalid argument for equals");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for equals");
};
template<typename... T>

View File

@ -35,7 +35,7 @@ namespace sqlpp
template<typename AliasProvider, typename T>
struct multi_column_t
{
static_assert(detail::wrong<T>::value, "invalid argument for multicolumn_t");
static_assert(vendor::wrong_t<T>::value, "invalid argument for multicolumn_t");
};
template<typename AliasProvider, typename... NamedExpr>

View File

@ -27,7 +27,7 @@
#ifndef SQLPP_PARAMETER_LIST_H
#define SQLPP_PARAMETER_LIST_H
#include <sqlpp11/detail/wrong.h>
#include <sqlpp11/vendor/wrong.h>
#include <tuple>
namespace sqlpp
@ -35,7 +35,7 @@ namespace sqlpp
template<typename T>
struct parameter_list_t
{
static_assert(detail::wrong<T>::value, "Template parameter for parameter_list_t has to be a tuple");
static_assert(vendor::wrong_t<T>::value, "Template parameter for parameter_list_t has to be a tuple");
};
template<typename... Parameter>

View File

@ -45,7 +45,7 @@
#include <sqlpp11/vendor/expression.h>
#include <sqlpp11/vendor/interpreter.h>
#include <sqlpp11/detail/wrong.h>
#include <sqlpp11/vendor/wrong.h>
#include <sqlpp11/detail/make_flag_tuple.h>
#include <sqlpp11/detail/make_expression_tuple.h>

View File

@ -66,7 +66,7 @@ namespace sqlpp
static void _(const T& t, Context& context)
{
static_assert(detail::wrong<T>::value, "tvin() must not be used with anything but =, ==, != and !");
static_assert(vendor::wrong_t<T>::value, "tvin() must not be used with anything but =, ==, != and !");
}
};
}

View File

@ -40,9 +40,9 @@ namespace sqlpp
namespace vendor
{
template<typename Lhs, typename Rhs>
struct equal_t: public detail::boolean::template operators<equal_t<Lhs, Rhs>>
struct equal_t: public ::sqlpp::detail::boolean::template operators<equal_t<Lhs, Rhs>>
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
using _parameter_tuple_t = std::tuple<Lhs, Rhs>;
equal_t(Lhs lhs, Rhs rhs):
@ -84,9 +84,9 @@ namespace sqlpp
};
template<typename Lhs, typename Rhs>
struct not_equal_t: public detail::boolean::template operators<not_equal_t<Lhs, Rhs>>
struct not_equal_t: public ::sqlpp::detail::boolean::template operators<not_equal_t<Lhs, Rhs>>
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
using _parameter_tuple_t = std::tuple<Lhs, Rhs>;
not_equal_t(Lhs lhs, Rhs rhs):
@ -128,9 +128,9 @@ namespace sqlpp
};
template<typename Lhs>
struct logical_not_t: public detail::boolean::template operators<logical_not_t<Lhs>>
struct logical_not_t: public ::sqlpp::detail::boolean::template operators<logical_not_t<Lhs>>
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
using _parameter_tuple_t = std::tuple<Lhs>;
logical_not_t(Lhs l):

View File

@ -44,37 +44,37 @@ namespace sqlpp
{
struct less_than
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = "<";
};
struct less_equal
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = "<=";
};
struct greater_equal
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = ">=";
};
struct greater_than
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = ">";
};
struct logical_or
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = " OR ";
};
struct logical_and
{
using _value_type = detail::boolean;
using _value_type = ::sqlpp::detail::boolean;
static constexpr const char* _name = " AND ";
};
@ -101,13 +101,13 @@ namespace sqlpp
struct divides
{
using _value_type = detail::floating_point;
using _value_type = ::sqlpp::detail::floating_point;
static constexpr const char* _name = "/";
};
struct modulus
{
using _value_type = detail::integral;
using _value_type = ::sqlpp::detail::integral;
static constexpr const char* _name = "%";
};

View File

@ -27,7 +27,7 @@
#ifndef SQLPP_VENDOR_INTERPRET_H
#define SQLPP_VENDOR_INTERPRET_H
#include <sqlpp11/detail/wrong.h>
#include <sqlpp11/vendor/wrong.h>
namespace sqlpp
{
@ -38,7 +38,7 @@ namespace sqlpp
{
static void _(const T& t, Context& context)
{
static_assert(detail::wrong<Context, T>::value, "missing interpreter specialization");
static_assert(wrong_t<Context, T>::value, "missing interpreter specialization");
}
};
}

View File

@ -133,7 +133,7 @@ namespace sqlpp
template<typename Database, typename T>
struct select_column_list_t
{
static_assert(::sqlpp::detail::wrong<Database, T>::value, "invalid template argument for select_column_list");
static_assert(::sqlpp::vendor::wrong_t<Database, T>::value, "invalid template argument for select_column_list");
};
template<typename Database, typename... NamedExpr>

View File

@ -41,7 +41,7 @@ namespace sqlpp
template<typename Database, typename T>
struct select_flag_list_t
{
static_assert(::sqlpp::detail::wrong<T>::value, "invalid argument for select_flag_list");
static_assert(::sqlpp::vendor::wrong_t<T>::value, "invalid argument for select_flag_list");
};
// select_flag_list_t

View File

@ -45,7 +45,7 @@ namespace sqlpp
struct boolean_operand
{
static constexpr bool _is_expression = true;
using _value_type = detail::boolean;
using _value_type = sqlpp::detail::boolean;
bool _is_trivial() const { return _t == false; }
@ -68,7 +68,7 @@ namespace sqlpp
struct integral_operand
{
static constexpr bool _is_expression = true;
using _value_type = detail::integral;
using _value_type = ::sqlpp::detail::integral;
bool _is_trivial() const { return _t == 0; }
@ -92,7 +92,7 @@ namespace sqlpp
struct floating_point_operand
{
static constexpr bool _is_expression = true;
using _value_type = detail::floating_point;
using _value_type = ::sqlpp::detail::floating_point;
bool _is_trivial() const { return _t == 0; }
@ -114,7 +114,7 @@ namespace sqlpp
struct text_operand
{
static constexpr bool _is_expression = true;
using _value_type = detail::text;
using _value_type = ::sqlpp::detail::text;
bool _is_trivial() const { return _t.empty(); }

View File

@ -24,19 +24,29 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SQLPP_DETAIL_WRONG_H
#define SQLPP_DETAIL_WRONG_H
#ifndef SQLPP_VENDOR_WRONG_H
#define SQLPP_VENDOR_WRONG_H
#include <type_traits>
namespace sqlpp
{
namespace detail
namespace vendor
{
// A template that always returns false
// To be used with static assert, for instance, to ensure it
// fires only when the template is instantiated.
template<class ...T> struct wrong : std::false_type {};
namespace detail
{
// A template that always returns false
// To be used with static assert, for instance, to ensure it
// fires only when the template is instantiated.
template<class ...T> struct wrong_t
{
using type = std::false_type;
};
}
template<class ...T>
using wrong_t = typename detail::wrong_t<T...>::type;
}
}
#endif