Skip to content

Commit

Permalink
* Make it possible to rename enumerators of C++ enum class (issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed May 12, 2017
1 parent d206b2f commit 217bcc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Make it possible to rename enumerators of C++ `enum class` ([issue #180](https://github.com/bytedeco/javacpp/issues/180))
* Make the arbitrary resources available to process executed with `Builder.buildCommand` via the `BUILD_PATH` environment variable
* Prevent `Parser` from outputting setters for `const` member pointers
* Add support for arrays of function pointers
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2576,8 +2576,10 @@ boolean enumeration(Context context, DeclarationList declList) throws ParserExce
tokens.index = backIndex;
return false;
}
boolean enumClass = false;
String enumType = "enum";
if (tokens.get(1).match(Token.CLASS, Token.STRUCT)) {
enumClass = true;
enumType += " " + tokens.next();
}
if (typedef && !tokens.get(1).match('{') && tokens.get(2).match(Token.IDENTIFIER)) {
Expand Down Expand Up @@ -2626,6 +2628,9 @@ boolean enumeration(Context context, DeclarationList declList) throws ParserExce
Token enumerator = tokens.get();
String cppName = enumerator.value;
String javaName = cppName;
if (enumClass) {
cppName = name + "::" + cppName;
}
if (context.namespace != null) {
cppName = context.namespace + "::" + cppName;
}
Expand Down

0 comments on commit 217bcc2

Please sign in to comment.