Commit ce0929dd authored by Florian Jung's avatar Florian Jung
Browse files

Added Cursor::get_children() method

parent bb7b7984
...@@ -157,6 +157,18 @@ clangmm::Cursor clangmm::Cursor::get_semantic_parent() const { ...@@ -157,6 +157,18 @@ clangmm::Cursor clangmm::Cursor::get_semantic_parent() const {
return Cursor(clang_getCursorSemanticParent(cx_cursor)); return Cursor(clang_getCursorSemanticParent(cx_cursor));
} }
std::vector<clangmm::Cursor> clangmm::Cursor::get_children() const {
std::vector<Cursor> result;
clang_visitChildren(cx_cursor,
[](CXCursor cur, CXCursor /*parent*/, CXClientData data) {
static_cast<std::vector<Cursor>*>(data)->emplace_back(cur);
return CXChildVisit_Continue;
},
&result
);
return result;
}
std::vector<clangmm::Cursor> clangmm::Cursor::get_arguments() const { std::vector<clangmm::Cursor> clangmm::Cursor::get_arguments() const {
std::vector<Cursor> cursors; std::vector<Cursor> cursors;
auto size=clang_Cursor_getNumArguments(cx_cursor); auto size=clang_Cursor_getNumArguments(cx_cursor);
......
...@@ -208,6 +208,7 @@ namespace clangmm { ...@@ -208,6 +208,7 @@ namespace clangmm {
Cursor get_canonical() const; Cursor get_canonical() const;
Cursor get_definition() const; Cursor get_definition() const;
Cursor get_semantic_parent() const; Cursor get_semantic_parent() const;
std::vector<Cursor> get_children() const;
std::vector<Cursor> get_arguments() const; std::vector<Cursor> get_arguments() const;
std::vector<Cursor> get_all_overridden_cursors() const; std::vector<Cursor> get_all_overridden_cursors() const;
operator bool() const; operator bool() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment