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/htags.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/htags.cpp')
-rw-r--r-- | src/htags.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/htags.cpp b/src/htags.cpp index e59e7c8..cb7b99c 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -87,7 +87,7 @@ bool Htags::execute(const QCString &htmldir) commandLine += " \"" + htmldir + "\""; std::string oldDir = Dir::currentDirPath(); Dir::setCurrent(g_inputDir.absPath()); - //printf("CommandLine=[%s]\n",commandLine.data()); + //printf("CommandLine=[%s]\n",qPrint(commandLine)); Portable::sysTimerStart(); bool result=Portable::system("htags",commandLine,FALSE)==0; if (!result) @@ -128,8 +128,8 @@ bool Htags::loadFilemap(const QCString &htmlDir) std::string lineStr; while (getline(f,lineStr)) { - QCString line = lineStr; - //printf("Read line: %s",line.data()); + QCString line(lineStr); + //printf("Read line: %s",qPrint(line)); int sep = line.find('\t'); if (sep!=-1) { @@ -138,14 +138,14 @@ bool Htags::loadFilemap(const QCString &htmlDir) int ext=value.findRev('.'); if (ext!=-1) value=value.left(ext); // strip extension g_symbolMap.insert(std::make_pair(key.str(),value.str())); - //printf("Key/Value=(%s,%s)\n",key.data(),value.data()); + //printf("Key/Value=(%s,%s)\n",qPrint(key),qPrint(value)); } } return true; } else { - err("file %s cannot be opened\n",fileMapName.data()); + err("file %s cannot be opened\n",qPrint(fileMapName)); } } return false; @@ -167,10 +167,10 @@ QCString Htags::path2URL(const QCString &path) if (!symName.isEmpty()) { auto it = g_symbolMap.find(symName.str()); - //printf("path2URL=%s symName=%s result=%p\n",path.data(),symName.data(),result); + //printf("path2URL=%s symName=%s result=%p\n",qPrint(path),qPrint(symName),result); if (it!=g_symbolMap.end()) { - url = QCString("HTML/") + it->second; + url = QCString("HTML/"+it->second); } } return url; |