Skip to content

Commit

Permalink
apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
auto code formatter authored and RiscadoA committed Sep 27, 2023
1 parent cf27f8d commit 6140905
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/include/cubos/core/reflection/traits/fields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace cubos::core::reflection

/// @brief Move constructs.
/// @param other Other trait.
FieldsTrait(FieldsTrait&& other) noexcept ;
FieldsTrait(FieldsTrait&& other) noexcept;

/// @brief Adds a field to the type. The getter will be deleted using `delete` and thus
/// must be allocated using `new`.
Expand Down
14 changes: 7 additions & 7 deletions core/src/cubos/core/reflection/traits/fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ FieldsTrait::FieldsTrait()
{
}

FieldsTrait::FieldsTrait(FieldsTrait&& other)
noexcept : mFirstField(other.mFirstField)
FieldsTrait::FieldsTrait(FieldsTrait&& other) noexcept
: mFirstField(other.mFirstField)
, mLastField(other.mLastField)
{
other.mFirstField = nullptr;
Expand All @@ -89,20 +89,20 @@ FieldsTrait::~FieldsTrait()
{
while (mFirstField != nullptr)
{
auto *next = mFirstField->mNext;
auto* next = mFirstField->mNext;
delete mFirstField;
mFirstField = next;
}
}

FieldsTrait&& FieldsTrait::withField(const Type& type, std::string name, AddressOf* addressOf) &&
{
for (auto *field = mFirstField; field != nullptr; field = field->mNext)
for (auto* field = mFirstField; field != nullptr; field = field->mNext)
{
CUBOS_ASSERT(field->mName != name, "Field '{}' already exists", name);
}

auto *field = new Field(type, std::move(name), addressOf);
auto* field = new Field(type, std::move(name), addressOf);
if (mFirstField != nullptr)
{
mLastField->mNext = field;
Expand All @@ -119,7 +119,7 @@ FieldsTrait&& FieldsTrait::withField(const Type& type, std::string name, Address

const FieldsTrait::Field* FieldsTrait::field(const std::string& name) const
{
for (auto *field = mFirstField; field != nullptr; field = field->mNext)
for (auto* field = mFirstField; field != nullptr; field = field->mNext)
{
if (field->mName == name)
{
Expand All @@ -136,7 +136,7 @@ FieldsTrait::Iterator FieldsTrait::begin() const
return Iterator{mFirstField};
}

FieldsTrait::Iterator FieldsTrait::end()
FieldsTrait::Iterator FieldsTrait::end()
{
return Iterator{nullptr};
}
6 changes: 3 additions & 3 deletions core/tests/reflection/traits/fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST_CASE("reflection::FieldsTrait")
{
auto fields = FieldsTrait().withField("foo", &ObjectType::foo);

const auto *field = fields.field("foo");
const auto* field = fields.field("foo");
REQUIRE(field != nullptr);
CHECK(field == &*fields.begin());
CHECK(++fields.begin() == fields.end());
Expand All @@ -49,11 +49,11 @@ TEST_CASE("reflection::FieldsTrait")
{
auto fields = FieldsTrait().withField("foo", &ObjectType::foo).withField("bar", &ObjectType::bar);

const auto *fooField = fields.field("foo");
const auto* fooField = fields.field("foo");
REQUIRE(fooField != nullptr);
CHECK(fooField == &*fields.begin());

const auto *barField = fields.field("bar");
const auto* barField = fields.field("bar");
REQUIRE(barField != nullptr);
CHECK(barField == &*(++fields.begin()));
CHECK(++(++fields.begin()) == fields.end());
Expand Down

0 comments on commit 6140905

Please sign in to comment.