From 462479b992528c3fa5fa5a3da5876e6f79c59044 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Sun, 11 Sep 2016 22:28:49 +0100 Subject: [PATCH] Remove ResourceHandle.hpp --- rwlib/CMakeLists.txt | 1 - rwlib/source/data/Model.hpp | 3 --- rwlib/source/data/ResourceHandle.hpp | 32 ---------------------------- rwlib/source/loaders/LoaderDFF.hpp | 1 - tests/CMakeLists.txt | 1 - tests/test_Resource.cpp | 23 -------------------- 6 files changed, 61 deletions(-) delete mode 100644 rwlib/source/data/ResourceHandle.hpp delete mode 100644 tests/test_Resource.cpp diff --git a/rwlib/CMakeLists.txt b/rwlib/CMakeLists.txt index 17ca7f78..e358cc52 100644 --- a/rwlib/CMakeLists.txt +++ b/rwlib/CMakeLists.txt @@ -23,7 +23,6 @@ SET(RWLIB_SOURCES "source/platform/FileIndex.hpp" "source/platform/FileIndex.cpp" - "source/data/ResourceHandle.hpp" "source/data/Model.hpp" "source/data/Model.cpp" diff --git a/rwlib/source/data/Model.hpp b/rwlib/source/data/Model.hpp index fd201bde..d2043a9d 100644 --- a/rwlib/source/data/Model.hpp +++ b/rwlib/source/data/Model.hpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -180,6 +179,4 @@ private: float boundingRadius; }; -typedef ResourceHandle::Ref ModelRef; - #endif diff --git a/rwlib/source/data/ResourceHandle.hpp b/rwlib/source/data/ResourceHandle.hpp deleted file mode 100644 index 3ce040d1..00000000 --- a/rwlib/source/data/ResourceHandle.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include - -namespace RW { -/** - * Possible states for ResourceHandle - */ -enum ResourceState { - /// Resource has been declared but not loaded - Loading = 0, - /// Resource has been loaded and is available - Loaded = 1, - /// Loading the resource failed - Failed = 2 -}; -} - -template -class ResourceHandle { -public: - T* resource; - RW::ResourceState state; - std::string name; - - typedef std::shared_ptr> Ref; - - ResourceHandle(const std::string& name) - : resource(nullptr), state(RW::Loading), name(name) { - } -}; diff --git a/rwlib/source/loaders/LoaderDFF.hpp b/rwlib/source/loaders/LoaderDFF.hpp index c858ffa9..07fe017b 100644 --- a/rwlib/source/loaders/LoaderDFF.hpp +++ b/rwlib/source/loaders/LoaderDFF.hpp @@ -4,7 +4,6 @@ #include -#include #include #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 12c946e9..cb0dc2b4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,7 +33,6 @@ set(TEST_SOURCES "test_object_data.cpp" "test_pickup.cpp" "test_renderer.cpp" - "test_Resource.cpp" "test_rwbstream.cpp" "test_SaveGame.cpp" "test_scriptmachine.cpp" diff --git a/tests/test_Resource.cpp b/tests/test_Resource.cpp deleted file mode 100644 index d0e381a6..00000000 --- a/tests/test_Resource.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -typedef ResourceHandle::Ref IntRef; - -BOOST_AUTO_TEST_SUITE(ResourceTests) - -BOOST_AUTO_TEST_CASE(test_ResourceHandle) { - int resource = 42; - IntRef ref{new ResourceHandle("")}; - - BOOST_CHECK_EQUAL(ref->resource, nullptr); - BOOST_CHECK_EQUAL(ref->state, RW::Loading); - - ref->state = RW::Loaded; - ref->resource = &resource; - - BOOST_CHECK_EQUAL(ref->resource, &resource); - BOOST_CHECK_EQUAL(ref->state, RW::Loaded); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file