@@ -49,7 +49,7 @@ private void CollectIndices(string docsPath, string module)
49
49
{
50
50
while ( xmlReader . Read ( ) )
51
51
{
52
- if ( xmlReader . NodeType == XmlNodeType . Element )
52
+ if ( xmlReader . NodeType == XmlNodeType . Element && xmlReader . GetAttribute ( "lineno" ) != null )
53
53
{
54
54
switch ( xmlReader . Name )
55
55
{
@@ -254,15 +254,16 @@ public void DocumentFunction(Function function)
254
254
var node = functions . Find (
255
255
f => f . Location == function . TranslationUnit . FileName &&
256
256
( f . LineNumber == lineStart || f . LineNumber == lineEnd ) ) ;
257
+ var @params = function . Parameters . Where ( p => p . Kind == ParameterKind . Regular ) . ToList ( ) ;
257
258
// HACK: functions in qglobal.h have weird additional definitions just for docs
258
259
if ( ( node == null || node . HRef == null ) && function . TranslationUnit . FileName == "qglobal.h" )
259
260
{
260
261
node = functions . Find (
261
262
c => c . Location == function . TranslationUnit . FileName &&
262
- c . Name == function . OriginalName ) ;
263
+ ( c . FullName == function . QualifiedOriginalName || c . Name == function . OriginalName ) &&
264
+ c . Access != "private" && c . ParametersModifiers . Count == @params . Count ) ;
263
265
}
264
266
// HACK: some functions are "located" in a cpp, go figure...
265
- var @params = function . Parameters . Where ( p => p . Kind == ParameterKind . Regular ) . ToList ( ) ;
266
267
if ( ( node == null || node . HRef == null ) && function . Signature != null )
267
268
{
268
269
var qualifiedOriginalName = function . GetQualifiedName ( decl => decl . OriginalName ,
@@ -323,17 +324,18 @@ public void DocumentFunction(Function function)
323
324
var docs = this . membersDocumentation [ file ] [ key ] ;
324
325
var i = 0 ;
325
326
// HACK: work around bugs of the type of https://bugreports.qt.io/browse/QTBUG-46148
326
- if ( ( function . OperatorKind == CXXOperatorKind . Greater && function . Namespace . Name == "QLatin1String" &&
327
- @params [ 0 ] . Type . ToString ( ) == "QtCore.QLatin1String" ) ||
328
- ( ( function . OriginalName == "flush" || function . OriginalName == "reset" ) &&
329
- function . Namespace . Name == "QTextStream" && @params . Count > 0 ) )
327
+ if ( function . Namespace . Name == "QByteArray" &&
328
+ ( ( function . OriginalName == "qCompress" && @params . Count == 2 ) ||
329
+ ( function . OriginalName == "qUncompress" && @params . Count == 1 ) ) )
330
330
{
331
331
docs = this . membersDocumentation [ file ] [ key + "-hack" ] ;
332
332
}
333
- foreach ( Match match in Regex . Matches ( docs [ 0 ] . InnerHtml , @"<i>\s*(.+?)\s*</i>" ) )
333
+ foreach ( Match match in regexParameters . Matches ( docs [ 0 ] . InnerHtml ) )
334
334
{
335
- @params [ i ] . Name = Helpers . SafeIdentifier ( match . Groups [ 1 ] . Value ) ;
336
- i ++ ;
335
+ // variadic and void "parameters" are invalid
336
+ if ( function . IsVariadic && @params . Count == i || match . Groups [ 1 ] . Value == "void" )
337
+ break ;
338
+ @params [ i ++ ] . Name = Helpers . SafeIdentifier ( match . Groups [ 1 ] . Value ) ;
337
339
}
338
340
// TODO: create links in the "See Also" section
339
341
function . Comment = new RawComment
@@ -793,5 +795,7 @@ private static void AddObsoleteAttribute(Declaration function)
793
795
private readonly List < DocIndexNode > classNodes = new List < DocIndexNode > ( ) ;
794
796
private readonly List < DocIndexNode > enumNodes = new List < DocIndexNode > ( ) ;
795
797
private readonly List < DocIndexNode > variableNodes = new List < DocIndexNode > ( ) ;
798
+
799
+ private Regex regexParameters = new Regex ( @"<i>\s*(.+?)\s*</i>" , RegexOptions . Compiled ) ;
796
800
}
797
801
}
0 commit comments