jamoma / JamomaCore

Jamoma Frameworks for Audio and Control Structure
Other
36 stars 14 forks source link

Refactor out 4 deprecation warnings in TTGraphObjectBase #289

Closed nwolek closed 10 years ago

nwolek commented 10 years ago

Found while working on #253

/Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp /Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp:34:2: Logical not is only applied to the left hand side of this comparison /Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp:40:13: 'get' is deprecated /Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp:42:13: 'get' is deprecated /Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp:158:14: 'get' is deprecated /Volumes/Storage/xcode_projects/Jamoma/Core/Graph/library/source/TTGraphObjectBase.cpp:171:14: 'get' is deprecated

adrian-gierakowski commented 10 years ago

while working on this I have come up with a regexp search and replace pattern, which should be helpful in other similar issues (#287, #286, #285)

basic search term: (\s)(\S+).get((\S+),\s(\S+)); replace term: \1\4 = \2[\3];

search term explained: (\s) - match any number of white space characters (might be none) (\S+).get( - after the white spaces match at least one non-white space character followed by: .get( (\S+), - at least non-white space character followed by comma \s - any number of white space characters (\S+)); - at least one non-white space character followed by: )

the parentheses save matched substrings as backreferences, which can then be used to assemble the replace term using \index syntax ()index starts at 1)

The search term should be adjusted (in order to account for unpredictable white-spaces) to: (\s)(\S+)\s.\sget\s(\s(\S+)\s,\s(\S+)\s)\s*;

To process the .set cases use: search term: (\s)(\S+)\s.\sset\s(\s(\S+)\s,\s(\S+)\s)\s*; replace term: \1\2[\3] = \4;

nwolek commented 10 years ago

Bravo @adrian-gierakowski! I must admit, my regexp skills are limited. So I tend toward hand corrections. But this is a good solution for get() & set().

The object instantiate changes are more nuanced.