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/docsets.cpp | |
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/docsets.cpp')
-rw-r--r-- | src/docsets.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/docsets.cpp b/src/docsets.cpp index 66ef115..bf589c4 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -71,7 +71,7 @@ void DocSets::initialize() std::ofstream ts(mfName.str(),std::ofstream::out | std::ofstream::binary); if (!ts.is_open()) { - term("Could not open file %s for writing\n",mfName.data()); + term("Could not open file %s for writing\n",qPrint(mfName)); } ts << "DOCSET_NAME=" << bundleId << ".docset\n" @@ -120,7 +120,7 @@ void DocSets::initialize() std::ofstream ts(plName.str(),std::ofstream::out | std::ofstream::binary); if (!ts.is_open()) { - term("Could not open file %s for writing\n",plName.data()); + term("Could not open file %s for writing\n",qPrint(plName)); } ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" @@ -154,7 +154,7 @@ void DocSets::initialize() p->ntf.open(notes.str(),std::ofstream::out | std::ofstream::binary); if (!p->ntf.is_open()) { - term("Could not open file %s for writing\n",notes.data()); + term("Could not open file %s for writing\n",qPrint(notes)); } p->nts.setStream(&p->ntf); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; @@ -172,7 +172,7 @@ void DocSets::initialize() p->ttf.open(tokens.str(),std::ofstream::out | std::ofstream::binary); if (!p->ttf.is_open()) { - term("Could not open file %s for writing\n",tokens.data()); + term("Could not open file %s for writing\n",qPrint(tokens)); } p->tts.setStream(&p->ttf); p->tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -224,10 +224,10 @@ void DocSets::decContentsDepth() } void DocSets::addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) @@ -243,7 +243,7 @@ void DocSets::addContentsItem(bool isDir, p->indentStack.top()=false; p->nts << p->indent() << " <Node>\n"; p->nts << p->indent() << " <Name>" << convertToXML(name) << "</Name>\n"; - if (file && file[0]=='^') // URL marker + if (!file.isEmpty() && file[0]=='^') // URL marker { p->nts << p->indent() << " <URL>" << convertToXML(&file[1]) << "</URL>\n"; @@ -251,16 +251,16 @@ void DocSets::addContentsItem(bool isDir, else // relative file { p->nts << p->indent() << " <Path>"; - if (file && file[0]=='!') // user specified file + if (!file.isEmpty() && file[0]=='!') // user specified file { p->nts << convertToXML(&file[1]); } - else if (file) // doxygen generated file + else if (!file.isEmpty()) // doxygen generated file { p->nts << file << Doxygen::htmlFileExtension; } p->nts << "</Path>\n"; - if (file && anchor) + if (!file.isEmpty() && !anchor.isEmpty()) { p->nts << p->indent() << " <Anchor>" << anchor << "</Anchor>\n"; } @@ -269,7 +269,7 @@ void DocSets::addContentsItem(bool isDir, } void DocSets::addIndexItem(const Definition *context,const MemberDef *md, - const char *,const char *) + const QCString &,const QCString &) { if (md==0 && context==0) return; @@ -477,7 +477,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md, } if (p->scopes.find(context->getOutputFileBase().str())==p->scopes.end()) { - writeToken(p->tts,context,type,lang,scope,0,decl); + writeToken(p->tts,context,type,lang,scope,QCString(),decl); p->scopes.insert(context->getOutputFileBase().str()); } } @@ -487,9 +487,9 @@ void DocSets::writeToken(TextStream &t, const Definition *d, const QCString &type, const QCString &lang, - const char *scope, - const char *anchor, - const char *decl) + const QCString &scope, + const QCString &anchor, + const QCString &decl) { t << " <Token>\n"; t << " <TokenIdentifier>\n"; @@ -504,14 +504,14 @@ void DocSets::writeToken(TextStream &t, { t << " <Type>" << type << "</Type>\n"; } - if (scope) + if (!scope.isEmpty()) { t << " <Scope>" << convertToXML(scope) << "</Scope>\n"; } t << " </TokenIdentifier>\n"; t << " <Path>" << d->getOutputFileBase() << Doxygen::htmlFileExtension << "</Path>\n"; - if (anchor) + if (!anchor.isEmpty()) { t << " <Anchor>" << anchor << "</Anchor>\n"; } @@ -520,14 +520,14 @@ void DocSets::writeToken(TextStream &t, { t << " <Abstract>" << convertToXML(tooltip) << "</Abstract>\n"; } - if (decl) + if (!decl.isEmpty()) { t << " <DeclaredIn>" << convertToXML(decl) << "</DeclaredIn>\n"; } t << " </Token>\n"; } -void DocSets::addIndexFile(const char *name) +void DocSets::addIndexFile(const QCString &name) { (void)name; } |