Definition at line 17 of file SResource.h.
◆ SResource() [1/2]
SResource::SResource |
( |
std::string | classType | ) |
|
|
explicit |
Definition at line 17 of file SResource.cpp.
18 auto resMgr = CORE->GetCore(
ResMgr);
19 resMgr->Register(this);
20 m_name = "Resource " + std::to_string(resMgr->GetSize());
21}
◆ SResource() [2/2]
SResource::SResource |
( |
const SResource * | resource, |
|
|
bool | isRegister ) |
Definition at line 23 of file SResource.cpp.
25 if (isRegister) {
26 CORE->GetCore(
ResMgr)->Register(
this);
27 }
28 m_name = resource->m_name + " (instance)";
29}
◆ Create() [1/4]
Definition at line 63 of file SResource.h.
63 {
64 if (asset == nullptr) return nullptr;
65 {
66 SResource* res = GetResource(asset->hash);
67 if (res != nullptr) return static_cast<T*>(res);
68 }
69 T* object = new T();
70 SResource* res = object;
71
72 res->SetResource(const_cast<AssetMgr::AssetReference*>(asset));
73 return object;
74 }
◆ Create() [2/4]
Definition at line 102 of file SResource.cpp.
102 {
103 if (asset == nullptr) return nullptr;
104 {
105 SResource* res = GetResource(asset->hash);
106 if (res != nullptr) return res;
107 }
110 return res;
111}
◆ Create() [3/4]
template<class T >
static T * CSE::SResource::Create |
( |
const std::string & | name | ) |
|
|
inlinestatic |
Definition at line 48 of file SResource.h.
48 {
49 {
50 SResource* res = GetResource(name);
51 if (res != nullptr) return static_cast<T*>(res);
52 }
53 T* object = new T();
54 SResource* res = object;
55
56 res->SetResource(name);
57 return object;
58 }
◆ Create() [4/4]
SResource * SResource::Create |
( |
const std::string & | name, |
|
|
const std::string & | classType ) |
|
static |
Definition at line 86 of file SResource.cpp.
86 {
87 {
89 if (res != nullptr) return res;
90 }
92 res->SetResource(name);
93 return res;
94}
◆ Get() [1/2]
SResource * SResource::Get |
( |
std::string & | name | ) |
|
|
static |
Definition at line 96 of file SResource.cpp.
96 {
98 if (res != nullptr) return res;
99 return nullptr;
100}
◆ Get() [2/2]
template<class T >
static T * CSE::SResource::Get |
( |
std::string | name | ) |
|
|
inlinestatic |
Definition at line 79 of file SResource.h.
79 {
80 SResource* res = GetResource(std::move(name));
81 if (res != nullptr) return static_cast<T*>(res);
82 return nullptr;
83 }
◆ GetAbsoluteID()
std::string CSE::SResource::GetAbsoluteID |
( |
| ) |
const |
|
inline |
Definition at line 33 of file SResource.h.
33 {
34 return m_absoluteId;
35 }
◆ GetAssetReference()
Definition at line 81 of file SResource.cpp.
81 {
82 if (hash.empty()) hash = m_hash;
83 return CORE->GetCore(
ResMgr)->GetAssetReference(std::move(hash));
84}
◆ GetName()
std::string CSE::SResource::GetName |
( |
| ) |
const |
|
inline |
Definition at line 29 of file SResource.h.
29 {
30 return m_name;
31 }
◆ LinkResource() [1/2]
Definition at line 39 of file SResource.h.
39 {
40 SetResource(asset, false);
41 }
◆ LinkResource() [2/2]
void CSE::SResource::LinkResource |
( |
std::string | name | ) |
|
|
inline |
Definition at line 43 of file SResource.h.
43 {
44 SetResource(std::move(name), false);
45 }
◆ SetAbsoluteID()
void SResource::SetAbsoluteID |
( |
std::string | id | ) |
|
Definition at line 37 of file SResource.cpp.
37 {
38 m_absoluteId = std::move(id);
39}
◆ SetHash()
void SResource::SetHash |
( |
std::string & | hash | ) |
|
|
overridevirtual |
Reimplemented from CSE::SObject.
Definition at line 75 of file SResource.cpp.
75 {
76 std::string srcHash = m_hash;
77 SObject::SetHash(hash);
78 CORE->GetCore(
ResMgr)->ChangeHash(srcHash, hash);
79}
◆ SetName()
void SResource::SetName |
( |
std::string | name | ) |
|
Definition at line 33 of file SResource.cpp.
33 {
34 m_name = std::move(name);
35}
The documentation for this class was generated from the following files: