[Qt-creator] Syntax highlighting, template templates
Roberto Raggi
roberto.raggi at trolltech.com
Mon Jul 6 13:44:23 CEST 2009
Hi Niko,
please try this patch.
ciao robe
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/
cpptools/cppmodelmanager.cpp
index 7d7dc94..53f1498 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -373,6 +373,14 @@ protected:
virtual bool visit(TypenameTypeParameterAST *ast)
{
+ if (NameAST *nameAst = ast->name)
+ addType(nameAst->name);
+
+ return true;
+ }
+
+ virtual bool visit(TemplateTypeParameterAST *ast)
+ {
if (ast->name)
addType(ast->name->name);
On Jul 6, 2009, at 1:22 PM, Nico Kruber wrote:
> I've been working with template templates and there are still some
> bugs in Qt
> Creator's syntax highlighter which highlights my code suggesting it
> has errors
> (snapshot from 01/07/2009):
>
> --------------------
>
> template< template< typename > class Container, typename ElementType >
> bool printSimulations(Container<Element> container){
> }
> --> "'Container<Element>' is not a type name"
>
> --------------------
>
> template< template< typename > class Container, typename ElementType >
> bool printSimulations(Container<Element> container);
> --> strangely this doesn't show any error
>
> --------------------
>
> template< template< typename > class Container, typename ElementType >
> bool printSimulations(Container<Element> container, const QString&
> path);
> --> "'Container<Element>' is not a type name"
> (adding an additional "typename" before Container works with the
> syntax
> highlighter, but not with g++ - QtCreator could instead complain
> about that ;)
> )
>
> --------------------
>
> template< template< typename > class Container, typename ElementType >
> bool printSimulations(Container<Element> container, const
> QString& path) {
>
> typename Container<Element>::const_iterator i =
> container.constBegin();
> const typename Container<Element>::const_iterator end =
> container.constEnd();
> while(i != end) {
> // do something
> ++i;
> }
> }
> --> "'Container<Element>' is not a type name" at the function
> declaration
> --> and "'Container is not a namespace or class name" shown at the
> const_iterator lines
>
> --------------------
>
> Cheers,
> Nico Kruber
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
More information about the Qt-creator-old
mailing list