Changeset View
Changeset View
Standalone View
Standalone View
duchain/helpers.h
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | 152 | template<typename T> static const Decorator* findDecoratorByName(T* inDeclaration, const QString& name) { | |||
---|---|---|---|---|---|
154 | const IndexedString indexedName = IndexedString(name); | 154 | const IndexedString indexedName = IndexedString(name); | ||
155 | for ( int i = 0; i < count; i++ ) { | 155 | for ( int i = 0; i < count; i++ ) { | ||
156 | if ( inDeclaration->decorators()[i].fastName() == indexedName ) | 156 | if ( inDeclaration->decorators()[i].fastName() == indexedName ) | ||
157 | return &(inDeclaration->decorators()[i]); | 157 | return &(inDeclaration->decorators()[i]); | ||
158 | } | 158 | } | ||
159 | return 0; | 159 | return 0; | ||
160 | }; | 160 | }; | ||
161 | 161 | | |||
162 | static bool docstringContainsHint(Declaration* declaration, const QString& hintName, QStringList* args = 0) { | 162 | static bool docstringContainsHint(const QString& comment, const QString& hintName, QStringList* args = 0) { | ||
163 | // TODO cache types! this is horribly inefficient | 163 | // TODO cache types! this is horribly inefficient | ||
164 | const QString& comment = declaration->comment(); | | |||
165 | const QString search = "! " + hintName + " !"; | 164 | const QString search = "! " + hintName + " !"; | ||
166 | int index = comment.indexOf(search); | 165 | int index = comment.indexOf(search); | ||
167 | if ( index >= 0 ) { | 166 | if ( index >= 0 ) { | ||
168 | if ( args ) { | 167 | if ( args ) { | ||
169 | int eol = comment.indexOf('\n', index); | 168 | int eol = comment.indexOf('\n', index); | ||
170 | int start = index+search.size()+1; | 169 | int start = index+search.size()+1; | ||
171 | QString decl = comment.mid(start, eol-start); | 170 | QString decl = comment.mid(start, eol-start); | ||
172 | *args = decl.split(' '); | 171 | *args = decl.split(' '); | ||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |