Created
September 25, 2012 16:39
-
-
Save automatonic/3783025 to your computer and use it in GitHub Desktop.
SWIGing to C#: Batch rename member variable prefixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Handle "m_TypeName" cases without lowercase hungarian notation prefix, avoiding the other cases | |
%rename("%(strip:[m_])s", match$ismember="1", regexmatch$name="m_[^lbsd].*$") ""; | |
//We can interpret the above as: | |
//Rename all identifiers | |
// + that are class members | |
// + and have a "m_" prefix | |
// + but don't have a "m_s|m_l|m_b|m_d" prefix (they will be dealt with later) | |
// + from their original text | |
// + to a "strip"ped version that removes the "m_" portion | |
// | |
// "m_MyWorld" -> "MyWorld" | |
// "m_Another" -> "Another" | |
// "m_sWalker" -> [Ignored by this %rename] | |
//Handle strings, doubles, longs, and bools | |
%rename("%(strip:[m_s])s", match$ismember="1", regexmatch$name="m_s.*$") ""; | |
%rename("%(strip:[m_d])s", match$ismember="1", regexmatch$name="m_d.*$") ""; | |
%rename("%(strip:[m_l])s", match$ismember="1", regexmatch$name="m_l.*$") ""; | |
%rename("%(strip:[m_b])s", match$ismember="1", regexmatch$name="m_b.*$") ""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment