/** * \brief Visit the children of a particular cursor. * * This function visits all the direct children of the given cursor, * invoking the given \p visitor function with the cursors of each * visited child. The traversal may be recursive, if the visitor returns * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if * the visitor returns \c CXChildVisit_Break. * * \param parent the cursor whose child may be visited. All kinds of * cursors can be visited, including invalid cursors (which, by * definition, have no children). * * \param visitor the visitor function that will be invoked for each * child of \p parent. * * \param client_data pointer data supplied by the client, which will * be passed to the visitor each time it is invoked. * * \returns a non-zero value if the traversal was terminated * prematurely by the visitor returning \c CXChildVisit_Break. */ func (c Cursor) Visit(visitor CursorVisitor) bool { o := C._go_clang_visit_children(c.c, unsafe.Pointer(&visitor)) if o != C.uint(0) { return false } return true }
/** * \brief Visit the children of a particular cursor. * * This function visits all the direct children of the given cursor, * invoking the given \p visitor function with the cursors of each * visited child. The traversal may be recursive, if the visitor returns * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if * the visitor returns \c CXChildVisit_Break. * * \param parent the cursor whose child may be visited. All kinds of * cursors can be visited, including invalid cursors (which, by * definition, have no children). * * \param visitor the visitor function that will be invoked for each * child of \p parent. * * \param client_data pointer data supplied by the client, which will * be passed to the visitor each time it is invoked. * * \returns a non-zero value if the traversal was terminated * prematurely by the visitor returning \c CXChildVisit_Break. */ func (c Cursor) Visit(visitor CursorVisitor) bool { forceEscapeVisitor = &visitor id := visitorCallbacks.add(visitor) defer visitorCallbacks.remove(id) o := C._go_clang_visit_children(c.c, C.uintptr_t(id)) if o != C.uint(0) { return false } return true }