Build viewer/editor #13
3 changed files with 12 additions and 11 deletions
|
@ -26,7 +26,8 @@ struct GenericStructProperty : public StructProperty {
|
||||||
using ptr = Containers::Pointer<GenericStructProperty>;
|
using ptr = Containers::Pointer<GenericStructProperty>;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto at(const std::string& name) -> T* {
|
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
|
||||||
|
at(const std::string& name) {
|
||||||
for(auto& item : properties) {
|
for(auto& item : properties) {
|
||||||
if(item->name == name) {
|
if(item->name == name) {
|
||||||
return static_cast<T*>(item.get());
|
return static_cast<T*>(item.get());
|
||||||
|
|
|
@ -43,15 +43,6 @@ auto UESaveFile::reloadData() -> bool {
|
||||||
return valid();
|
return valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto UESaveFile::at(const std::string& name) -> UnrealPropertyBase* {
|
|
||||||
for(auto& prop : _properties) {
|
|
||||||
if(*(prop->name) == name) {
|
|
||||||
return prop.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto UESaveFile::props() -> Containers::ArrayView<UnrealPropertyBase::ptr> {
|
auto UESaveFile::props() -> Containers::ArrayView<UnrealPropertyBase::ptr> {
|
||||||
return _properties;
|
return _properties;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,16 @@ class UESaveFile {
|
||||||
|
|
||||||
auto reloadData() -> bool;
|
auto reloadData() -> bool;
|
||||||
|
|
||||||
auto at(const std::string& name) -> UnrealPropertyBase*;
|
template<typename T>
|
||||||
|
std::enable_if_t<std::is_base_of<UnrealPropertyBase, T>::value, T*>
|
||||||
|
at(const std::string& name) {
|
||||||
|
for(auto& prop : _properties) {
|
||||||
|
if(prop->name == name) {
|
||||||
|
return static_cast<T*>(prop.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
auto props() -> Containers::ArrayView<UnrealPropertyBase::ptr>;
|
auto props() -> Containers::ArrayView<UnrealPropertyBase::ptr>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue