Is there a way to run multiple filters in a single %rename call in SWIG?
I know from the manual that I can use a line like this:
%rename("%(strip:[H3D])s") "";
which will turn all methods such as “H3DFoo” in to “Foo”. There are other in-built filters for doing case transformation, but there is no documentation on how to do multiple steps.
Using another %rename replaces the filter, and I haven’t found a separator to run multiple filters on the string. So, it appears possible to convert type casing or remove a prefix and not both.
In this particular case it might be possible to use the regex filter, but it would be nice to be able to both remove a prefix and convert type casing. The other option is to put a %rename on every single declaration, but this defeats the purpose of %rename being able to apply to a module in general.
I think I’d be inclined to go for the variant of
%renamethat can call a command if your rules are more complicated than a single variant or a regex.I would use perl personally and it has a plethora of CPAN modules for things like renaming, e.g.:
The manual warns against this because it’s slow spawning processes to perform it. Given that typically you don’t run SWIG very often I don’t see that as a huge draw back.