[Qt-creator] C++ Plugin: Check word against C++ Code Model
sergey.shambir.auto at gmail.com
Fri May 10 15:45:55 CEST 2013
CppModelManager class is a singleton. Use CppModelManager::document to
get target Document instance, than use iteration over global symbols
with globalSymbolCount/globalSymbolAt or scopeaAt(line, column) to get
Scopes form a chain, you can get enclosing scope with
Symbol::enclosingScope, and Scope is subclass of Symbol. Probably exact
position of comment is in global or namespace scope, so use some
heuristic like scanning until non-comment token appear.
10.05.13, 17:27, Carel Combrink ?????:
> I am busy with a Qt Creator plugin for the C++ Editor.
> How do I use the C++ code model to check if a word is a function,
> class, etc or 'just a word'? The plugin parses the comment tokens in a
> C++ Editor.
> For an example: I have the following code:
> /* This is function myFunction */
> void myFunction(int arg1);
> Parsing the comment gives me 4 words ("This", "is", "function" and
> "myFunction"). How do I know that "This" is just a word while
> "myFunction" is a token (part of the code model) in the scope of the
> My current, initial implementation checks a word against all tokens in
> the file that the comment appears in. I would like to make use of the
> code model instead, if possible.
> Qt-creator mailing list
> Qt-creator at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qt-creator