Build viewer/editor #13

Manually merged
williamjcm merged 128 commits from mass-viewer into master 2022-03-02 14:50:10 +01:00
3 changed files with 12 additions and 11 deletions
Showing only changes of commit f286ec0633 - Show all commits

View file

@ -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());

View file

@ -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;
} }

View file

@ -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>;