From 9bd487e3bda9463ea9ad75bb9eba54eb44b4036f Mon Sep 17 00:00:00 2001 From: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com> Date: Tue, 15 Feb 2022 10:11:41 -0800 Subject: [PATCH] Minor fixes to the configurable stack based on provided feedback. Signed-off-by: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com> --- .../AzCore/Settings/ConfigurableStack.h | 4 +-- .../AzCore/Settings/ConfigurableStack.inl | 12 -------- .../Tests/Settings/ConfigurableStackTests.cpp | 30 +++++++++---------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.h b/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.h index bafb6f47a3..afb0eca6e0 100644 --- a/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.h +++ b/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.h @@ -110,9 +110,7 @@ namespace AZ Iterator end(); ConstIterator begin() const; ConstIterator end() const; - ConstIterator cbegin() const; - ConstIterator cend() const; - + size_t size() const; protected: diff --git a/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.inl b/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.inl index ba34ac1d03..7cfba21497 100644 --- a/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.inl +++ b/Code/Framework/AzCore/AzCore/Settings/ConfigurableStack.inl @@ -44,18 +44,6 @@ namespace AZ return m_nodes.end(); } - template - auto ConfigurableStack::cbegin() const -> ConstIterator - { - return m_nodes.cbegin(); - } - - template - auto ConfigurableStack::cend() const -> ConstIterator - { - return m_nodes.cend(); - } - template size_t ConfigurableStack::size() const { diff --git a/Code/Framework/AzCore/Tests/Settings/ConfigurableStackTests.cpp b/Code/Framework/AzCore/Tests/Settings/ConfigurableStackTests.cpp index df535976bf..0a69ac0053 100644 --- a/Code/Framework/AzCore/Tests/Settings/ConfigurableStackTests.cpp +++ b/Code/Framework/AzCore/Tests/Settings/ConfigurableStackTests.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace UnitTest @@ -32,7 +33,7 @@ namespace UnitTest } }; - struct ConfigurableStackTests : public AllocatorsFixture + struct ConfigurableStackTests : public ScopedAllocatorSetupFixture { void Reflect(AZ::ReflectContext* context) { @@ -50,32 +51,29 @@ namespace UnitTest void SetUp() override { - AllocatorsFixture::SetUp(); + ScopedAllocatorSetupFixture::SetUp(); - m_serializeContext = aznew AZ::SerializeContext(); - m_jsonRegistrationContext = aznew AZ::JsonRegistrationContext(); + m_serializeContext = AZStd::make_unique(); + m_jsonRegistrationContext = AZStd::make_unique(); - Reflect(m_serializeContext); - Reflect(m_jsonRegistrationContext); + Reflect(m_serializeContext.get()); + Reflect(m_jsonRegistrationContext.get()); - m_deserializationSettings.m_registrationContext = m_jsonRegistrationContext; - m_deserializationSettings.m_serializeContext = m_serializeContext; + m_deserializationSettings.m_registrationContext = m_jsonRegistrationContext.get(); + m_deserializationSettings.m_serializeContext = m_serializeContext.get(); } void TearDown() { m_jsonRegistrationContext->EnableRemoveReflection(); - Reflect(m_jsonRegistrationContext); + Reflect(m_jsonRegistrationContext.get()); m_jsonRegistrationContext->DisableRemoveReflection(); m_serializeContext->EnableRemoveReflection(); - Reflect(m_serializeContext); + Reflect(m_serializeContext.get()); m_serializeContext->DisableRemoveReflection(); - delete m_jsonRegistrationContext; - delete m_serializeContext; - - AllocatorsFixture::TearDown(); + ScopedAllocatorSetupFixture::TearDown(); } void ObjectTest(AZStd::string_view jsonText) @@ -100,8 +98,8 @@ namespace UnitTest } } - AZ::SerializeContext* m_serializeContext; - AZ::JsonRegistrationContext* m_jsonRegistrationContext; + AZStd::unique_ptr m_serializeContext; + AZStd::unique_ptr m_jsonRegistrationContext; AZ::JsonDeserializerSettings m_deserializationSettings; };