Skip to content

Commit

Permalink
Revert "CXX-2258 Change prelude order and rerun clang-format (#797)"
Browse files Browse the repository at this point in the history
This reverts commit 8a9ce93.
  • Loading branch information
kevinAlbs committed Jun 4, 2021
1 parent 8a9ce93 commit 65c36ea
Show file tree
Hide file tree
Showing 146 changed files with 360 additions and 283 deletions.
10 changes: 1 addition & 9 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
BasedOnStyle: Google
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BasedOnStyle: Google
BinPackArguments: false
BinPackParameters: false
ColumnLimit: 100
Cpp11BracedListStyle: true
DerivePointerAlignment: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: 'prelude\.(hpp|hh)' # preludes
Priority: 3
- Regex: '<[[:alnum:]_.]+>' # system headers
Priority: 1
- Regex: '.*' # driver headers
Priority: 2
IndentWidth: 4
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
Expand Down
6 changes: 3 additions & 3 deletions src/bsoncxx/array/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/array/element.hpp>

#include <cstdlib>
#include <cstring>
#include <stdexcept>

#include <bsoncxx/array/element.hpp>

#include <bsoncxx/config/private/prelude.hh>

namespace bsoncxx {
Expand All @@ -32,6 +32,6 @@ element::element(const std::uint8_t* raw,
std::uint32_t keylen)
: document::element(raw, length, offset, keylen) {}

} // namespace array
} // namespace document
BSONCXX_INLINE_NAMESPACE_END
} // namespace bsoncxx
32 changes: 16 additions & 16 deletions src/bsoncxx/array/element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@ class BSONCXX_API element : private document::element {

using document::element::type;

using document::element::get_double;
using document::element::get_utf8;
using document::element::get_document;
using document::element::get_array;
using document::element::get_binary;
using document::element::get_undefined;
using document::element::get_oid;
using document::element::get_bool;
using document::element::get_code;
using document::element::get_codewscope;
using document::element::get_date;
using document::element::get_dbpointer;
using document::element::get_decimal128;
using document::element::get_document;
using document::element::get_double;
using document::element::get_int32;
using document::element::get_int64;
using document::element::get_maxkey;
using document::element::get_minkey;
using document::element::get_null;
using document::element::get_oid;
using document::element::get_regex;
using document::element::get_dbpointer;
using document::element::get_code;
using document::element::get_symbol;
using document::element::get_codewscope;
using document::element::get_int32;
using document::element::get_timestamp;
using document::element::get_undefined;
using document::element::get_utf8;
using document::element::get_int64;
using document::element::get_decimal128;
using document::element::get_minkey;
using document::element::get_maxkey;

using document::element::get_value;

using document::element::operator[];

using document::element::key;
using document::element::keylen;
using document::element::raw;
using document::element::length;
using document::element::offset;
using document::element::raw;
using document::element::keylen;
using document::element::key;

private:
friend class view;
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/array/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/array/value.hpp>

#include <cstdlib>
#include <cstring>

#include <bsoncxx/array/value.hpp>

#include <bsoncxx/config/private/prelude.hh>

namespace bsoncxx {
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/array/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/array/view.hpp>

#include <cstdlib>
#include <cstring>
#include <tuple>

#include <bsoncxx/array/view.hpp>
#include <bsoncxx/private/itoa.hh>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/types.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/builder/basic/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class array : public sub_array {
///
/// Move constructor
///
BSONCXX_INLINE array(array&& arr) noexcept : sub_array(&_core), _core(std::move(arr._core)) {}
BSONCXX_INLINE array(array &&arr) noexcept : sub_array(&_core), _core(std::move(arr._core)) {}

///
/// Move assignment operator
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/builder/basic/document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class document : public sub_document {
///
/// Move constructor
///
BSONCXX_INLINE document(document&& doc) noexcept
: sub_document(&_core), _core(std::move(doc._core)) {}
BSONCXX_INLINE document(document &&doc) noexcept : sub_document(&_core),
_core(std::move(doc._core)) {}

///
/// Move assignment operator
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/builder/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/builder/core.hpp>

#include <cstring>

#include <bsoncxx/builder/core.hpp>
#include <bsoncxx/exception/error_code.hpp>
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/private/itoa.hh>
Expand Down
1 change: 1 addition & 0 deletions src/bsoncxx/decimal128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <bsoncxx/decimal128.hpp>

#include <bsoncxx/exception/error_code.hpp>
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/private/libbson.hh>
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/document/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/document/element.hpp>

#include <cstdlib>
#include <cstring>

#include <bsoncxx/document/element.hpp>
#include <bsoncxx/exception/error_code.hpp>
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/json.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/document/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/document/value.hpp>

#include <cstdlib>
#include <cstring>
#include <utility>

#include <bsoncxx/document/value.hpp>

#include <bsoncxx/config/private/prelude.hh>

namespace bsoncxx {
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/document/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/document/view.hpp>

#include <cstdlib>
#include <cstring>

#include <bsoncxx/document/view.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/types.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/exception/error_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <string>

#include <bsoncxx/exception/error_code.hpp>

#include <string>

#include <bsoncxx/config/private/prelude.hh>

namespace bsoncxx {
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/json.hpp>

#include <iomanip>
#include <iostream>
#include <memory>
Expand All @@ -21,7 +23,6 @@
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/exception/error_code.hpp>
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/private/b64_ntop.hh>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/stdx/make_unique.hpp>
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/oid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/oid.hpp>

#include <cstring>

#include <bsoncxx/exception/error_code.hpp>
#include <bsoncxx/exception/exception.hpp>
#include <bsoncxx/oid.hpp>
#include <bsoncxx/private/libbson.hh>

#include <bsoncxx/config/private/prelude.hh>
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/private/b64_ntop.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@

#pragma once

#include <bsoncxx/config/prelude.hpp>

#include <cstdint>
#include <cstdlib>

#include <bsoncxx/config/prelude.hpp>

namespace bsoncxx {
BSONCXX_INLINE_NAMESPACE_BEGIN
namespace b64 {
Expand Down
12 changes: 6 additions & 6 deletions src/bsoncxx/stdx/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace bsoncxx {
BSONCXX_INLINE_NAMESPACE_BEGIN
namespace stdx {

using ::core::make_optional;
using ::core::nullopt;
using ::core::optional;
using ::core::nullopt;
using ::core::make_optional;

} // namespace stdx
BSONCXX_INLINE_NAMESPACE_END
Expand Down Expand Up @@ -64,9 +64,9 @@ namespace bsoncxx {
BSONCXX_INLINE_NAMESPACE_BEGIN
namespace stdx {

using ::std::experimental::make_optional;
using ::std::experimental::nullopt;
using ::std::experimental::optional;
using ::std::experimental::nullopt;
using ::std::experimental::make_optional;

} // namespace stdx
BSONCXX_INLINE_NAMESPACE_END
Expand All @@ -80,9 +80,9 @@ namespace bsoncxx {
BSONCXX_INLINE_NAMESPACE_BEGIN
namespace stdx {

using ::std::make_optional;
using ::std::nullopt;
using ::std::optional;
using ::std::nullopt;
using ::std::make_optional;

} // namespace stdx
BSONCXX_INLINE_NAMESPACE_END
Expand Down
3 changes: 2 additions & 1 deletion src/bsoncxx/string/view_or_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <bsoncxx/string/to_string.hpp>
#include <bsoncxx/string/view_or_value.hpp>

#include <bsoncxx/string/to_string.hpp>

#include <bsoncxx/config/private/prelude.hh>

namespace bsoncxx {
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/bson_b_date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
namespace {
TEST_CASE("time_point is converted to b_date and back", "[bsoncxx::types::b_date]") {
using bsoncxx::types::b_date;
using std::chrono::milliseconds;
using std::chrono::system_clock;
using std::chrono::time_point_cast;
using std::chrono::milliseconds;

system_clock::time_point now1, now2;

Expand Down
9 changes: 5 additions & 4 deletions src/bsoncxx/test/bson_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@

#include <chrono>

#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/view.hpp>

#include <bsoncxx/builder/basic/array.hpp>
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/types.hpp>
#include <bsoncxx/types/bson_value/view.hpp>

namespace {

using namespace bsoncxx;
using namespace types;
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_document;
using bsoncxx::builder::basic::kvp;

TEST_CASE("type to_string", "[bsoncxx::type::to_string]") {
REQUIRE(to_string(bsoncxx::type::k_bool) == "bool");
Expand Down Expand Up @@ -355,4 +356,4 @@ TEST_CASE("bson_value::view with inequality for non-value and value",
b_int64 int64_val{100};
REQUIRE(int64_val != bson_value::view{b_int64{200}});
}
} // namespace
}
5 changes: 3 additions & 2 deletions src/bsoncxx/test/bson_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/document/view_or_value.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/private/libbson.hh>
#include <bsoncxx/string/view_or_value.hpp>
#include <bsoncxx/test_util/catch.hh>
#include <bsoncxx/types/bson_value/make_value.hpp>
#include <bsoncxx/types/bson_value/value.hpp>
#include <bsoncxx/types/bson_value/view.hpp>

#include <bsoncxx/private/libbson.hh>

namespace {
using namespace bsoncxx;

using bsoncxx::to_json;
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_array;
using bsoncxx::builder::basic::make_document;
using bsoncxx::builder::basic::kvp;

using namespace bsoncxx::types;

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/test/view_or_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace {
using namespace bsoncxx;

using bsoncxx::to_json;
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_document;
using bsoncxx::builder::basic::kvp;

TEST_CASE("document::view_or_value", "[bsoncxx::document::view_or_value]") {
auto empty = make_document();
Expand Down
Loading

0 comments on commit 65c36ea

Please sign in to comment.