1
0
Fork 0

add function that recursively copies property tree branches (ignoring aliases);

reviewed and OK'ed by Andy
This commit is contained in:
mfranz 2005-12-16 20:25:52 +00:00
parent 523b81e317
commit 06fa115d86

View file

@ -114,6 +114,24 @@ dump = func {
}
}
##
# Recursively copy property branch from source Node to
# destination Node. Doesn't copy aliases.
#
copy = func(src, dest) {
foreach(c; src.getChildren()) {
name = c.getName() ~ "[" ~ c.getIndex() ~ "]";
copy(src.getNode(name), dest.getNode(name, 1));
}
var type = src.getType();
var val = src.getValue();
if(type == "ALIAS" or type == "NONE") { return; }
elsif(type == "BOOL") { dest.setBoolValue(val); }
elsif(type == "INT") { dest.setIntValue(val); }
elsif(type == "DOUBLE") { dest.setDoubleValue(val); }
else { dest.setValue(val); }
}
##
# Utility. Turns any ghosts it finds (either solo, or in an
# array) into Node objects.