mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
Remove ResourceHandle.hpp
This commit is contained in:
parent
9b45a31834
commit
462479b992
@ -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"
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <data/ResourceHandle.hpp>
|
||||
#include <gl/DrawBuffer.hpp>
|
||||
#include <gl/GeometryBuffer.hpp>
|
||||
#include <gl/TextureData.hpp>
|
||||
@ -180,6 +179,4 @@ private:
|
||||
float boundingRadius;
|
||||
};
|
||||
|
||||
typedef ResourceHandle<Model>::Ref ModelRef;
|
||||
|
||||
#endif
|
||||
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
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 T>
|
||||
class ResourceHandle {
|
||||
public:
|
||||
T* resource;
|
||||
RW::ResourceState state;
|
||||
std::string name;
|
||||
|
||||
typedef std::shared_ptr<ResourceHandle<T>> Ref;
|
||||
|
||||
ResourceHandle(const std::string& name)
|
||||
: resource(nullptr), state(RW::Loading), name(name) {
|
||||
}
|
||||
};
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include <loaders/RWBinaryStream.hpp>
|
||||
|
||||
#include <data/ResourceHandle.hpp>
|
||||
#include <platform/FileHandle.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -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"
|
||||
|
@ -1,23 +0,0 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <data/ResourceHandle.hpp>
|
||||
#include <test_globals.hpp>
|
||||
|
||||
typedef ResourceHandle<int>::Ref IntRef;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(ResourceTests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_ResourceHandle) {
|
||||
int resource = 42;
|
||||
IntRef ref{new ResourceHandle<int>("")};
|
||||
|
||||
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()
|
Loading…
Reference in New Issue
Block a user