Skip to content

Commit 0b2d4d4

Browse files
committed
Updated clang-formatting styles
We decided to insert a space after control statements and after a requires clause.
1 parent a89fdf8 commit 0b2d4d4

File tree

111 files changed

+1103
-1097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1103
-1097
lines changed

.clang-format

+5-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ SpaceBeforeAssignmentOperators: true
104104
SpaceBeforeCpp11BracedList: false
105105
SpaceBeforeCtorInitializerColon: true
106106
SpaceBeforeInheritanceColon: true
107-
SpaceBeforeParens: Never
107+
SpaceBeforeParens: Custom
108+
SpaceBeforeParensOptions:
109+
AfterControlStatements: true
110+
AfterRequiresInClause: true
111+
AfterRequiresInExpression: false
108112
SpaceBeforeRangeBasedForLoopColon: false
109113
SpaceInEmptyParentheses: false
110114
SpacesBeforeTrailingComments: 2

dev/alias.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ namespace sqlite_orm {
172172
template<size_t n, char... C>
173173
SQLITE_ORM_CONSTEVAL auto n_to_colalias() {
174174
constexpr column_alias<'1' + n % 10, C...> colalias{};
175-
if constexpr(n > 10) {
175+
if constexpr (n > 10) {
176176
return n_to_colalias<n / 10, '1' + n % 10, C...>();
177177
} else {
178178
return colalias;
@@ -244,16 +244,16 @@ namespace sqlite_orm {
244244
* select(alias_column<als>(&User::id))
245245
*/
246246
template<orm_table_alias auto als, class C>
247-
requires(!orm_cte_moniker<internal::auto_type_t<als>>)
247+
requires (!orm_cte_moniker<internal::auto_type_t<als>>)
248248
constexpr auto alias_column(C field) {
249249
using namespace ::sqlite_orm::internal;
250250
using A = decltype(als);
251251
using aliased_type = type_t<A>;
252252
static_assert(is_field_of_v<C, aliased_type>, "Column must be from aliased table");
253253

254-
if constexpr(is_column_pointer_v<C>) {
254+
if constexpr (is_column_pointer_v<C>) {
255255
return alias_column_t<A, C>{std::move(field)};
256-
} else if constexpr(std::is_same_v<member_object_type_t<C>, aliased_type>) {
256+
} else if constexpr (std::is_same_v<member_object_type_t<C>, aliased_type>) {
257257
return alias_column_t<A, C>{field};
258258
} else {
259259
// wrap in column_pointer
@@ -275,7 +275,7 @@ namespace sqlite_orm {
275275
* select(als->*&User::id)
276276
*/
277277
template<orm_table_alias A, class F>
278-
requires(!orm_cte_moniker<internal::type_t<A>>)
278+
requires (!orm_cte_moniker<internal::type_t<A>>)
279279
constexpr auto operator->*(const A& /*tableAlias*/, F field) {
280280
return alias_column<A>(std::move(field));
281281
}
@@ -294,7 +294,7 @@ namespace sqlite_orm {
294294
using namespace ::sqlite_orm::internal;
295295
using cte_moniker_t = type_t<A>;
296296

297-
if constexpr(is_column_pointer_v<C>) {
297+
if constexpr (is_column_pointer_v<C>) {
298298
static_assert(std::is_same<table_type_of_t<C>, cte_moniker_t>::value,
299299
"Column pointer must match aliased CTE");
300300
return alias_column_t<A, C>{c};
@@ -312,7 +312,7 @@ namespace sqlite_orm {
312312
* because recordset aliases are derived from `sqlite_orm::alias_tag`
313313
*/
314314
template<orm_table_alias A, class C>
315-
requires(orm_cte_moniker<internal::type_t<A>>)
315+
requires (orm_cte_moniker<internal::type_t<A>>)
316316
constexpr auto operator->*(const A& /*tableAlias*/, C c) {
317317
return alias_column<A>(std::move(c));
318318
}
@@ -321,7 +321,7 @@ namespace sqlite_orm {
321321
* Create a column reference to an aliased CTE column.
322322
*/
323323
template<orm_table_alias auto als, class C>
324-
requires(orm_cte_moniker<internal::auto_type_t<als>>)
324+
requires (orm_cte_moniker<internal::auto_type_t<als>>)
325325
constexpr auto alias_column(C c) {
326326
using A = std::remove_const_t<decltype(als)>;
327327
return alias_column<A>(std::move(c));

dev/arg_values.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace sqlite_orm {
6363

6464
iterator& operator++() {
6565
++this->index;
66-
if(this->index < int(this->container.size())) {
66+
if (this->index < int(this->container.size())) {
6767
this->currentValue = this->container[this->index];
6868
} else {
6969
this->currentValue = {};
@@ -74,7 +74,7 @@ namespace sqlite_orm {
7474
iterator operator++(int) {
7575
auto res = *this;
7676
++this->index;
77-
if(this->index < int(this->container.size())) {
77+
if (this->index < int(this->container.size())) {
7878
this->currentValue = this->container[this->index];
7979
} else {
8080
this->currentValue = {};
@@ -83,7 +83,7 @@ namespace sqlite_orm {
8383
}
8484

8585
arg_value operator*() const {
86-
if(this->index < int(this->container.size()) && this->index >= 0) {
86+
if (this->index < int(this->container.size()) && this->index >= 0) {
8787
return this->currentValue;
8888
} else {
8989
throw std::system_error{orm_error_code::index_is_out_of_bounds};
@@ -121,7 +121,7 @@ namespace sqlite_orm {
121121
}
122122

123123
arg_value operator[](int index) const {
124-
if(index < this->argsCount && index >= 0) {
124+
if (index < this->argsCount && index >= 0) {
125125
sqlite3_value* value = this->values[index];
126126
return {value};
127127
} else {

dev/ast_iterator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ namespace sqlite_orm {
210210

211211
template<class L>
212212
void operator()(const node_type& vec, L& lambda) const {
213-
for(auto& i: vec) {
213+
for (auto& i: vec) {
214214
iterate_ast(i, lambda);
215215
}
216216
}

dev/backup.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace sqlite_orm {
2727
std::unique_ptr<connection_holder> holder_) :
2828
handle(sqlite3_backup_init(to_.get(), zDestName.c_str(), from_.get(), zSourceName.c_str())),
2929
holder(std::move(holder_)), to(to_), from(from_) {
30-
if(!this->handle) {
30+
if (!this->handle) {
3131
throw std::system_error{orm_error_code::failed_to_init_a_backup};
3232
}
3333
}
@@ -37,7 +37,7 @@ namespace sqlite_orm {
3737
from(other.from) {}
3838

3939
~backup_t() {
40-
if(this->handle) {
40+
if (this->handle) {
4141
(void)sqlite3_backup_finish(this->handle);
4242
}
4343
}

dev/carray.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace sqlite_orm {
126126
template<typename P>
127127
struct note_value_fn {
128128
P operator()(P&& value, carray_pointer_arg<P> pv) const {
129-
if(P* observer = pv) {
129+
if (P* observer = pv) {
130130
*observer = value;
131131
}
132132
return std::move(value);

dev/column_names_getter.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ namespace sqlite_orm {
2828
std::vector<std::string>& collect_table_column_names(std::vector<std::string>& collectedExpressions,
2929
bool definedOrder,
3030
const Ctx& context) {
31-
if(definedOrder) {
31+
if (definedOrder) {
3232
auto& table = pick_table<mapped_type_proxy_t<T>>(context.db_objects);
3333
collectedExpressions.reserve(collectedExpressions.size() + table.template count_of<is_column>());
3434
table.for_each_column([qualified = !context.skip_table_name,
3535
&tableName = table.name,
3636
&collectedExpressions](const column_identifier& column) {
37-
if(is_alias<T>::value) {
37+
if (is_alias<T>::value) {
3838
collectedExpressions.push_back(quote_identifier(alias_extractor<T>::extract()) + "." +
3939
quote_identifier(column.name));
40-
} else if(qualified) {
40+
} else if (qualified) {
4141
collectedExpressions.push_back(quote_identifier(tableName) + "." +
4242
quote_identifier(column.name));
4343
} else {
@@ -46,9 +46,9 @@ namespace sqlite_orm {
4646
});
4747
} else {
4848
collectedExpressions.reserve(collectedExpressions.size() + 1);
49-
if(is_alias<T>::value) {
49+
if (is_alias<T>::value) {
5050
collectedExpressions.push_back(quote_identifier(alias_extractor<T>::extract()) + ".*");
51-
} else if(!context.skip_table_name) {
51+
} else if (!context.skip_table_name) {
5252
const basic_table& table = pick_table<mapped_type_proxy_t<T>>(context.db_objects);
5353
collectedExpressions.push_back(quote_identifier(table.name) + ".*");
5454
} else {
@@ -68,7 +68,7 @@ namespace sqlite_orm {
6868
template<class E, class Ctx>
6969
std::vector<std::string>& operator()(const E& t, const Ctx& context) {
7070
auto columnExpression = serialize(t, context);
71-
if(columnExpression.empty()) {
71+
if (columnExpression.empty()) {
7272
throw std::system_error{orm_error_code::column_not_found};
7373
}
7474
this->collectedExpressions.reserve(this->collectedExpressions.size() + 1);
@@ -98,8 +98,8 @@ namespace sqlite_orm {
9898
(*this)(colExpr, context);
9999
});
100100
// note: `capacity() > size()` can occur in case `asterisk_t<>` does spell out the columns in defined order
101-
if(tuple_has_template<typename columns_t<Args...>::columns_type, asterisk_t>::value &&
102-
this->collectedExpressions.capacity() > this->collectedExpressions.size()) {
101+
if (tuple_has_template<typename columns_t<Args...>::columns_type, asterisk_t>::value &&
102+
this->collectedExpressions.capacity() > this->collectedExpressions.size()) {
103103
this->collectedExpressions.shrink_to_fit();
104104
}
105105
return this->collectedExpressions;
@@ -112,8 +112,8 @@ namespace sqlite_orm {
112112
(*this)(colExpr, context);
113113
});
114114
// note: `capacity() > size()` can occur in case `asterisk_t<>` does spell out the columns in defined order
115-
if(tuple_has_template<typename struct_t<T, Args...>::columns_type, asterisk_t>::value &&
116-
this->collectedExpressions.capacity() > this->collectedExpressions.size()) {
115+
if (tuple_has_template<typename struct_t<T, Args...>::columns_type, asterisk_t>::value &&
116+
this->collectedExpressions.capacity() > this->collectedExpressions.size()) {
117117
this->collectedExpressions.shrink_to_fit();
118118
}
119119
return this->collectedExpressions;

dev/column_pointer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace sqlite_orm {
8181
* Make a table reference.
8282
*/
8383
template<class O>
84-
requires(!orm_recordset_alias<O>)
84+
requires (!orm_recordset_alias<O>)
8585
consteval internal::table_reference<O> column() {
8686
return {};
8787
}
@@ -90,7 +90,7 @@ namespace sqlite_orm {
9090
* Make a table reference.
9191
*/
9292
template<class O>
93-
requires(!orm_recordset_alias<O>)
93+
requires (!orm_recordset_alias<O>)
9494
consteval internal::table_reference<O> c() {
9595
return {};
9696
}
@@ -115,10 +115,10 @@ namespace sqlite_orm {
115115

116116
static_assert(is_cte_moniker_v<Moniker>, "`Moniker' must be a CTE moniker");
117117

118-
if constexpr(polyfill::is_specialization_of_v<F, alias_holder>) {
118+
if constexpr (polyfill::is_specialization_of_v<F, alias_holder>) {
119119
static_assert(is_column_alias_v<type_t<F>>);
120120
return column_pointer<Moniker, F>{{}};
121-
} else if constexpr(is_column_alias_v<F>) {
121+
} else if constexpr (is_column_alias_v<F>) {
122122
return column_pointer<Moniker, alias_holder<F>>{{}};
123123
} else {
124124
return column_pointer<Moniker, F>{std::move(field)};

dev/connection_holder.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ namespace sqlite_orm {
1515
connection_holder(std::string filename_) : filename(std::move(filename_)) {}
1616

1717
void retain() {
18-
if(1 == ++this->_retain_count) {
18+
if (1 == ++this->_retain_count) {
1919
auto rc = sqlite3_open(this->filename.c_str(), &this->db);
20-
if(rc != SQLITE_OK) {
20+
if (rc != SQLITE_OK) {
2121
throw_translated_sqlite_error(db);
2222
}
2323
}
2424
}
2525

2626
void release() {
27-
if(0 == --this->_retain_count) {
27+
if (0 == --this->_retain_count) {
2828
auto rc = sqlite3_close(this->db);
29-
if(rc != SQLITE_OK) {
29+
if (rc != SQLITE_OK) {
3030
throw_translated_sqlite_error(db);
3131
}
3232
}
@@ -58,7 +58,7 @@ namespace sqlite_orm {
5858

5959
// rebind connection reference
6060
connection_ref& operator=(const connection_ref& other) {
61-
if(other.holder != this->holder) {
61+
if (other.holder != this->holder) {
6262
this->holder->release();
6363
this->holder = other.holder;
6464
this->holder->retain();

dev/constraints.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ namespace sqlite_orm {
204204
};
205205

206206
inline std::ostream& operator<<(std::ostream& os, foreign_key_action action) {
207-
switch(action) {
207+
switch (action) {
208208
case foreign_key_action::no_action:
209209
os << "NO ACTION";
210210
break;
@@ -230,7 +230,7 @@ namespace sqlite_orm {
230230
const bool update; // true if update and false if delete
231231

232232
operator std::string() const {
233-
if(this->update) {
233+
if (this->update) {
234234
return "ON UPDATE";
235235
} else {
236236
return "ON DELETE";
@@ -254,7 +254,7 @@ namespace sqlite_orm {
254254

255255
foreign_key_type no_action() const {
256256
auto res = this->fk;
257-
if(update) {
257+
if (update) {
258258
res.on_update._action = foreign_key_action::no_action;
259259
} else {
260260
res.on_delete._action = foreign_key_action::no_action;
@@ -264,7 +264,7 @@ namespace sqlite_orm {
264264

265265
foreign_key_type restrict_() const {
266266
auto res = this->fk;
267-
if(update) {
267+
if (update) {
268268
res.on_update._action = foreign_key_action::restrict_;
269269
} else {
270270
res.on_delete._action = foreign_key_action::restrict_;
@@ -274,7 +274,7 @@ namespace sqlite_orm {
274274

275275
foreign_key_type set_null() const {
276276
auto res = this->fk;
277-
if(update) {
277+
if (update) {
278278
res.on_update._action = foreign_key_action::set_null;
279279
} else {
280280
res.on_delete._action = foreign_key_action::set_null;
@@ -284,7 +284,7 @@ namespace sqlite_orm {
284284

285285
foreign_key_type set_default() const {
286286
auto res = this->fk;
287-
if(update) {
287+
if (update) {
288288
res.on_update._action = foreign_key_action::set_default;
289289
} else {
290290
res.on_delete._action = foreign_key_action::set_default;
@@ -294,7 +294,7 @@ namespace sqlite_orm {
294294

295295
foreign_key_type cascade() const {
296296
auto res = this->fk;
297-
if(update) {
297+
if (update) {
298298
res.on_update._action = foreign_key_action::cascade;
299299
} else {
300300
res.on_delete._action = foreign_key_action::cascade;
@@ -395,7 +395,7 @@ namespace sqlite_orm {
395395
}
396396

397397
static std::string string_from_collate_argument(collate_argument argument) {
398-
switch(argument) {
398+
switch (argument) {
399399
case collate_argument::binary:
400400
return "BINARY";
401401
case collate_argument::nocase:

dev/core_functions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ namespace sqlite_orm {
17101710
internal::field_type_or_type_t<Y>>>,
17111711
bool> = true>
17121712
auto nullif(X x, Y y) {
1713-
if constexpr(std::is_void_v<R>) {
1713+
if constexpr (std::is_void_v<R>) {
17141714
using F = internal::built_in_function_t<
17151715
std::optional<std::common_type_t<internal::field_type_or_type_t<X>, internal::field_type_or_type_t<Y>>>,
17161716
internal::nullif_string,

0 commit comments

Comments
 (0)