swig/Examples/test-suite/rename_pcre_encoder.i
Vadim Zeitlin f6cab0170a Ignore non-matching regex renames when searching renames list.
Skip over %renames with non-matching %(regex)s expansion when looking for the
one to apply to the given name. This allows to have multiple anonymous renames
using regex as now the first _matching_ one will be used instead of always
using the first one and ignoring all the rest of them.

Extend unit tests to verify that applying two anonymous %renames does work as
expected.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12293 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-16 14:09:39 +00:00

31 lines
644 B
OpenEdge ABL

%module rename_pcre_encoder
// strip the wx prefix from all identifiers except those starting with wxEVT
%rename("%(regex:/wx(?!EVT)(.*)/\\1/)s") "";
// Replace "Set" and "Get" prefixes with "put" and "get" respectively.
%rename("%(regex:/^Set(.*)/put\\1/)s", %$isfunction) "";
%rename("%(regex:/^Get(.*)/get\\1/)s", %$isfunction) "";
%inline %{
struct wxSomeWidget {
void SetBorderWidth(int width) { m_width = width; }
int GetBorderWidth() const { return m_width; }
void SetSize(int, int) {}
int m_width;
};
struct wxAnotherWidget {
void DoSomething() {}
};
class wxEVTSomeEvent {
};
class xUnchangedName {
};
%}