Skip to content

Commit 07f513a

Browse files
committed
clang format + vendor/unvendor with "make install"
1 parent b8a6435 commit 07f513a

File tree

6 files changed

+38
-20
lines changed

6 files changed

+38
-20
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ register:
1010

1111
install:
1212
@Rscript -e 'devtools::install("./")'
13+
@Rscript -e 'cpp4r::unvendor("./extended-tests/cpp4r4rtest/src/vendor");
14+
cpp4r::vendor("./extended-tests/cpp4r4rtest/src/vendor")'
1315

1416
docs:
1517
@Rscript -e 'devtools::document("./"); pkgsite::build_site("./")'

extended-tests/cpp4rtest/src/matrix.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@
122122

123123
// Test function specifically for integer matrix coercion
124124
// This takes doubles_matrix<> but should accept integer matrices via implicit coercion
125-
[[cpp4r::register]] cpp4r::doubles_matrix<>
126-
matrix_add_coerce_test(const cpp4r::doubles_matrix<>& x,
127-
const cpp4r::doubles_matrix<>& y) {
125+
[[cpp4r::register]] cpp4r::doubles_matrix<> matrix_add_coerce_test(
126+
const cpp4r::doubles_matrix<>& x, const cpp4r::doubles_matrix<>& y) {
128127
int nrow = x.nrow();
129128
int ncol = x.ncol();
130129

@@ -140,9 +139,8 @@ matrix_add_coerce_test(const cpp4r::doubles_matrix<>& x,
140139
}
141140

142141
// Test function for integer + double mixed coercion
143-
[[cpp4r::register]] cpp4r::doubles_matrix<>
144-
matrix_mixed_add(const cpp4r::doubles_matrix<>& int_mat,
145-
const cpp4r::doubles_matrix<>& dbl_mat) {
142+
[[cpp4r::register]] cpp4r::doubles_matrix<> matrix_mixed_add(
143+
const cpp4r::doubles_matrix<>& int_mat, const cpp4r::doubles_matrix<>& dbl_mat) {
146144
int nrow = int_mat.nrow();
147145
int ncol = int_mat.ncol();
148146

extended-tests/cpp4rtest/src/vendor/cpp4r/matrix.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class matrix : public matrix_slices<S> {
161161
using iterator_category = std::forward_iterator_tag;
162162

163163
iterator(const slice& s, R_xlen_t pos) : slice_(s), pos_(pos) {}
164-
iterator& operator++() { ++pos_; return *this; }
164+
iterator& operator++() {
165+
++pos_;
166+
return *this;
167+
}
165168
bool operator==(const iterator& rhs) const {
166169
return pos_ == rhs.pos_ && slice_ == rhs.slice_;
167170
}
@@ -185,7 +188,10 @@ class matrix : public matrix_slices<S> {
185188
using iterator_category = std::forward_iterator_tag;
186189

187190
slice_iterator(const matrix& parent, R_xlen_t pos) : parent_(parent), pos_(pos) {}
188-
slice_iterator& operator++() { ++pos_; return *this; }
191+
slice_iterator& operator++() {
192+
++pos_;
193+
return *this;
194+
}
189195
bool operator==(const slice_iterator& rhs) const {
190196
return pos_ == rhs.pos_ && parent_.data() == rhs.parent_.data();
191197
}
@@ -194,8 +200,7 @@ class matrix : public matrix_slices<S> {
194200
};
195201

196202
matrix(SEXP data)
197-
: matrix_slices<S>(data),
198-
vector_(detail::coerce_matrix_sexp<scalar_type>(data)) {}
203+
: matrix_slices<S>(data), vector_(detail::coerce_matrix_sexp<scalar_type>(data)) {}
199204

200205
template <typename V2, typename T2, typename S2>
201206
matrix(const cpp4r::matrix<V2, T2, S2>& rhs)
@@ -284,9 +289,11 @@ using integers_matrix = matrix<r_vector<int>, typename r_vector<int>::reference,
284289
template <typename S = by_column>
285290
using logicals_matrix = matrix<r_vector<r_bool>, typename r_vector<r_bool>::reference, S>;
286291
template <typename S = by_column>
287-
using strings_matrix = matrix<r_vector<r_string>, typename r_vector<r_string>::reference, S>;
292+
using strings_matrix =
293+
matrix<r_vector<r_string>, typename r_vector<r_string>::reference, S>;
288294
template <typename S = by_column>
289-
using complexes_matrix = matrix<r_vector<r_complex>, typename r_vector<r_complex>::reference, S>;
295+
using complexes_matrix =
296+
matrix<r_vector<r_complex>, typename r_vector<r_complex>::reference, S>;
290297
} // namespace writable
291298

292299
} // namespace cpp4r

extended-tests/cpp4rtest/src/vendor/cpp4r/r_string.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class r_string {
3535
return data_.data() == rhs.data_.data();
3636
}
3737
bool operator==(const SEXP rhs) const noexcept { return data_.data() == rhs; }
38-
bool operator==(const char* rhs) const { return static_cast<std::string>(*this) == rhs; }
38+
bool operator==(const char* rhs) const {
39+
return static_cast<std::string>(*this) == rhs;
40+
}
3941
bool operator==(const std::string& rhs) const {
4042
return static_cast<std::string>(*this) == rhs;
4143
}

inst/include/cpp4r/matrix.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class matrix : public matrix_slices<S> {
161161
using iterator_category = std::forward_iterator_tag;
162162

163163
iterator(const slice& s, R_xlen_t pos) : slice_(s), pos_(pos) {}
164-
iterator& operator++() { ++pos_; return *this; }
164+
iterator& operator++() {
165+
++pos_;
166+
return *this;
167+
}
165168
bool operator==(const iterator& rhs) const {
166169
return pos_ == rhs.pos_ && slice_ == rhs.slice_;
167170
}
@@ -185,7 +188,10 @@ class matrix : public matrix_slices<S> {
185188
using iterator_category = std::forward_iterator_tag;
186189

187190
slice_iterator(const matrix& parent, R_xlen_t pos) : parent_(parent), pos_(pos) {}
188-
slice_iterator& operator++() { ++pos_; return *this; }
191+
slice_iterator& operator++() {
192+
++pos_;
193+
return *this;
194+
}
189195
bool operator==(const slice_iterator& rhs) const {
190196
return pos_ == rhs.pos_ && parent_.data() == rhs.parent_.data();
191197
}
@@ -194,8 +200,7 @@ class matrix : public matrix_slices<S> {
194200
};
195201

196202
matrix(SEXP data)
197-
: matrix_slices<S>(data),
198-
vector_(detail::coerce_matrix_sexp<scalar_type>(data)) {}
203+
: matrix_slices<S>(data), vector_(detail::coerce_matrix_sexp<scalar_type>(data)) {}
199204

200205
template <typename V2, typename T2, typename S2>
201206
matrix(const cpp4r::matrix<V2, T2, S2>& rhs)
@@ -284,9 +289,11 @@ using integers_matrix = matrix<r_vector<int>, typename r_vector<int>::reference,
284289
template <typename S = by_column>
285290
using logicals_matrix = matrix<r_vector<r_bool>, typename r_vector<r_bool>::reference, S>;
286291
template <typename S = by_column>
287-
using strings_matrix = matrix<r_vector<r_string>, typename r_vector<r_string>::reference, S>;
292+
using strings_matrix =
293+
matrix<r_vector<r_string>, typename r_vector<r_string>::reference, S>;
288294
template <typename S = by_column>
289-
using complexes_matrix = matrix<r_vector<r_complex>, typename r_vector<r_complex>::reference, S>;
295+
using complexes_matrix =
296+
matrix<r_vector<r_complex>, typename r_vector<r_complex>::reference, S>;
290297
} // namespace writable
291298

292299
} // namespace cpp4r

inst/include/cpp4r/r_string.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class r_string {
3535
return data_.data() == rhs.data_.data();
3636
}
3737
bool operator==(const SEXP rhs) const noexcept { return data_.data() == rhs; }
38-
bool operator==(const char* rhs) const { return static_cast<std::string>(*this) == rhs; }
38+
bool operator==(const char* rhs) const {
39+
return static_cast<std::string>(*this) == rhs;
40+
}
3941
bool operator==(const std::string& rhs) const {
4042
return static_cast<std::string>(*this) == rhs;
4143
}

0 commit comments

Comments
 (0)