Browse Source

Added Cursor::get_children() method

merge-requests/37/head
Florian Jung 8 years ago
parent
commit
ce0929ddda
  1. 12
      src/cursor.cc
  2. 1
      src/cursor.h

12
src/cursor.cc

@ -157,6 +157,18 @@ clangmm::Cursor clangmm::Cursor::get_semantic_parent() const {
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<Cursor> cursors;
auto size=clang_Cursor_getNumArguments(cx_cursor);

1
src/cursor.h

@ -208,6 +208,7 @@ namespace clangmm {
Cursor get_canonical() const;
Cursor get_definition() const;
Cursor get_semantic_parent() const;
std::vector<Cursor> get_children() const;
std::vector<Cursor> get_arguments() const;
std::vector<Cursor> get_all_overridden_cursors() const;
operator bool() const;

Loading…
Cancel
Save