Przeglądaj źródła

Having an overload for setting arbitrary type properties without fromPath still makes sense due to the many settings that don't even need a path.

David Piuva 3 lat temu
rodzic
commit
06888a5843
2 zmienionych plików z 6 dodań i 0 usunięć
  1. 4 0
      Source/DFPSR/api/guiAPI.cpp
  2. 2 0
      Source/DFPSR/api/guiAPI.h

+ 4 - 0
Source/DFPSR/api/guiAPI.cpp

@@ -269,6 +269,10 @@ ReturnCode dsr::component_setProperty(const Component& component, const Readable
 		}
 	}
 }
+ReturnCode dsr::component_setProperty(const Component& component, const ReadableString& propertyName, const ReadableString& value, bool mustAssign) {
+	return component_setProperty(component, propertyName, value, file_getCurrentPath(), mustAssign);
+}
+
 String dsr::component_getProperty(const Component& component, const ReadableString& propertyName, bool mustExist) {
 	MUST_EXIST(component, component_getProperty);
 	Persistent* target = component->findAttribute(propertyName);

+ 2 - 0
Source/DFPSR/api/guiAPI.h

@@ -208,6 +208,8 @@ namespace dsr {
 	//     Returns ReturnCode::KeyNotFound if propertyName wasn't found in component.
 	//   Unless mustAssign forces an exception.
 	//     Returns ReturnCode::ParsingFailure if propertyName was found but value couldn't be converted to its type.
+	ReturnCode component_setProperty(const Component& component, const ReadableString& propertyName, const ReadableString& value, bool mustAssign = true);
+	// An advanced overload allowing loading of resources from a specific path using the fromPath argument.
 	ReturnCode component_setProperty(const Component& component, const ReadableString& propertyName, const ReadableString& value, const ReadableString& fromPath, bool mustAssign = true);
 	// A version for setting integers and booleans.
 	//   For integers: