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 /addon | |
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 'addon')
-rw-r--r-- | addon/doxyapp/doxyapp.cpp | 32 | ||||
-rw-r--r-- | addon/doxyparse/doxyparse.cpp | 39 |
2 files changed, 33 insertions, 38 deletions
diff --git a/addon/doxyapp/doxyapp.cpp b/addon/doxyapp/doxyapp.cpp index ec93ef7..e51966d 100644 --- a/addon/doxyapp/doxyapp.cpp +++ b/addon/doxyapp/doxyapp.cpp @@ -47,23 +47,21 @@ class XRefDummyCodeGenerator : public CodeOutputInterface // these are just null functions, they can be used to produce a syntax highlighted // and cross-linked version of the source code, but who needs that anyway ;-) - void codify(const char *) {} - void writeCodeLink(const char *,const char *,const char *,const char *,const char *) {} - void writeLineNumber(const char *,const char *,const char *,int) {} - virtual void writeTooltip(const char *,const DocLinkInfo &, - const char *,const char *,const SourceLinkInfo &, - const SourceLinkInfo &) {} - void startCodeLine(bool) {} - void endCodeLine() {} - void startCodeAnchor(const char *) {} - void endCodeAnchor() {} - void startFontClass(const char *) {} - void endFontClass() {} - void writeCodeAnchor(const char *) {} - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} - void startCodeFragment(const char *) {} - void endCodeFragment(const char *) {} + void codify(const QCString &) override {} + void writeCodeLink(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {} + void writeLineNumber(const QCString &,const QCString &,const QCString &,int) override {} + virtual void writeTooltip(const QCString &,const DocLinkInfo &, + const QCString &,const QCString &,const SourceLinkInfo &, + const SourceLinkInfo &) override {} + void startCodeLine(bool) override {} + void endCodeLine() override {} + void startFontClass(const QCString &) override {} + void endFontClass() override {} + void writeCodeAnchor(const QCString &) override {} + void setCurrentDoc(const Definition *,const QCString &,bool) override {} + void addWord(const QCString &,bool) override {} + void startCodeFragment(const QCString &) override {} + void endCodeFragment(const QCString &) override {} // here we are presented with the symbols found by the code parser void linkableSymbol(int l, const char *sym,Definition *symDef,Definition *context) diff --git a/addon/doxyparse/doxyparse.cpp b/addon/doxyparse/doxyparse.cpp index 3090783..65e7327 100644 --- a/addon/doxyparse/doxyparse.cpp +++ b/addon/doxyparse/doxyparse.cpp @@ -52,24 +52,21 @@ class Doxyparse : public CodeOutputInterface // these are just null functions, they can be used to produce a syntax highlighted // and cross-linked version of the source code, but who needs that anyway ;-) - void codify(const char *) {} - void writeCodeLink(const char *,const char *,const char *,const char *,const char *) {} - void startCodeLine() {} - void endCodeLine() {} - void startCodeAnchor(const char *) {} - void endCodeAnchor() {} - void startFontClass(const char *) {} - void endFontClass() {} - void writeCodeAnchor(const char *) {} - void writeLineNumber(const char *,const char *,const char *,int) {} - virtual void writeTooltip(const char *,const DocLinkInfo &, - const char *,const char *,const SourceLinkInfo &, - const SourceLinkInfo &) {} - void startCodeLine(bool) {} - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} - void startCodeFragment(const char *) {} - void endCodeFragment(const char *) {} + void codify(const QCString &) override {} + void writeCodeLink(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {} + void startCodeLine(bool) override {} + void endCodeLine() override {} + void writeCodeAnchor(const QCString &) override {} + void startFontClass(const QCString &) override {} + void endFontClass() override {} + void writeLineNumber(const QCString &,const QCString &,const QCString &,int) override {} + virtual void writeTooltip(const QCString &,const DocLinkInfo &, + const QCString &,const QCString &,const SourceLinkInfo &, + const SourceLinkInfo &) override {} + void setCurrentDoc(const Definition *,const QCString &,bool) override {} + void addWord(const QCString &,bool) override {} + void startCodeFragment(const QCString &) override {} + void endCodeFragment(const QCString &) override {} void linkableSymbol(int l, const char *sym, Definition *symDef, Definition *context) { @@ -378,7 +375,7 @@ static bool checkLanguage(std::string& filename, std::string extension) { * about whether it is a C project or not. */ static void detectProgrammingLanguage(FileNameLinkedMap &fnli) { for (const auto &fn : fnli) { - std::string filename = fn->fileName(); + std::string filename = fn->fileName().str(); if ( checkLanguage(filename, ".cc") || checkLanguage(filename, ".cxx") || @@ -454,9 +451,9 @@ int main(int argc,char **argv) { // we need a place to put intermediate files std::ostringstream tmpdir; unsigned int pid = Portable::pid(); - if (Portable::getenv("TMP")) + if (!Portable::getenv("TMP").isEmpty()) tmpdir << Portable::getenv("TMP") << "/doxyparse-" << pid; - else if (Portable::getenv("TEMP")) + else if (!Portable::getenv("TEMP").isEmpty()) tmpdir << Portable::getenv("TEMP") << "/doxyparse-" << pid; else tmpdir << "doxyparse-" << pid; |