42 * @param parent
43 * @param current
44 * @param data
45 * @return 0 - break, 1 - continue, 2 - recurse
46 */
47 VisitResult visit(Cursor current, Cursor parent, Object data);
48 }
49
50 private static int visit(Visitor v, ByteBuffer c, ByteBuffer p, Object data) {
51 return v.visit(new Cursor(c), new Cursor(p), data).ordinal();
52 }
53
54 Cursor(ByteBuffer buf) {
55 super(buf);
56 }
57
58 public native boolean isDeclaration();
59 public native boolean isPreprocessing();
60 public native boolean isInvalid();
61 public native boolean isDefinition();
62
63 public native String spelling();
64 public native String USR();
65
66 public native int kind1();
67
68 public native int visitChildren(Visitor visitor, Object data);
69
70 public native boolean equalCursor(Cursor other);
71
72 public native Type type();
73 public native Type getEnumDeclIntegerType();
74
75 public native Cursor getDefinition();
76
77 public native SourceLocation getSourceLocation();
78 public native SourceRange getExtent();
79
80 public native int numberOfArgs();
81 public native Cursor getArgument(int idx);
|
42 * @param parent
43 * @param current
44 * @param data
45 * @return 0 - break, 1 - continue, 2 - recurse
46 */
47 VisitResult visit(Cursor current, Cursor parent, Object data);
48 }
49
50 private static int visit(Visitor v, ByteBuffer c, ByteBuffer p, Object data) {
51 return v.visit(new Cursor(c), new Cursor(p), data).ordinal();
52 }
53
54 Cursor(ByteBuffer buf) {
55 super(buf);
56 }
57
58 public native boolean isDeclaration();
59 public native boolean isPreprocessing();
60 public native boolean isInvalid();
61 public native boolean isDefinition();
62 public native boolean isAnonymousStruct();
63
64 public boolean isAnonymousEnum() {
65 // libclang::clang_Cursor_isAnonymous only applies to struct, not enum
66 if (type().kind() == TypeKind.Enum) {
67 return spelling().isEmpty() &&
68 type().spelling().startsWith("enum (anonymous");
69 }
70 return false;
71 }
72
73 public boolean isAnonymous() {
74 return isAnonymousStruct() || isAnonymousEnum();
75 }
76
77 public native String spelling();
78 public native String USR();
79
80 public native int kind1();
81
82 public native int visitChildren(Visitor visitor, Object data);
83
84 public native boolean equalCursor(Cursor other);
85
86 public native Type type();
87 public native Type getEnumDeclIntegerType();
88
89 public native Cursor getDefinition();
90
91 public native SourceLocation getSourceLocation();
92 public native SourceRange getExtent();
93
94 public native int numberOfArgs();
95 public native Cursor getArgument(int idx);
|