// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_RESOURCEREF_HPP #define NAZARA_RESOURCEREF_HPP #include #include #include template class NzObjectRef { public: NzObjectRef(); NzObjectRef(T* object); NzObjectRef(const NzObjectRef& ref); template NzObjectRef(const NzObjectRef& ref); NzObjectRef(NzObjectRef&& ref) noexcept; ~NzObjectRef(); T* Get() const; bool IsValid() const; T* Release(); bool Reset(T* object = nullptr); NzObjectRef& Swap(NzObjectRef& ref); operator bool() const; operator T*() const; T* operator->() const; NzObjectRef& operator=(T* object); NzObjectRef& operator=(const NzObjectRef& ref); template NzObjectRef& operator=(const NzObjectRef& ref); NzObjectRef& operator=(NzObjectRef&& ref) noexcept; private: T* m_object; }; #include #endif // NAZARA_RESOURCEREF_HPP