Rebel Fork Framework
Resource.h File Reference
#include "Urho3D/Core/Object.h"
#include "Urho3D/Core/Timer.h"
#include "Urho3D/IO/Archive.h"
#include "Urho3D/IO/ArchiveSerialization.h"
#include "Urho3D/IO/FileIdentifier.h"
#include "Urho3D/Resource/JSONValue.h"
#include <EASTL/array.h>
#include <EASTL/optional.h>

Classes

class  Urho3D::Resource
 
class  Urho3D::SimpleResource
 Base class for simple resource that uses Archive serialization. More...
 
class  Urho3D::ResourceWithMetadata
 Base class for resources that support arbitrary metadata stored. Metadata serialization shall be implemented in derived classes. More...
 

Typedefs

using Urho3D::BinaryMagic = ea::array< unsigned char, BinaryMagicSize >
 

Enumerations

enum  Urho3D::InternalResourceFormat { Urho3D::InternalResourceFormat::Unknown, Urho3D::InternalResourceFormat::Json, Urho3D::InternalResourceFormat::Xml, Urho3D::InternalResourceFormat::Binary }
 Internal file format of Resource.
 
enum  Urho3D::AsyncLoadState {
  Urho3D::ASYNC_DONE = 0, Urho3D::ASYNC_QUEUED = 1, Urho3D::ASYNC_LOADING = 2, Urho3D::ASYNC_SUCCESS = 3,
  Urho3D::ASYNC_FAIL = 4
}
 Asynchronous loading state of a resource. More...
 

Functions

InternalResourceFormat Urho3D::PeekResourceFormat (Deserializer &source, BinaryMagic binaryMagic)
 
template<class T , std::enable_if_t< std::is_base_of_v< Resource, T >, int > = 0>
void Urho3D::SerializeResource (Archive &archive, const char *name, SharedPtr< T > &value, ResourceRef &resourceRef)
 Serialize reference to a resource.
 
const ea::string & Urho3D::GetResourceName (Resource *resource)
 
StringHash Urho3D::GetResourceType (Resource *resource, StringHash defaultType)
 
ResourceRef Urho3D::GetResourceRef (Resource *resource, StringHash defaultType)
 
template<class T >
ea::vector< ea::string > Urho3D::GetResourceNames (const ea::vector< SharedPtr< T > > &resources)
 
template<class T >
ResourceRefList Urho3D::GetResourceRefList (const ea::vector< SharedPtr< T > > &resources)
 

Variables

static constexpr unsigned Urho3D::BinaryMagicSize = 4
 Size of the magic number for binary resources.
 

Enumeration Type Documentation

◆ AsyncLoadState

Asynchronous loading state of a resource.

Enumerator
ASYNC_DONE 

No async operation in progress.

ASYNC_QUEUED 

Queued for asynchronous loading.

ASYNC_LOADING 

In progress of calling BeginLoad() in a worker thread.

ASYNC_SUCCESS 

BeginLoad() succeeded. EndLoad() can be called in the main thread.

ASYNC_FAIL 

BeginLoad() failed.

Function Documentation

◆ PeekResourceFormat()

URHO3D_API InternalResourceFormat Urho3D::PeekResourceFormat ( Deserializer source,
BinaryMagic  binaryMagic = DefaultBinaryMagic 
)

Peek into resource file and determine its internal format. It's optimized for the case when the file is either Binary, JSON or XML. Deserializer is left in the same state as it was before the call.