Skip to content

Commit

Permalink
Merge pull request #1337 from fnc12/code-quality
Browse files Browse the repository at this point in the history
Yet another code quality PR
  • Loading branch information
trueqbit authored Jul 22, 2024
2 parents 460067a + 5da3ba3 commit 8c15e4b
Show file tree
Hide file tree
Showing 76 changed files with 9,431 additions and 9,530 deletions.
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ for:
install:
- |-
cd C:\Tools\vcpkg
git fetch --tags && git checkout 2024.06.15
git fetch --tags && git checkout 2024.07.12
cd %APPVEYOR_BUILD_FOLDER%
C:\Tools\vcpkg\bootstrap-vcpkg.bat -disableMetrics
C:\Tools\vcpkg\vcpkg integrate install
Expand Down Expand Up @@ -141,7 +141,7 @@ for:
install:
- |-
pushd $HOME/vcpkg
git fetch --tags && git checkout 2024.06.15
git fetch --tags && git checkout 2024.07.12
popd
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
Expand Down Expand Up @@ -169,7 +169,7 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
git clone --depth 1 --branch 2024.06.15 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
git clone --depth 1 --branch 2024.07.12 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3[core,dbstat,math,json1,fts5,soundex] catch2 --overlay-triplets=vcpkg/triplets
Expand Down
4 changes: 2 additions & 2 deletions dev/alias.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <type_traits> // std::enable_if, std::is_same, std::conditional
#include <type_traits> // std::enable_if, std::is_same
#include <utility> // std::make_index_sequence, std::move
#include <string> // std::string
#include <sstream> // std::stringstream
Expand Down Expand Up @@ -291,7 +291,7 @@ namespace sqlite_orm {
polyfill::conjunction_v<internal::is_table_alias<A>, internal::is_cte_moniker<internal::type_t<A>>>,
bool> = true>
constexpr auto alias_column(C c) {
using namespace internal;
using namespace ::sqlite_orm::internal;
using cte_moniker_t = type_t<A>;

if constexpr(is_column_pointer_v<C>) {
Expand Down
1 change: 0 additions & 1 deletion dev/alias_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <concepts>
#endif

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "type_traits.h"
#include "table_reference.h"
Expand Down
1 change: 1 addition & 0 deletions dev/arithmetic_tag.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include <type_traits> // std::is_integral

#include "functional/mpl/conditional.h"
Expand Down
2 changes: 2 additions & 0 deletions dev/ast/match.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <utility> // std::move

namespace sqlite_orm {
namespace internal {

Expand Down
1 change: 0 additions & 1 deletion dev/ast/where.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <type_traits> // std::false_type, std::true_type
#include <utility> // std::move

#include "../functional/cxx_universal.h"
#include "../functional/cxx_type_traits_polyfill.h"
#include "../serialize_result_type.h"

Expand Down
1 change: 0 additions & 1 deletion dev/collate_argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ namespace sqlite_orm {
rtrim,
};
}

}
1 change: 0 additions & 1 deletion dev/column_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <type_traits> // std::enable_if, std::is_same, std::decay, std::is_arithmetic, std::is_base_of
#include <functional> // std::reference_wrapper

#include "functional/cxx_universal.h" // ::nullptr_t
#include "functional/cxx_type_traits_polyfill.h"
#include "functional/mpl.h"
#include "tuple_helper/tuple_traits.h"
Expand Down
2 changes: 1 addition & 1 deletion dev/conditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <tuple> // std::tuple
#include <utility> // std::move, std::forward
#include <sstream> // std::stringstream
#include <iomanip> // std::flush

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "is_base_of_template.h"
#include "type_traits.h"
Expand Down
3 changes: 1 addition & 2 deletions dev/constraints.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#pragma once

#include <type_traits> // std::is_base_of, std::false_type, std::true_type
#include <system_error> // std::system_error
#include <ostream> // std::ostream
#include <string> // std::string
#include <tuple> // std::tuple
#include <type_traits> // std::is_base_of, std::false_type, std::true_type

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "functional/mpl.h"
#include "tuple_helper/same_or_void.h"
Expand Down
1 change: 0 additions & 1 deletion dev/cte_column_names_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <system_error>
#endif

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "type_traits.h"
#include "member_traits/member_traits.h"
Expand Down
1 change: 0 additions & 1 deletion dev/cte_moniker.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <string>
#endif

#include "functional/cxx_universal.h"
#include "functional/cstring_literal.h"
#include "alias.h"

Expand Down
1 change: 0 additions & 1 deletion dev/cte_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <vector>
#endif

#include "functional/cxx_universal.h" // ::size_t
#include "tuple_helper/tuple_fy.h"
#include "table_type_of.h"
#include "column_result.h"
Expand Down
1 change: 0 additions & 1 deletion dev/error_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ namespace sqlite_orm {
value_is_null,
no_tables_specified,
};

}

namespace std {
Expand Down
2 changes: 1 addition & 1 deletion dev/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <utility> // std::move, std::forward, std::declval
#include "functional/cxx_optional.h"

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "tags.h"
#include "operators.h"

namespace sqlite_orm {

Expand Down
1 change: 0 additions & 1 deletion dev/field_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#endif
#include "functional/cxx_optional.h"

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "is_std_ptr.h"
#include "type_traits.h"
Expand Down
1 change: 0 additions & 1 deletion dev/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <algorithm> // std::min, std::copy_n
#include <utility> // std::move, std::forward

#include "functional/cxx_universal.h" // ::size_t, ::nullptr_t
#include "functional/cxx_type_traits_polyfill.h"
#include "functional/cstring_literal.h"
#include "functional/function_traits.h"
Expand Down
2 changes: 0 additions & 2 deletions dev/functional/cstring_literal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <algorithm> // std::copy_n
#endif

#include "cxx_universal.h" // ::size_t

#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
namespace sqlite_orm::internal {
/*
Expand Down
1 change: 1 addition & 0 deletions dev/functional/cxx_functional_polyfill.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include <functional>
#if __cpp_lib_invoke < 201411L
#include <type_traits> // std::enable_if, std::is_member_object_pointer, std::is_member_function_pointer
Expand Down
1 change: 0 additions & 1 deletion dev/functional/cxx_tuple_polyfill.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <utility> // std::forward, std::index_sequence, std::make_index_sequence
#endif

#include "../functional/cxx_universal.h" // ::size_t
#include "../functional/cxx_functional_polyfill.h" // std::invoke

namespace sqlite_orm {
Expand Down
1 change: 0 additions & 1 deletion dev/functional/cxx_type_traits_polyfill.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include <type_traits>

#include "cxx_universal.h"
#include "mpl/conditional.h"

namespace sqlite_orm {
Expand Down
2 changes: 0 additions & 2 deletions dev/functional/index_sequence_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <utility> // std::index_sequence

#include "../functional/cxx_universal.h" // ::size_t

namespace sqlite_orm {
namespace internal {
#if defined(SQLITE_ORM_PACK_INDEXING_SUPPORTED)
Expand Down
1 change: 0 additions & 1 deletion dev/functional/mpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <array>
#endif

#include "cxx_universal.h" // ::size_t
#include "cxx_type_traits_polyfill.h"
#include "mpl/conditional.h"

Expand Down
1 change: 0 additions & 1 deletion dev/get_prepared_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <type_traits> // std::is_same, std::remove_reference, std::remove_cvref
#include <tuple> // std::get

#include "functional/cxx_universal.h" // ::size_t
#include "functional/cxx_type_traits_polyfill.h"
#include "functional/static_magic.h"
#include "type_traits.h"
Expand Down
5 changes: 4 additions & 1 deletion dev/implementations/storage_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
* e.g. usage of the dbstat table.
*/
#pragma once

#include <type_traits> // std::is_same
#include <sstream>
#include <sstream> // std::stringstream
#include <iomanip> // std::flush
#include <functional> // std::reference_wrapper, std::cref
#include <algorithm> // std::find_if, std::ranges::find

#include "../type_traits.h"
#include "../sqlite_schema_table.h"
#include "../eponymous_vtabs/dbstat.h"
#include "../type_traits.h"
Expand Down
2 changes: 1 addition & 1 deletion dev/implementations/table_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* this file is also used to provide definitions of interface methods 'hitting the database'.
*/
#pragma once

#include <type_traits> // std::decay_t
#include <utility> // std::move
#include <algorithm> // std::find_if, std::ranges::find

#include "../functional/cxx_universal.h" // ::size_t
#include "../type_printer.h"
#include "../schema/column.h"
#include "../schema/table.h"
Expand Down
2 changes: 0 additions & 2 deletions dev/indexed_column.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <string> // std::string
#include <utility> // std::move

#include "functional/cxx_universal.h"
#include "ast/where.h"

namespace sqlite_orm {
Expand Down Expand Up @@ -66,5 +65,4 @@ namespace sqlite_orm {
internal::indexed_column_t<C> indexed_column(C column_or_expression) {
return {std::move(column_or_expression)};
}

}
1 change: 1 addition & 0 deletions dev/is_std_ptr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include <type_traits>
#include <memory>

Expand Down
1 change: 0 additions & 1 deletion dev/mapped_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <system_error> // std::system_error
#include <functional> // std::bind

#include "functional/cxx_universal.h" // ::ptrdiff_t
#include "statement_finalizer.h"
#include "error_code.h"
#include "object_from_column_builder.h"
Expand Down
1 change: 0 additions & 1 deletion dev/member_traits/member_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <type_traits> // std::enable_if, std::is_function, std::true_type, std::false_type

#include "../functional/cxx_universal.h"
#include "../functional/cxx_type_traits_polyfill.h"

namespace sqlite_orm {
Expand Down
1 change: 0 additions & 1 deletion dev/operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,4 @@ namespace sqlite_orm {
internal::assign_t<L, R> assign(L l, R r) {
return {std::move(l), std::move(r)};
}

}
16 changes: 9 additions & 7 deletions dev/pragma.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#pragma once

#include <sqlite3.h>
#include <cstdlib> // atoi
#include <string> // std::string
#include <functional> // std::function
#include <memory> // std::shared_ptr
#include <vector> // std::vector
#include <sstream>
#include <iomanip> // std::flush

#include "error_code.h"
#include "row_extractor.h"
Expand Down Expand Up @@ -148,14 +150,14 @@ namespace sqlite_orm {
auto& res = *(std::vector<sqlite_orm::table_xinfo>*)data;
if(argc) {
auto index = 0;
auto cid = std::atoi(argv[index++]);
auto cid = atoi(argv[index++]);
std::string name = argv[index++];
std::string type = argv[index++];
bool notnull = !!std::atoi(argv[index++]);
bool notnull = !!atoi(argv[index++]);
std::string dflt_value = argv[index] ? argv[index] : "";
++index;
auto pk = std::atoi(argv[index++]);
auto hidden = std::atoi(argv[index++]);
auto pk = atoi(argv[index++]);
auto hidden = atoi(argv[index++]);
res.emplace_back(cid,
std::move(name),
std::move(type),
Expand Down Expand Up @@ -185,13 +187,13 @@ namespace sqlite_orm {
auto& res = *(std::vector<sqlite_orm::table_info>*)data;
if(argc) {
auto index = 0;
auto cid = std::atoi(argv[index++]);
auto cid = atoi(argv[index++]);
std::string name = argv[index++];
std::string type = argv[index++];
bool notnull = !!std::atoi(argv[index++]);
bool notnull = !!atoi(argv[index++]);
std::string dflt_value = argv[index] ? argv[index] : "";
++index;
auto pk = std::atoi(argv[index++]);
auto pk = atoi(argv[index++]);
res.emplace_back(cid, std::move(name), std::move(type), notnull, std::move(dflt_value), pk);
}
return 0;
Expand Down
1 change: 0 additions & 1 deletion dev/prepared_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <utility> // std::move, std::forward, std::pair
#include <tuple> // std::tuple

#include "functional/cxx_universal.h"
#include "functional/cxx_type_traits_polyfill.h"
#include "functional/cxx_functional_polyfill.h"
#include "tuple_helper/tuple_traits.h"
Expand Down
1 change: 0 additions & 1 deletion dev/result_set_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <iterator> // std::input_iterator_tag, std::default_sentinel_t
#include <functional> // std::reference_wrapper

#include "functional/cxx_universal.h" // ::ptrdiff_t
#include "statement_finalizer.h"
#include "row_extractor.h"
#include "column_result_proxy.h"
Expand Down
7 changes: 3 additions & 4 deletions dev/row_extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

#include <sqlite3.h>
#include <type_traits> // std::enable_if_t, std::is_arithmetic, std::is_same, std::enable_if
#include <stdlib.h> // atof, atoi, atoll
#include <cstdlib> // atof, atoi, atoll
#include <cstring> // strlen
#include <system_error> // std::system_error
#include <string> // std::string, std::wstring
#ifndef SQLITE_ORM_OMITS_CODECVT
#include <locale> // std::wstring_convert
#include <codecvt> // std::codecvt_utf8_utf16
#endif
#include <vector> // std::vector
#include <cstring> // strlen
#include <algorithm> // std::copy
#include <iterator> // std::back_inserter
#include <tuple> // std::tuple, std::tuple_size, std::tuple_element
#ifdef SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED
#include <concepts>
#endif

#include "functional/cxx_universal.h"
#include "functional/cxx_functional_polyfill.h"
#include "functional/static_magic.h"
#include "tuple_helper/tuple_transformer.h"
Expand Down Expand Up @@ -389,7 +388,7 @@ namespace sqlite_orm {
template<>
struct row_extractor<std::vector<char>, void> {
std::vector<char> extract(const char* columnText) const {
return {columnText, columnText + (columnText ? ::strlen(columnText) : 0)};
return {columnText, columnText + (columnText ? strlen(columnText) : 0)};
}

std::vector<char> extract(sqlite3_stmt* stmt, int columnIndex) const {
Expand Down
Loading

0 comments on commit 8c15e4b

Please sign in to comment.