diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-11 19:22:59 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-22 17:34:13 (GMT) |
commit | 592aaa4f17d73ec8c475df0f44efaea8cc4d575c (patch) | |
tree | 3cfd68cec756661045ee25c906a8d8f4bddf7a6a /src/xmlcode.l | |
parent | 98c67549bc3cd855873e0ef5eeab7c6410699d78 (diff) | |
download | Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.zip Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.gz Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.bz2 |
Refactoring: remove implicit conversion from QCString to const char *
This commit changes the following in relation to string use
- The implicit convert from 'QCString' to 'const char *' is removed
- Strings parameters use 'const QCString &' as much as possible in favor
over 'const char *'
- 'if (s)' where s is a QCString has been replaced by 'if(!s.isEmpty())'
- data() now always returns a valid C-string and not a 0-pointer.
- when passing a string 's' to printf and related functions 'qPrint(s)' is
used instead of 's.data()'
- for empty string arguments 'QCString()' is used instead of '0'
- The copy() operation has been removed
- Where possible 'qstrcmp(a,b)==0' has been replaces by 'a==b' and
'qstrcmp(a,b)<0' has been replaced by 'a<b'
- Parameters of string type that were default initialized with '= 0' are
no initialized with '= QCString()'
Diffstat (limited to 'src/xmlcode.l')
-rw-r--r-- | src/xmlcode.l | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/xmlcode.l b/src/xmlcode.l index 65406d4..ff3d247 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -246,7 +246,7 @@ static void startCodeLine(yyscan_t yyscanner) yyextra->currentDefinition = d; yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); //yyextra->insideBody = false; - yyextra->classScope = d->name().copy(); + yyextra->classScope = d->name(); QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); if (yyextra->currentMemberDef) @@ -260,13 +260,13 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } @@ -395,11 +395,11 @@ void XMLCodeParser::resetCodeParserState() } void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName, + const QCString &exampleName, FileDef *fileDef, int startLine, int endLine, @@ -415,10 +415,10 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (input.isEmpty()) return; - printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, true, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = false; @@ -443,7 +443,7 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (isExampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated")); + yyextra->sourceFileDef = createFileDef("",(!exampleName.isEmpty()?exampleName:QCString("generated"))); cleanupSourceDef = true; } @@ -471,7 +471,7 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, yyextra->sourceFileDef=0; } - printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, false, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } |