clangparser.h
Go to the documentation of this file.
1 #ifndef CLANGPARSER_H
2 #define CLANGPARSER_H
3 
4 #include <qcstring.h>
5 #include <qstrlist.h>
6 
8 class FileDef;
9 
10 /** @brief Wrapper for to let libclang assisted parsing. */
12 {
13  public:
14  /** Returns the one and only instance of the class */
15  static ClangParser *instance();
16 
17  /** Start parsing a file.
18  * @param[in] fileName The name of the file to parse.
19  * @param[in,out] filesInTranslationUnit Other files that are
20  * part of the input and included by the file.
21  * The function will return a subset of the files,
22  * only including the onces that were actually found
23  * during parsing.
24  */
25  void start(const char *fileName,QStrList &filesInTranslationUnit);
26 
27  /** Switches to another file within the translation unit started
28  * with start().
29  * @param[in] fileName The name of the file to switch to.
30  */
31  void switchToFile(const char *fileName);
32 
33  /** Finishes parsing a translation unit. Free any resources that
34  * were needed for parsing.
35  */
36  void finish();
37 
38  /** Looks for \a symbol which should be found at \a line and
39  * returns a clang unique reference to the symbol.
40  */
41  QCString lookup(uint line,const char *symbol);
42 
43  /** writes the syntax highlighted source code for a file
44  * @param[out] ol The output generator list to write to.
45  * @param[in] fd The file to write sources for.
46  */
48 
49  private:
51  uint &line,uint &column,
52  const char *text,int tokenIndex);
54  uint &line,uint &column,
55  const char *text);
57  uint &line,uint &column,
58  const char *text);
59  void determineInputFilesInSameTu(QStrList &filesInTranslationUnit);
60  class Private;
61  Private *p;
62  ClangParser();
63  virtual ~ClangParser();
65 };
66 
67 #endif
void switchToFile(const char *fileName)
void start(const char *fileName, QStrList &filesInTranslationUnit)
Definition: types.h:26
void determineInputFilesInSameTu(QStrList &filesInTranslationUnit)
Private * p
Definition: clangparser.h:60
fileName
Definition: dumpTree.py:9
QCString lookup(uint line, const char *symbol)
void linkIdentifier(CodeOutputInterface &ol, FileDef *fd, uint &line, uint &column, const char *text, int tokenIndex)
virtual ~ClangParser()
void line(double t, double *p, double &x, double &y, double &z)
std::vector< std::string > column
void writeSources(CodeOutputInterface &ol, FileDef *fd)
void linkInclude(CodeOutputInterface &ol, FileDef *fd, uint &line, uint &column, const char *text)
Wrapper for to let libclang assisted parsing.
Definition: clangparser.h:11
static ClangParser * s_instance
Definition: clangparser.h:64
static ClangParser * instance()
Definition: clangparser.cpp:30
void linkMacro(CodeOutputInterface &ol, FileDef *fd, uint &line, uint &column, const char *text)
unsigned uint
Definition: qglobal.h:351