From c96ef8e6a42d60ed5e514967b30b74422ef4595d Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 13 Aug 2023 19:43:21 +0800 Subject: [PATCH] add sqlite_orm --- src/iflytop/components/sqlite_orm/README.md | 2 + src/iflytop/components/sqlite_orm/sqlite_orm.hpp | 18253 +++++++++++++++++++++ 2 files changed, 18255 insertions(+) create mode 100644 src/iflytop/components/sqlite_orm/README.md create mode 100644 src/iflytop/components/sqlite_orm/sqlite_orm.hpp diff --git a/src/iflytop/components/sqlite_orm/README.md b/src/iflytop/components/sqlite_orm/README.md new file mode 100644 index 0000000..22e3ec7 --- /dev/null +++ b/src/iflytop/components/sqlite_orm/README.md @@ -0,0 +1,2 @@ +v1.8.2 +https://github.com/fnc12/sqlite_orm diff --git a/src/iflytop/components/sqlite_orm/sqlite_orm.hpp b/src/iflytop/components/sqlite_orm/sqlite_orm.hpp new file mode 100644 index 0000000..18abc89 --- /dev/null +++ b/src/iflytop/components/sqlite_orm/sqlite_orm.hpp @@ -0,0 +1,18253 @@ +#pragma once + +#if defined(_MSC_VER) +__pragma(push_macro("min")) +#undef min + __pragma(push_macro("max")) +#undef max +#endif // defined(_MSC_VER) +#pragma once + +// #include "cxx_universal.h" + +/* + * This header makes central C++ functionality on which sqlite_orm depends universally available: + * - alternative operator representations + * - ::size_t, ::ptrdiff_t, ::nullptr_t + * - C++ core language feature macros + * - macros for dealing with compiler quirks + */ + +#include // alternative operator representations + +#include // sqlite_orm is using size_t, ptrdiff_t, nullptr_t everywhere, pull it in early + + // earlier clang versions didn't make nullptr_t available in the global namespace via stddef.h, + // though it should have according to C++ documentation (see https://en.cppreference.com/w/cpp/types/nullptr_t#Notes). + // actually it should be available when including stddef.h + using std::nullptr_t; + +// #include "cxx_core_features.h" + +/* + * This header detects core C++ language features on which sqlite_orm depends. + * May be updated/overwritten by cxx_compiler_quirks.h + */ + +#ifdef __has_cpp_attribute +#define SQLITE_ORM_HAS_CPP_ATTRIBUTE(attr) __has_cpp_attribute(attr) +#else +#define SQLITE_ORM_HAS_CPP_ATTRIBUTE(attr) 0L +#endif + +#ifdef __has_include +#define SQLITE_ORM_HAS_INCLUDE(file) __has_include(file) +#else +#define SQLITE_ORM_HAS_INCLUDE(file) 0L +#endif + +#if __cpp_aggregate_nsdmi >= 201304L +#define SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED +#endif + +#if __cpp_constexpr >= 201304L +#define SQLITE_ORM_RELAXED_CONSTEXPR_SUPPORTED +#endif + +#if __cpp_noexcept_function_type >= 201510L +#define SQLITE_ORM_NOTHROW_ALIASES_SUPPORTED +#endif + +#if __cpp_aggregate_bases >= 201603L +#define SQLITE_ORM_AGGREGATE_BASES_SUPPORTED +#endif + +#if __cpp_fold_expressions >= 201603L +#define SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED +#endif + +#if __cpp_inline_variables >= 201606L +#define SQLITE_ORM_INLINE_VARIABLES_SUPPORTED +#endif + +#if __cpp_if_constexpr >= 201606L +#define SQLITE_ORM_IF_CONSTEXPR_SUPPORTED +#endif + +#if __cpp_inline_variables >= 201606L +#define SQLITE_ORM_INLINE_VARIABLES_SUPPORTED +#endif + +#if __cpp_generic_lambdas >= 201707L +#define SQLITE_ORM_EXPLICIT_GENERIC_LAMBDA_SUPPORTED +#else +#endif + +#if __cpp_consteval >= 201811L +#define SQLITE_ORM_CONSTEVAL_SUPPORTED +#endif + +#if __cpp_aggregate_paren_init >= 201902L +#define SQLITE_ORM_AGGREGATE_PAREN_INIT_SUPPORTED +#endif + +#if __cpp_concepts >= 201907L +#define SQLITE_ORM_CONCEPTS_SUPPORTED +#endif + +// #include "cxx_compiler_quirks.h" + +/* + * This header defines macros for circumventing compiler quirks on which sqlite_orm depends. + * May amend cxx_core_features.h + */ + +#ifdef __clang__ +#define SQLITE_ORM_DO_PRAGMA(...) _Pragma(#__VA_ARGS__) +#endif + +#ifdef __clang__ +#define SQLITE_ORM_CLANG_SUPPRESS(warnoption, ...) \ + SQLITE_ORM_DO_PRAGMA(clang diagnostic push) \ + SQLITE_ORM_DO_PRAGMA(clang diagnostic ignored warnoption) \ + __VA_ARGS__ \ + SQLITE_ORM_DO_PRAGMA(clang diagnostic pop) + +#else +#define SQLITE_ORM_CLANG_SUPPRESS(warnoption, ...) __VA_ARGS__ +#endif + +// clang has the bad habit of diagnosing missing brace-init-lists when constructing aggregates with base classes. +// This is a false positive, since the C++ standard is quite clear that braces for nested or base objects may be omitted, +// see https://en.cppreference.com/w/cpp/language/aggregate_initialization: +// "The braces around the nested initializer lists may be elided (omitted), +// in which case as many initializer clauses as necessary are used to initialize every member or element of the corresponding subaggregate, +// and the subsequent initializer clauses are used to initialize the following members of the object." +// In this sense clang should only warn about missing field initializers. +// Because we know what we are doing, we suppress the diagnostic message +#define SQLITE_ORM_CLANG_SUPPRESS_MISSING_BRACES(...) SQLITE_ORM_CLANG_SUPPRESS("-Wmissing-braces", __VA_ARGS__) + +#if defined(_MSC_VER) && (_MSC_VER < 1920) +#define SQLITE_ORM_BROKEN_VARIADIC_PACK_EXPANSION +#endif + +// clang 10 chokes on concepts that don't depend on template parameters; +// when it tries to instantiate an expression in a requires expression, which results in an error, +// the compiler reports an error instead of dismissing the templated function. +#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && (defined(__clang__) && (__clang_major__ == 10)) +#define SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS +#endif + +#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED +#define SQLITE_ORM_INLINE_VAR inline +#else +#define SQLITE_ORM_INLINE_VAR +#endif + +#if SQLITE_ORM_HAS_CPP_ATTRIBUTE(no_unique_address) >= 201803L +#define SQLITE_ORM_NOUNIQUEADDRESS [[no_unique_address]] +#else +#define SQLITE_ORM_NOUNIQUEADDRESS +#endif + +#ifdef SQLITE_ORM_CONSTEVAL_SUPPORTED +#define SQLITE_ORM_CONSTEVAL consteval +#else +#define SQLITE_ORM_CONSTEVAL constexpr +#endif +#pragma once + +#include // std::enable_if, std::is_same + +// #include "functional/cxx_type_traits_polyfill.h" + +#include + +// #include "cxx_universal.h" + +namespace sqlite_orm { +namespace internal { +namespace polyfill { +#if __cpp_lib_void_t >= 201411L +using std::void_t; +#else +template +using void_t = void; +#endif + +#if __cpp_lib_bool_constant >= 201505L +using std::bool_constant; +#else +template +using bool_constant = std::integral_constant; +#endif + +#if __cpp_lib_logical_traits >= 201510L && __cpp_lib_type_trait_variable_templates >= 201510L +using std::conjunction; +using std::conjunction_v; +using std::disjunction; +using std::disjunction_v; +using std::negation; +using std::negation_v; +#else +template +struct conjunction : std::true_type {}; +template +struct conjunction : B1 {}; +template +struct conjunction : std::conditional_t, B1> {}; +template +SQLITE_ORM_INLINE_VAR constexpr bool conjunction_v = conjunction::value; + +template +struct disjunction : std::false_type {}; +template +struct disjunction : B1 {}; +template +struct disjunction : std::conditional_t> {}; +template +SQLITE_ORM_INLINE_VAR constexpr bool disjunction_v = disjunction::value; + +template +struct negation : bool_constant {}; +template +SQLITE_ORM_INLINE_VAR constexpr bool negation_v = negation::value; +#endif + +#if __cpp_lib_remove_cvref >= 201711L +using std::remove_cvref, std::remove_cvref_t; +#else +template +struct remove_cvref : std::remove_cv> {}; + +template +using remove_cvref_t = typename remove_cvref::type; +#endif + +#if __cpp_lib_type_identity >= 201806L +using std::type_identity, std::type_identity_t; +#else +template +struct type_identity { + using type = T; +}; + +template +using type_identity_t = typename type_identity::type; +#endif + +#if 0 // __cpp_lib_detect >= 0L // library fundamentals TS v2, [meta.detect] + using std::nonesuch; + using std::detector; + using std::is_detected, std::is_detected_v; + using std::detected, std::detected_t; + using std::detected_or, std::detected_or_t; +#else +struct nonesuch { + ~nonesuch() = delete; + nonesuch(const nonesuch&) = delete; + void operator=(const nonesuch&) = delete; +}; + +template class Op, class... Args> +struct detector { + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> { + using value_t = std::true_type; + using type = Op; +}; + +template