From dbf6fbc1db3b21f5c21ee0e5caf99fe27fc615e1 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 25 Sep 2021 17:59:06 +0200 Subject: [PATCH] Adds documentation, style fixes. --- src/Collections/List.hpp | 5 +++++ src/Memory/__BorrowedPtr.hpp | 2 +- src/Memory/__OptionalUniquePtrList.hpp | 5 +++++ src/Memory/__UniquePtrList.hpp | 5 +++++ tests/MemoryTests.cpp | 5 +---- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Collections/List.hpp b/src/Collections/List.hpp index 9796881..9db578a 100644 --- a/src/Collections/List.hpp +++ b/src/Collections/List.hpp @@ -13,6 +13,7 @@ namespace ArbUt { using const_iterator = typename std::vector::const_iterator; public: + /// @brief The type of the value stored in the list. typedef ValueT type; List() noexcept : _vector() {} @@ -154,7 +155,11 @@ namespace ArbUt { /// @return A std::vector representation of the current list. std::vector& GetStdList() noexcept { return _vector; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline const List* GetListPointer() const { return this; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline List* GetListPointer() { return this; } }; } diff --git a/src/Memory/__BorrowedPtr.hpp b/src/Memory/__BorrowedPtr.hpp index 8881526..cd397ca 100644 --- a/src/Memory/__BorrowedPtr.hpp +++ b/src/Memory/__BorrowedPtr.hpp @@ -1,8 +1,8 @@ #ifndef ARBUTILS___BORROWEDPTR_HPP #define ARBUTILS___BORROWEDPTR_HPP -#include "../Ensure.hpp" #include +#include "../Ensure.hpp" namespace ArbUt { /// @brief A borrowed pointer is used to indicate a pointer that is not owned by its holder. As with all Arbutils diff --git a/src/Memory/__OptionalUniquePtrList.hpp b/src/Memory/__OptionalUniquePtrList.hpp index 9606dda..cac2f3e 100644 --- a/src/Memory/__OptionalUniquePtrList.hpp +++ b/src/Memory/__OptionalUniquePtrList.hpp @@ -13,6 +13,7 @@ namespace ArbUt { using const_iterator = typename std::vector::const_iterator; public: + /// @brief The type of the value stored in the list. typedef ValueT* type; inline OptionalUniquePtrList() noexcept : _vector() {} @@ -145,7 +146,11 @@ namespace ArbUt { /// @return A std::vector representation of the current list. std::vector& GetStdList() noexcept { return _vector; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline const OptionalUniquePtrList* GetListPointer() const { return this; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline OptionalUniquePtrList* GetListPointer() { return this; } }; } diff --git a/src/Memory/__UniquePtrList.hpp b/src/Memory/__UniquePtrList.hpp index c4fec1a..5174ac7 100644 --- a/src/Memory/__UniquePtrList.hpp +++ b/src/Memory/__UniquePtrList.hpp @@ -14,6 +14,7 @@ namespace ArbUt { using const_iterator = typename std::vector::const_iterator; public: + /// @brief The type of the value stored in the list. typedef ValueT* type; inline UniquePtrList() noexcept : _vector() {} @@ -154,7 +155,11 @@ namespace ArbUt { /// @return A std::vector representation of the current list. std::vector& GetStdList() noexcept { return _vector; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline const UniquePtrList* GetListPointer() const { return this; } + /// @brief Returns a raw pointer to the current list. + /// @return A raw pointer to the current list. inline UniquePtrList* GetListPointer() { return this; } }; } diff --git a/tests/MemoryTests.cpp b/tests/MemoryTests.cpp index b578803..24fd234 100644 --- a/tests/MemoryTests.cpp +++ b/tests/MemoryTests.cpp @@ -3,9 +3,6 @@ #include "../src/Memory/Memory.hpp" using namespace ArbUt; -TEST_CASE("Scoped Pointer deletes child after out of scope") { - auto a = ScopedPtr(new uint32_t(100)); -} - +TEST_CASE("Scoped Pointer deletes child after out of scope") { auto a = ScopedPtr(new uint32_t(100)); } #endif \ No newline at end of file