Skip to content

Commit

Permalink
* Add String CXString.getString() helper method for clang (issue b…
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Dec 7, 2017
1 parent fa02922 commit 3e75741
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add `String CXString.getString()` helper method for `clang` ([issue bytedeco/javacpp#51](https://github.com/bytedeco/javacpp/issues/51))
* Add support for Mac OS X and Windows to presets for librealsense ([issue #447](https://github.com/bytedeco/javacpp-presets/issues/447))
* Enable MMAL and OpenMAX acceleration for FFmpeg on `linux-armhf` ([pull #388](https://github.com/bytedeco/javacpp-presets/pull/388))
* Enable V4L2 for OpenCV on ARM platforms as well ([issue bytedeco/javacv#850](https://github.com/bytedeco/javacv/issues/850))
Expand Down
7 changes: 6 additions & 1 deletion llvm/src/main/java/org/bytedeco/javacpp/clang.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ public static class CXString extends Pointer {
return (CXString)super.position(position);
}

@MemberGetter public native @Const Pointer data();
public String getString() {
String s = clang_getCString(this).getString();
clang_disposeString(this);
return s;
}
public native @Const Pointer data(); public native CXString data(Pointer data);
public native @Cast("unsigned") int private_flags(); public native CXString private_flags(int private_flags);
}

Expand Down
8 changes: 8 additions & 0 deletions llvm/src/main/java/org/bytedeco/javacpp/presets/clang.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public void map(InfoMap infoMap) {
.put(new Info("CINDEX_VERSION").cppTypes("int").translate(false))
.put(new Info("__has_feature(blocks)").define(false))

.put(new Info("CXString::data").javaText(
"public String getString() {\n"
+ " String s = clang_getCString(this).getString();\n"
+ " clang_disposeString(this);\n"
+ " return s;\n"
+ "}\n"
+ "public native @Const Pointer data(); public native CXString data(Pointer data);\n"))

.put(new Info("CXVirtualFileOverlayImpl").pointerTypes("CXVirtualFileOverlay"))
.put(new Info("CXModuleMapDescriptorImpl").pointerTypes("CXModuleMapDescriptor"))
.put(new Info("CXTargetInfoImpl").pointerTypes("CXTargetInfo"))
Expand Down

0 comments on commit 3e75741

Please sign in to comment.