Skip to content

Commit

Permalink
* Add getString() helper methods to CXTUResourceUsageKind and `C…
Browse files Browse the repository at this point in the history
…XEvalResult` (issue bytedeco/javacpp#51)
  • Loading branch information
saudet committed Dec 8, 2017
1 parent 3e75741 commit 0972619
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

* Add `String CXString.getString()` helper method for `clang` ([issue bytedeco/javacpp#51](https://github.com/bytedeco/javacpp/issues/51))
* Add `getString()` helper methods to `CXString`, `CXTUResourceUsageKind`, and `CXEvalResult` 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
9 changes: 9 additions & 0 deletions llvm/src/main/java/org/bytedeco/javacpp/clang.java
Original file line number Diff line number Diff line change
Expand Up @@ -2542,6 +2542,9 @@ public static native int clang_reparseTranslationUnit(CXTranslationUnit TU,
* the name of the memory category. This string should never be freed.
*/
public static native @Cast("const char*") BytePointer clang_getTUResourceUsageName(@Cast("CXTUResourceUsageKind") int kind);
public static class CXTUResourceUsageKind {
public static String getString(int kind) { return clang_getTUResourceUsageName(kind).getString(); }
}

public static class CXTUResourceUsageEntry extends Pointer {
static { Loader.load(); }
Expand Down Expand Up @@ -6610,6 +6613,12 @@ public static native void clang_getInclusions(CXTranslationUnit tu,
public CXEvalResult() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public CXEvalResult(Pointer p) { super(p); }

public String getString() {
String s = clang_EvalResult_getAsStr(this).getString();
clang_EvalResult_dispose(this);
return s;
}
}

/**
Expand Down
20 changes: 20 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 @@ -44,6 +44,26 @@ public void map(InfoMap infoMap) {
+ "}\n"
+ "public native @Const Pointer data(); public native CXString data(Pointer data);\n"))

.put(new Info("clang_getTUResourceUsageName").javaText(
"public static native @Cast(\"const char*\") BytePointer clang_getTUResourceUsageName(@Cast(\"CXTUResourceUsageKind\") int kind);\n"
+ "public static class CXTUResourceUsageKind {\n"
+ " public static String getString(int kind) { return clang_getTUResourceUsageName(kind).getString(); }\n"
+ "}\n"))

.put(new Info("CXEvalResult").javaText(
"@Namespace @Name(\"void\") @Opaque public static class CXEvalResult extends Pointer {\n"
+ " /** Empty constructor. Calls {@code super((Pointer)null)}. */\n"
+ " public CXEvalResult() { super((Pointer)null); }\n"
+ " /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */\n"
+ " public CXEvalResult(Pointer p) { super(p); }\n"
+ "\n"
+ " public String getString() {\n"
+ " String s = clang_EvalResult_getAsStr(this).getString();\n"
+ " clang_EvalResult_dispose(this);\n"
+ " return s;\n"
+ " }\n"
+ "}\n").valueTypes("CXEvalResult"))

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

0 comments on commit 0972619

Please sign in to comment.