clang-tags
C/C++ source code indexing tool based on libclang
 All Classes Functions Variables Typedefs Groups Pages
cursor.hxx
1 #pragma once
2 #include <clang-c/Index.h>
3 #include <string>
4 
5 namespace LibClang {
10  // Forward declarations
11  class TranslationUnit;
12  class SourceLocation;
13 
25  class Cursor {
26  public:
34  Cursor (const TranslationUnit & tu);
35 
49  Cursor (const TranslationUnit & tu,
50  const std::string & fileName, const unsigned int offset);
51 
59  bool isNull () const;
60 
68  bool isUnexposed () const;
69 
74  bool isDeclaration () const;
75 
84  Cursor referenced () const;
85 
96  std::string kindStr () const;
97 
102  std::string spelling () const;
103 
114  std::string USR () const;
115 
124  SourceLocation location () const;
125 
134  SourceLocation end () const;
135 
136  private:
137  Cursor (CXCursor raw);
138  const CXCursor & raw () const;
139  CXCursor cursor_;
140 
141  // Friend declaration
142  template <typename VISITOR>
143  friend CXChildVisitResult visitChildren (CXCursor rawCursor,
144  CXCursor rawParent, //unused
145  CXClientData client_data);
146  template <typename VISITOR>
147  friend class Visitor;
148  };
149 
151 }