I'm converting part of my code from JS to C++ thus I need to refactor direct instance variables assignment into setter methods:
a.xx=3;
to a->setXx(3);
and also getter methods:
...a.xx...
to ...a->getXx()...
Currently I use shelljs (node.js) for the conversions. Sample command for renaming a function from oldMethod() to newMethod():
sed('-i', /\boldMethod[ ]*\(/g, 'newMethod(', filename);
Preferably I would use the same technique fro the setters/getter. However I'm open to use other acceptable approach too.
My problems:
- I can not get the tagged substitutions working
- I'll need to capitalize the first letter
I'm not sure how to set proper conditions for the getter methods. There is no clear expression like
X=Y;
I can't simply turn allalphanum.alphanum
into getters because it would also replace incorrect expressions e.g.a("foo.doo");
My suggestions:a. do it anyway and manually update the incorrect replacements
b. supply a set of valid variable names, e.g.
"tag|possition|rotation|..."