From f070c275b074f89a3bba0b43ccecc99c3c0de3e2 Mon Sep 17 00:00:00 2001 From: Aaron Shelley Date: Sun, 16 Jun 2024 22:50:04 -0400 Subject: [PATCH] Clean up API naming for non get/set pairs. --- include/aspire/core/Object.h | 4 ++-- src/core/Object.cpp | 4 ++-- src/core/test/Object.test.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/aspire/core/Object.h b/include/aspire/core/Object.h index 92f4807..e10d32e 100644 --- a/include/aspire/core/Object.h +++ b/include/aspire/core/Object.h @@ -42,7 +42,7 @@ namespace aspire::core /// @brief Get the owning parent of this object. /// @return The pointer to the owning parent. Nullptr if this object does not have a parent. - [[nodiscard]] auto getParent() const -> Object*; + [[nodiscard]] auto parent() const -> Object*; /// @brief Add the given object to this object as a child. Claiming ownership of the child object. /// @param x The object to be added to this object. @@ -66,7 +66,7 @@ namespace aspire::core /// @brief Get the, read-only, list of child objects. /// @return The list of children owned by this object. - [[nodiscard]] auto getChildren() const -> const std::vector>&; + [[nodiscard]] auto children() const -> const std::vector>&; /// @brief Override to handle any event this object has received. /// @param x The event to be handled. diff --git a/src/core/Object.cpp b/src/core/Object.cpp index 7967e1c..3496b1c 100644 --- a/src/core/Object.cpp +++ b/src/core/Object.cpp @@ -31,7 +31,7 @@ auto Object::getName() const -> std::string_view return this->pimpl->name; } -auto Object::getParent() const -> Object* +auto Object::parent() const -> Object* { return this->pimpl->parent; } @@ -79,7 +79,7 @@ auto Object::remove() -> std::unique_ptr return node; } -auto Object::getChildren() const -> const std::vector>& +auto Object::children() const -> const std::vector>& { return this->pimpl->children; } diff --git a/src/core/test/Object.test.cpp b/src/core/test/Object.test.cpp index f5087ed..0fa6d76 100644 --- a/src/core/test/Object.test.cpp +++ b/src/core/test/Object.test.cpp @@ -20,11 +20,11 @@ TEST(Object, remove) auto child = std::make_unique(); auto* childObject = child.get(); parent.addChild(std::move(child)); - EXPECT_EQ(childObject->getParent(), &parent); - EXPECT_FALSE(parent.getChildren().empty()); + EXPECT_EQ(childObject->parent(), &parent); + EXPECT_FALSE(parent.children().empty()); child = childObject->remove(); ASSERT_NE(child, nullptr); - EXPECT_EQ(child->getParent(), nullptr); - EXPECT_TRUE(parent.getChildren().empty()); + EXPECT_EQ(child->parent(), nullptr); + EXPECT_TRUE(parent.children().empty()); }