clang-tags
C/C++ source code indexing tool based on libclang
 All Classes Functions Variables Typedefs Groups Pages
visitor.hxx
1 #pragma once
2 
3 #include "cursor.hxx"
4 
5 namespace LibClang {
6  template <typename VISITOR>
7  CXChildVisitResult visitChildren (CXCursor rawCursor,
8  CXCursor rawParent, //unused
9  CXClientData client_data)
10  {
11  const LibClang::Cursor cursor (rawCursor);
12  const LibClang::Cursor parent (rawParent);
13  VISITOR & visitor = *((VISITOR*)client_data);
14 
15  return visitor.visit (cursor, parent);
16  }
17 
50  template <typename VISITOR>
51  class Visitor {
52  public:
63  unsigned int visitChildren (const Cursor & top)
64  {
65  return clang_visitChildren (top.raw(),
66  LibClang::visitChildren<VISITOR>,
67  (VISITOR*)this);
68  }
69 
82  virtual CXChildVisitResult visit (Cursor cursor, LibClang::Cursor parent) = 0;
83  };
84 
86 }