Cleaned up the reflection code a bit

* Renamed 'tag' variable to 'handler'
* Removed addAlias stuff, instead check for matching names with if statements
* Added after_reading function that is called by Reader after reading a complete object. This generalizes Packaged::validate, which is now also called via this mechanism.
* Removed some backwards compatibility with <0.3.0 for templates
This commit is contained in:
Twan van Laarhoven
2020-04-26 15:33:59 +02:00
parent 4bebd48786
commit 40d78edf0f
32 changed files with 248 additions and 281 deletions
+7 -7
View File
@@ -39,14 +39,14 @@ String ImageValue::toString() const {
// custom reflection: convert to ScriptImageP for scripting
void ImageValue::reflect(Reader& tag) {
tag.handle(filename);
void ImageValue::reflect(Reader& handler) {
handler.handle(filename);
}
void ImageValue::reflect(Writer& tag) {
if (fieldP->save_value) tag.handle(filename);
void ImageValue::reflect(Writer& handler) {
if (fieldP->save_value) handler.handle(filename);
}
void ImageValue::reflect(GetMember& tag) {}
void ImageValue::reflect(GetDefaultMember& tag) {
void ImageValue::reflect(GetMember& handler) {}
void ImageValue::reflect(GetDefaultMember& handler) {
// convert to ScriptImageP for scripting
tag.handle( (ScriptValueP)make_intrusive<ImageValueToImage>(filename, last_update) );
handler.handle( (ScriptValueP)make_intrusive<ImageValueToImage>(filename, last_update) );
}