diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-26 18:18:22 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-26 18:18:22 (GMT) |
commit | 1b03538eb097fd32896554749fb6cefc9e195e61 (patch) | |
tree | 5858e3e304c2312cff65fc6f906a9f893aa4caa5 /src | |
parent | 30d9199b4ae662a8d2094f60e4dd4190718dd7c6 (diff) | |
parent | d68805522f642e6c47ad2d285d5cacc3329ce7fd (diff) | |
download | Doxygen-1b03538eb097fd32896554749fb6cefc9e195e61.zip Doxygen-1b03538eb097fd32896554749fb6cefc9e195e61.tar.gz Doxygen-1b03538eb097fd32896554749fb6cefc9e195e61.tar.bz2 |
Merge branch 'qcstring'
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/commentscan.l | 334 | ||||
-rw-r--r-- | src/defargs.l | 1 | ||||
-rw-r--r-- | src/docparser.cpp | 17 | ||||
-rw-r--r-- | src/index.cpp | 2 | ||||
-rw-r--r-- | src/qcstring.cpp | 560 | ||||
-rw-r--r-- | src/qcstring.h | 514 | ||||
-rw-r--r-- | src/qhp.cpp | 22 | ||||
-rw-r--r-- | src/rtfgen.cpp | 4 | ||||
-rw-r--r-- | src/util.cpp | 14 | ||||
-rw-r--r-- | src/util.h | 1 | ||||
-rw-r--r-- | src/vhdlcode.l | 32 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 31 | ||||
-rw-r--r-- | src/vhdljjparser.cpp | 21 | ||||
-rwxr-xr-x | src/vhdljjparser.h | 2 |
15 files changed, 1322 insertions, 237 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 22ced1e..868cd04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,6 @@ # vim:ts=4:sw=4:expandtab:autoindent: include_directories( - ${PROJECT_SOURCE_DIR}/qtools ${PROJECT_SOURCE_DIR}/filesystem ${PROJECT_SOURCE_DIR}/libmd5 ${PROJECT_SOURCE_DIR}/liblodepng @@ -286,6 +285,7 @@ add_library(doxymain STATIC pagedef.cpp perlmodgen.cpp plantuml.cpp + qcstring.cpp qhp.cpp qhpxmlwriter.cpp reflist.cpp @@ -352,7 +352,6 @@ endif() target_link_libraries(doxygen PRIVATE doxymain doxycfg - qtools md5 lodepng mscgen @@ -372,7 +371,6 @@ set_project_warnings(doxycfg) set_project_warnings(doxymain) set_project_warnings(doxygen) -set_project_coverage(qtools) set_project_coverage(doxycfg) set_project_coverage(doxymain) set_project_coverage(doxygen) diff --git a/src/commentscan.l b/src/commentscan.l index 89b8052..8fa2199 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -38,7 +38,6 @@ #include <ctype.h> #include <qcstring.h> -#include <qcstringlist.h> #include "cite.h" #include "commentscan.h" @@ -60,89 +59,89 @@ #define USE_STATE2STRING 0 // forward declarations -static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleDef(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleOverload(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleEnum(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleNamespace(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePage(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleDir(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleExample(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleNoop(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleTodo(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleTest(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleBug(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringList &); -static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleSection(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleAnchor(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCite(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleFormatBlock(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleIf(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePrivate(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleProtected(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handlePublic(yyscan_t yyscanner,const QCString &s, const QCStringList &); -static bool handlePublicSection(yyscan_t yyscanner,const QCString &s, const QCStringList &); -static bool handleToc(yyscan_t yyscanner,const QCString &s, const QCStringList &); -static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &); +static bool handleBrief(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleFn(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleDef(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleOverload(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleEnum(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleNamespace(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePackage(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleClass(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleProtocol(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCategory(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleUnion(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleStruct(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleInterface(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleIdlException(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePage(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleMainpage(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleFile(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleDir(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleExample(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleDetails(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleNoop(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleName(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleTodo(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleTest(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleBug(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const StringVector &); +static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleRelated(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleRefItem(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleSection(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleAnchor(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCite(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleFormatBlock(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleIf(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleIfNot(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleElseIf(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleElse(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleEndIf(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleIngroup(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleInternal(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePrivate(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleProtected(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handlePublic(yyscan_t yyscanner,const QCString &s, const StringVector &); +static bool handlePublicSection(yyscan_t yyscanner,const QCString &s, const StringVector &); +static bool handleToc(yyscan_t yyscanner,const QCString &s, const StringVector &); +static bool handleInherit(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleExtends(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleParBlock(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleParam(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleRetval(yyscan_t yyscanner,const QCString &, const StringVector &); #if USE_STATE2STRING static const char *stateToString(int state); #endif -typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const QCStringList &optList); +typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const StringVector &optList); enum class CommandSpacing { @@ -668,7 +667,7 @@ STopt [^\n@\\]* if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT; int idxEnd = fullMatch.find("}",idx+1); QCString cmdName; - QCStringList optList; + StringVector optList; if (idx == -1) // no options { cmdName = QCString(yytext).stripWhiteSpace().data()+1; // to remove {CMD} @@ -677,7 +676,7 @@ STopt [^\n@\\]* { cmdName = fullMatch.left(idx).stripWhiteSpace().data()+1; // to remove {CMD} QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); - optList = QCStringList::split(',',optStr); + optList = split(optStr.str(),","); } auto it = docCmdMap.find(cmdName.data()); //printf("lookup command '%s' found=%d\n",cmdName.data(),it!=docCmdMap.end()); @@ -1902,14 +1901,14 @@ STopt [^\n@\\]* //---------------------------------------------------------------------------- -static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleBrief(yyscan_t yyscanner,const QCString &, const StringVector &) { //printf("handleBrief\n"); setOutput(yyscanner,OutputBrief); return FALSE; } -static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleFn(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::MEMBERDOC_SEC); @@ -1919,7 +1918,7 @@ static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &) return stop; } -static bool handleDef(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleDef(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::DEFINEDOC_SEC); @@ -1928,7 +1927,7 @@ static bool handleDef(yyscan_t yyscanner,const QCString &, const QCStringList &) return stop; } -static bool handleOverload(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleOverload(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->functionProto.resize(0); @@ -1936,7 +1935,7 @@ static bool handleOverload(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleEnum(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleEnum(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::ENUMDOC_SEC); @@ -1944,7 +1943,7 @@ static bool handleEnum(yyscan_t yyscanner,const QCString &, const QCStringList & return stop; } -static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC); @@ -1953,7 +1952,7 @@ static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringLi return stop; } -static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC); @@ -1962,7 +1961,7 @@ static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const QCString return stop; } -static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC); @@ -1971,7 +1970,7 @@ static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const QCStringL return stop; } -static bool handleNamespace(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleNamespace(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::NAMESPACEDOC_SEC); @@ -1979,7 +1978,7 @@ static bool handleNamespace(yyscan_t yyscanner,const QCString &, const QCStringL return stop; } -static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePackage(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::PACKAGEDOC_SEC); @@ -1987,7 +1986,7 @@ static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringLis return stop; } -static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::CLASSDOC_SEC); @@ -1996,14 +1995,14 @@ static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const QCStringLi return stop; } -static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; BEGIN( ClassDocArg2 ); return FALSE; } -static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { // Obj-C protocol struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::PROTOCOLDOC_SEC); @@ -2012,7 +2011,7 @@ static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const QCStrin return stop; } -static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { // Obj-C category struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::CATEGORYDOC_SEC); @@ -2021,7 +2020,7 @@ static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const QCStrin return stop; } -static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::UNIONDOC_SEC); @@ -2030,7 +2029,7 @@ static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const QCStringLi return stop; } -static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::STRUCTDOC_SEC); @@ -2039,7 +2038,7 @@ static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const QCStringL return stop; } -static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::INTERFACEDOC_SEC); @@ -2048,7 +2047,7 @@ static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const QCStri return stop; } -static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::EXCEPTIONDOC_SEC); @@ -2057,7 +2056,7 @@ static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const QCS return stop; } -static bool handlePage(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePage(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::PAGEDOC_SEC); @@ -2065,7 +2064,7 @@ static bool handlePage(yyscan_t yyscanner,const QCString &, const QCStringList & return stop; } -static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleMainpage(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::MAINPAGEDOC_SEC); @@ -2078,7 +2077,7 @@ static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringLi return stop; } -static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleFile(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::FILEDOC_SEC); @@ -2090,7 +2089,7 @@ static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList & return stop; } -static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleParam(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; // we need process param and retval arguments to escape leading underscores in case of @@ -2100,7 +2099,7 @@ static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList return FALSE; } -static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleRetval(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,"@retval "); @@ -2108,7 +2107,7 @@ static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList return FALSE; } -static bool handleDir(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleDir(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::DIRDOC_SEC); @@ -2117,14 +2116,12 @@ static bool handleDir(yyscan_t yyscanner,const QCString &, const QCStringList &) return stop; } -static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const QCStringList &optList) +static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const StringVector &optList) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; Entry::Sections section=Entry::EXAMPLE_SEC; - QCStringList::ConstIterator it; - for ( it = optList.begin(); it != optList.end(); ++it ) + for (const auto &opt : optList) { - QCString opt = (*it).stripWhiteSpace().lower(); if (opt=="lineno") { section=Entry::EXAMPLE_LINENO_SEC; @@ -2132,7 +2129,7 @@ static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const QCString else { warn(yyextra->fileName,yyextra->lineNr, - "unsupported option '%s' for command '\\%s'",qPrint(opt),qPrint(cmd)); + "unsupported option '%s' for command '\\%s'",opt.c_str(),qPrint(cmd)); } } bool stop=makeStructuralIndicator(yyscanner,section); @@ -2141,7 +2138,7 @@ static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const QCString return stop; } -static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleDetails(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->inContext!=OutputBrief) @@ -2153,14 +2150,14 @@ static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringLis return FALSE; } -static bool handleNoop(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleNoop(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; BEGIN( Noop ); return FALSE; } -static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleName(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool stop=makeStructuralIndicator(yyscanner,Entry::MEMBERGRP_SEC); @@ -2176,7 +2173,7 @@ static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList & return stop; } -static bool handleTodo(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleTodo(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->newXRefKind = XRef_Todo; @@ -2185,7 +2182,7 @@ static bool handleTodo(yyscan_t yyscanner,const QCString &, const QCStringList & return FALSE; } -static bool handleTest(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleTest(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->newXRefKind = XRef_Test; @@ -2194,7 +2191,7 @@ static bool handleTest(yyscan_t yyscanner,const QCString &, const QCStringList & return FALSE; } -static bool handleBug(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleBug(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->newXRefKind = XRef_Bug; @@ -2203,7 +2200,7 @@ static bool handleBug(yyscan_t yyscanner,const QCString &, const QCStringList &) return FALSE; } -static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->newXRefKind = XRef_Deprecated; @@ -2212,7 +2209,7 @@ static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const QCString return FALSE; } -static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->newXRefKind = XRef_Item; @@ -2220,7 +2217,7 @@ static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleParBlock(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->insideParBlock) @@ -2238,7 +2235,7 @@ static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!yyextra->insideParBlock) @@ -2252,7 +2249,7 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin return FALSE; } -static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!yyextra->current->relates.isEmpty()) @@ -2265,7 +2262,7 @@ static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const QCString return FALSE; } -static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!yyextra->current->relates.isEmpty()) @@ -2279,7 +2276,7 @@ static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const QCSt return FALSE; } -static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!yyextra->current->relates.isEmpty()) @@ -2293,7 +2290,7 @@ static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const QCStrin return FALSE; } -static bool handleRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleRefItem(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,"@refitem "); @@ -2301,7 +2298,7 @@ static bool handleRefItem(yyscan_t yyscanner,const QCString &, const QCStringLis return FALSE; } -static bool handleSection(yyscan_t yyscanner,const QCString &s, const QCStringList &) +static bool handleSection(yyscan_t yyscanner,const QCString &s, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; setOutput(yyscanner,OutputDoc); @@ -2314,7 +2311,7 @@ static bool handleSection(yyscan_t yyscanner,const QCString &s, const QCStringLi return FALSE; } -static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringList &) +static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->current->section!=Entry::EMPTY_SEC && @@ -2335,7 +2332,7 @@ static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringLi return FALSE; } -static bool handleAnchor(yyscan_t yyscanner,const QCString &s, const QCStringList &) +static bool handleAnchor(yyscan_t yyscanner,const QCString &s, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,"@"+s+" "); @@ -2343,7 +2340,7 @@ static bool handleAnchor(yyscan_t yyscanner,const QCString &s, const QCStringLis return FALSE; } -static bool handleCite(yyscan_t yyscanner,const QCString &s, const QCStringList &) +static bool handleCite(yyscan_t yyscanner,const QCString &s, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!yyextra->spaceBeforeCmd.isEmpty()) @@ -2356,16 +2353,16 @@ static bool handleCite(yyscan_t yyscanner,const QCString &s, const QCStringList return FALSE; } -static bool handleFormatBlock(yyscan_t yyscanner,const QCString &s, const QCStringList &optList) +static bool handleFormatBlock(yyscan_t yyscanner,const QCString &s, const StringVector &optList) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (optList.isEmpty()) + if (optList.empty()) { addOutput(yyscanner,"@"+s+" "); } else { - addOutput(yyscanner,"@"+s+"{"+optList.join(",")+"} "); + addOutput(yyscanner,"@"+s+"{"+join(optList,",")+"} "); } //printf("handleFormatBlock(%s) with option(%s)\n",s.data(),opt.data()); yyextra->blockName=s; @@ -2374,7 +2371,7 @@ static bool handleFormatBlock(yyscan_t yyscanner,const QCString &s, const QCStri return FALSE; } -static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,"@addindex "); @@ -2382,7 +2379,7 @@ static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleIf(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleIf(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->enabledSectionFound=FALSE; @@ -2392,7 +2389,7 @@ static bool handleIf(yyscan_t yyscanner,const QCString &, const QCStringList &) return FALSE; } -static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleIfNot(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->enabledSectionFound=FALSE; @@ -2402,7 +2399,7 @@ static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList return FALSE; } -static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleElseIf(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->guards.empty()) @@ -2419,7 +2416,7 @@ static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList return FALSE; } -static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleElse(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->guards.empty()) @@ -2435,7 +2432,7 @@ static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList & return FALSE; } -static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleEndIf(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->guards.empty()) @@ -2457,7 +2454,7 @@ static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList return FALSE; } -static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleIngroup(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->inGroupParamFound=FALSE; @@ -2465,84 +2462,84 @@ static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringLis return FALSE; } -static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->subGrouping = FALSE; return FALSE; } -static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->initLines = 100000; // ON return FALSE; } -static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->initLines = 0; // OFF return FALSE; } -static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->callGraph = TRUE; // ON return FALSE; } -static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->callGraph = FALSE; // OFF return FALSE; } -static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->callerGraph = TRUE; // ON return FALSE; } -static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->callerGraph = FALSE; // OFF return FALSE; } -static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->referencedByRelation = TRUE; // ON return FALSE; } -static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->referencedByRelation = FALSE; // OFF return FALSE; } -static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->referencesRelation = TRUE; // ON return FALSE; } -static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->referencesRelation = FALSE; // OFF return FALSE; } -static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleInternal(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (!Config_getBool(INTERNAL_DOCS)) @@ -2565,72 +2562,71 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->stat = TRUE; return FALSE; } -static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->virt = Pure; return FALSE; } -static bool handlePrivate(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePrivate(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = Private; return FALSE; } -static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = yyextra->protection = Private; return FALSE; } -static bool handleProtected(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleProtected(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = Protected; return FALSE; } -static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = yyextra->protection = Protected ; return FALSE; } -static bool handlePublic(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePublic(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = Public; return FALSE; } -static bool handlePublicSection(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handlePublicSection(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->current->protection = yyextra->protection = Public; return FALSE; } -static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &optList) +static bool handleToc(yyscan_t yyscanner,const QCString &, const StringVector &optList) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->current->section==Entry::PAGEDOC_SEC || yyextra->current->section==Entry::MAINPAGEDOC_SEC) { - QCStringList::ConstIterator it; - for ( it = optList.begin(); it != optList.end(); ++it ) + for (const auto &opt_ : optList) { - QCString opt = (*it).stripWhiteSpace().lower(); + QCString opt = QCString(opt_).stripWhiteSpace().lower(); char dum; int level = 5; int i = opt.find(':'); @@ -2638,7 +2634,7 @@ static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &o { if (sscanf(opt.right(opt.length() - i - 1).data(),"%d%c",&level,&dum) != 1) { - warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data()); + warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '%s'", QCString(opt_).stripWhiteSpace().data()); opt = ""; } else @@ -2668,7 +2664,7 @@ static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &o } else { - warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data()); + warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '%s'", QCString(opt_).stripWhiteSpace().data()); } } } @@ -2682,14 +2678,14 @@ static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &o return FALSE; } -static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleInherit(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; BEGIN(InheritParam); return FALSE; } -static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const QCStringList &) +static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->currentCmd = cmd; @@ -2697,7 +2693,7 @@ static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const QCString return FALSE; } -static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->current->brief.isEmpty() && yyextra->current->doc.isEmpty()) @@ -2715,7 +2711,7 @@ static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringL return FALSE; } -static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; setOutput(yyscanner,OutputDoc); @@ -2728,7 +2724,7 @@ static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStrin return FALSE; } -static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const QCStringList &) +static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; setOutput(yyscanner,OutputBrief); diff --git a/src/defargs.l b/src/defargs.l index 36ed99c..528d44c 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -56,7 +56,6 @@ //#include <iostream.h> #include <assert.h> #include <ctype.h> -#include <qcstringlist.h> #include "defargs.h" #include "entry.h" diff --git a/src/docparser.cpp b/src/docparser.cpp index 22b7341..4965953 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -19,7 +19,6 @@ #include <qcstring.h> #include <ctype.h> -#include <qcstringlist.h> #include "regex.h" #include "doxygen.h" @@ -5060,24 +5059,28 @@ void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) doctokenizerYYsetStateOptions(); tok=doctokenizerYYlex(); doctokenizerYYsetStatePara(); - QCStringList optList=QCStringList::split(",",g_token->name); - if (t==DocInclude::Include && optList.contains("lineno")) + StringVector optList=split(g_token->name.str(),","); + auto contains = [&optList](const char *kw) + { + return std::find(optList.begin(),optList.end(),kw)!=optList.end(); + }; + if (t==DocInclude::Include && contains("lineno")) { t = DocInclude::IncWithLines; } - else if (t==DocInclude::Snippet && optList.contains("lineno")) + else if (t==DocInclude::Snippet && contains("lineno")) { t = DocInclude::SnipWithLines; } - else if (t==DocInclude::DontInclude && optList.contains("lineno")) + else if (t==DocInclude::DontInclude && contains("lineno")) { t = DocInclude::DontIncWithLines; } - else if (t==DocInclude::Include && optList.contains("doc")) + else if (t==DocInclude::Include && contains("doc")) { t = DocInclude::IncludeDoc; } - else if (t==DocInclude::Snippet && optList.contains("doc")) + else if (t==DocInclude::Snippet && contains("doc")) { t = DocInclude::SnippetDoc; } diff --git a/src/index.cpp b/src/index.cpp index 5554987..92c9f37 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -4428,7 +4428,7 @@ static void writeIndex(OutputList &ol) ol.popGeneratorState(); } -static QArray<bool> indexWritten; +static std::vector<bool> indexWritten; static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList &entries) { diff --git a/src/qcstring.cpp b/src/qcstring.cpp new file mode 100644 index 0000000..2a595cd --- /dev/null +++ b/src/qcstring.cpp @@ -0,0 +1,560 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2015 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#include "qcstring.h" + +#include <limits.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <ctype.h> + +QCString &QCString::sprintf( const char *format, ... ) +{ + va_list ap; + va_start( ap, format ); + const int minlen=256; + int l = length(); + if (l<minlen) { resize(minlen); l=minlen; } + int n=vsnprintf( rawData(), l, format, ap); + if (n<0) n=l; + resize(n+1); + va_end( ap ); + return *this; +} + +int QCString::find( char c, int index, bool cs ) const +{ + if (index<0 || index>=(int)length()) return -1; // index outside string + const char *pos; + if (cs) + { + pos = strchr(data()+index,c); + } + else + { + pos = data()+index; + c = tolower((unsigned char)c); + while (*pos && tolower((unsigned char)*pos)!=c) pos++; + if (!*pos && c) pos=0; // not found + } + return pos ? (int)(pos - data()) : -1; +} + +int QCString::find( const char *str, int index, bool cs ) const +{ + int l = length(); + if (index<0 || index>=l) return -1; // index outside string + if (!str) return -1; // no string to search for + if (!*str) return index; // empty string matching at index + const char *pos; + if (cs) // case sensitive + { + pos = strstr(data()+index,str); + } + else // case insensitive + { + pos = data(); + int len = qstrlen(str); + while (*pos) + { + if (qstrnicmp(pos,str,len)==0) break; + pos++; + } + if (!*pos) pos = 0; // not found + } + return pos ? (int)(pos - data()) : -1; +} + +int QCString::find( const QCString &str, int index, bool cs ) const +{ + return find(str.data(),index,cs); +} + +int QCString::findRev( char c, int index, bool cs) const +{ + const char *b = data(); + const char *pos; + int len = length(); + if (len==0) return -1; // empty string + if (index<0) // start from end + { + if (cs) + { + pos = strrchr(b,c); + return pos ? (int)(pos - b) : -1; + } + index=len; + } + else if (index>len) // bad index + { + return -1; + } + pos = b+index; + if (cs) + { + while ( pos>=b && *pos!=c) pos--; + } + else + { + c = tolower((unsigned char)c); + while ( pos>=b && tolower((unsigned char)*pos)!=c) pos--; + } + return pos>=b ? (int)(pos - b) : -1; +} + +int QCString::findRev( const char *str, int index, bool cs) const +{ + int slen = qstrlen(str); + int len = length(); + if (index<0) index = len-slen; // start from end + else if (index>len) return -1; // bad index + else if (index+slen>len) index=len-slen; // str would be too long + if (index<0) return -1; // no match possible + const char *pos = data()+index; + if (cs) // case sensitive + { + for (int i=index; i>=0; i--) if (qstrncmp(pos--,str,slen)==0) return i; + } + else // case insensitive + { + for (int i=index; i>=0; i--) if (qstrnicmp(pos,str,slen)==0) return i; + } + return -1; +} + +int QCString::contains( char c, bool cs ) const +{ + if (length()==0) return 0; + int count=0; + const char *pos = data(); + if (cs) + { + while (*pos) if (*pos++ == c) count++; + } + else + { + c = tolower((unsigned char)c); + while (*pos) + { + if (tolower((unsigned char)*pos)==c) count++; + pos++; + } + } + return count; +} + +int QCString::contains( const char *str, bool cs ) const +{ + if (str==0 || length()==0) return 0; + int count=0; + const char *pos = data(); + int len = qstrlen(str); + while (*pos) + { + if (cs) + { + if (qstrncmp(pos,str,len)==0) count++; + } + else + { + if (qstrnicmp(pos,str,len)==0) count++; + } + pos++; + } + return count; +} + +QCString QCString::simplifyWhiteSpace() const +{ + if ( isEmpty() ) // nothing to do + return *this; + + QCString result( length()+1 ); + const char *from = data(); + char *to = result.rawData(); + char *first = to; + while ( TRUE ) + { + while ( *from && isspace((uchar) *from) ) + from++; + while ( *from && !isspace((uchar)*from) ) + *to++ = *from++; + if ( *from ) + *to++ = 0x20; // ' ' + else + break; + } + if ( to > first && *(to-1) == 0x20 ) + to--; + *to = '\0'; + result.resize( (int)(to - result.data()) + 1 ); + return result; +} + +QCString &QCString::replace( uint index, uint len, const char *s) +{ + remove( index, len ); + insert( index, s ); + return *this; +} + +static bool ok_in_base( char c, int base ) +{ + if ( base <= 10 ) + return c>='0' && c<='9' && (c-'0') < base; + else + return (c>='0' && c<='9') || + (c >= 'a' && c < char('a'+base-10)) || + (c >= 'A' && c < char('A'+base-10)); +} + +short QCString::toShort(bool *ok, int base) const +{ + long v = toLong( ok, base ); + if ( ok && *ok && (v < -32768 || v > 32767) ) { + *ok = FALSE; + v = 0; + } + return (short)v; +} + +ushort QCString::toUShort(bool *ok,int base) const +{ + ulong v = toULong( ok, base ); + if ( ok && *ok && (v > 65535) ) { + *ok = FALSE; + v = 0; + } + return (ushort)v; +} + +int QCString::toInt(bool *ok, int base) const +{ + return (int)toLong( ok, base ); +} + +uint QCString::toUInt(bool *ok,int base) const +{ + return (uint)toULong( ok, base ); +} + + +long QCString::toLong(bool *ok,int base) const +{ + const char *p = data(); + long val=0; + int l = length(); + const long max_mult = INT_MAX / base; + bool is_ok = FALSE; + int neg = 0; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( l && *p == '-' ) { + l--; + p++; + neg = 1; + } else if ( *p == '+' ) { + l--; + p++; + } + + // NOTE: toULong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + int dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (INT_MAX%base)+neg) ) + goto bye; + val = base*val + dv; + p++; + } + if ( neg ) + val = -val; + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; +} + +ulong QCString::toULong(bool *ok,int base) const +{ + const char *p = data(); + ulong val=0; + int l = length(); + const ulong max_mult = 429496729; // UINT_MAX/10, rounded down + bool is_ok = FALSE; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( *p == '+' ) + l--,p++; + + // NOTE: toLong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + uint dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (UINT_MAX%base)) ) + goto bye; + val = base*val + dv; + p++; + } + + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; +} + +uint64 QCString::toUInt64(bool *ok,int base) const +{ + const char *p = data(); + uint64 val=0; + int l = length(); + const uint64 max_mult = 1844674407370955161ULL; // ULLONG_MAX/10, rounded down + bool is_ok = FALSE; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( *p == '+' ) + l--,p++; + + // NOTE: toULong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + uint dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (ULLONG_MAX%base)) ) + goto bye; + val = base*val + dv; + p++; + } + + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; +} + +//------------------------------------------------- + +void *qmemmove( void *dst, const void *src, uint len ) +{ + char *d; + char *s; + if ( dst > src ) { + d = (char *)dst + len - 1; + s = (char *)src + len - 1; + while ( len-- ) + *d-- = *s--; + } else if ( dst < src ) { + d = (char *)dst; + s = (char *)src; + while ( len-- ) + *d++ = *s++; + } + return dst; +} + +char *qstrdup( const char *str ) +{ + if ( !str ) + return 0; + char *dst = new char[qstrlen(str)+1]; + return strcpy( dst, str ); +} + +char *qstrncpy( char *dst, const char *src, uint len ) +{ + if ( !src ) + return 0; + strncpy( dst, src, len ); + if ( len > 0 ) + dst[len-1] = '\0'; + return dst; +} + +int qstricmp( const char *str1, const char *str2 ) +{ + const uchar *s1 = (const uchar *)str1; + const uchar *s2 = (const uchar *)str2; + int res; + uchar c; + if ( !s1 || !s2 ) + return s1 == s2 ? 0 : (int)(s2 - s1); + for ( ; !(res = (c=tolower(*s1)) - tolower(*s2)); s1++, s2++ ) + if ( !c ) // strings are equal + break; + return res; +} + +int qstrnicmp( const char *str1, const char *str2, uint len ) +{ + const uchar *s1 = (const uchar *)str1; + const uchar *s2 = (const uchar *)str2; + int res; + uchar c; + if ( !s1 || !s2 ) + return (int)(s2 - s1); + for ( ; len--; s1++, s2++ ) { + if ( (res = (c=tolower(*s1)) - tolower(*s2)) ) + return res; + if ( !c ) // strings are equal + break; + } + return 0; +} + +/// substitute all occurrences of \a src in \a s by \a dst +QCString substitute(const QCString &s,const QCString &src,const QCString &dst) +{ + if (s.isEmpty() || src.isEmpty()) return s; + const char *p, *q; + int srcLen = src.length(); + int dstLen = dst.length(); + int resLen; + if (srcLen!=dstLen) + { + int count; + for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++; + resLen = s.length()+count*(dstLen-srcLen); + } + else // result has same size as s + { + resLen = s.length(); + } + QCString result(resLen+1); + char *r; + for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen) + { + int l = (int)(q-p); + memcpy(r,p,l); + r+=l; + + if (dst) memcpy(r,dst,dstLen); + r+=dstLen; + } + if (r) + { + qstrcpy(r,p); + } + //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); + return result; +} + + +/// substitute all occurrences of \a src in \a s by \a dst, but skip +/// each consecutive sequence of \a src where the number consecutive +/// \a src matches \a skip_seq; if \a skip_seq is negative, skip any +/// number of consecutive \a src +QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq) +{ + if (s.isEmpty() || src.isEmpty()) return s; + const char *p, *q; + int srcLen = src.length(); + int dstLen = dst.length(); + int resLen; + if (srcLen!=dstLen) + { + int count; + for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++; + resLen = s.length()+count*(dstLen-srcLen); + } + else // result has same size as s + { + resLen = s.length(); + } + QCString result(resLen+1); + char *r; + for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen) + { + // search a consecutive sequence of src + int seq = 0, skip = 0; + if (skip_seq) + { + for (const char *n=q+srcLen; qstrncmp(n,src,srcLen)==0; seq=1+skip, n+=srcLen) + ++skip; // number of consecutive src after the current one + + // verify the allowed number of consecutive src to skip + if (skip_seq > 0 && skip_seq != seq) + seq = skip = 0; + } + + // skip a consecutive sequence of src when necessary + int l = (int)((q + seq * srcLen)-p); + memcpy(r,p,l); + r+=l; + + if (skip) + { + // skip only the consecutive src found after the current one + q += skip * srcLen; + // the next loop will skip the current src, aka (p=q+srcLen) + continue; + } + + if (dst) memcpy(r,dst,dstLen); + r+=dstLen; + } + qstrcpy(r,p); + result.resize((int)strlen(result.data())+1); + //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); + return result; +} + diff --git a/src/qcstring.h b/src/qcstring.h new file mode 100644 index 0000000..6e2802d --- /dev/null +++ b/src/qcstring.h @@ -0,0 +1,514 @@ +/**************************************************************************** +** +** Copyright (C) 1997-2015 by Dimitri van Heesch. +** +** Permission to use, copy, modify, and distribute this software and its +** documentation under the terms of the GNU General Public License is hereby +** granted. No representations are made about the suitability of this software +** for any purpose. It is provided "as is" without express or implied warranty. +** See the GNU General Public License for more details. +** +** Note: this is a reimplementation of the qcstring.h that came with +** an Qt version 2.2.3. For short strings it stores the string data inside +** the object. For long strings it uses a separate array with reference counting. +** +**********************************************************************/ + +#ifndef QCSTRING_H +#define QCSTRING_H + +#include <string> +#include <algorithm> + +#include <cctype> +#include <cstring> +#include <cstdio> +#include <cstdlib> +#include <cstdint> +#include <ostream> + +const bool FALSE = false; +const bool TRUE = true; +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned uint; +typedef unsigned long ulong; +typedef int64_t int64; +typedef uint64_t uint64; +#define QMAX(a,b) ((a) > (b) ? (a) : (b)) +#define QMIN(a,b) ((a) < (b) ? (a) : (b)) +#define ASSERT(x) if ( !(x) )\ + fprintf(stderr,"ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__) + + +/***************************************************************************** + Safe and portable C string functions; extensions to standard string.h + *****************************************************************************/ + +void *qmemmove( void *dst, const void *src, uint len ); + +#if defined(_OS_WIN32_) +#define qsnprintf _snprintf +#else +#define qsnprintf snprintf +#endif + +char *qstrdup( const char * ); + +inline uint cstrlen( const char *str ) +{ return (uint)strlen(str); } + +inline uint qstrlen( const char *str ) +{ return str ? (uint)strlen(str) : 0; } + +inline char *cstrcpy( char *dst, const char *src ) +{ return strcpy(dst,src); } + +inline char *qstrcpy( char *dst, const char *src ) +{ return src ? strcpy(dst, src) : 0; } + +char * qstrncpy(char *dst,const char *src, uint len); + +inline int cstrcmp( const char *str1, const char *str2 ) +{ return strcmp(str1,str2); } + +inline int qstrcmp( const char *str1, const char *str2 ) +{ return (str1 && str2) ? strcmp(str1,str2) : (int)((intptr_t)str2 - (intptr_t)str1); } + +inline int cstrncmp( const char *str1, const char *str2, uint len ) +{ return strncmp(str1,str2,len); } + +inline int qstrncmp( const char *str1, const char *str2, uint len ) +{ return (str1 && str2) ? strncmp(str1,str2,len) : + (int)((intptr_t)str2 - (intptr_t)str1); } + +int qstricmp( const char *str1, const char *str2 ); + +int qstrnicmp( const char *str1, const char *str2, uint len ); + +/** This is an alternative implementation of QCString. It provides basically + * the same functions but uses std::string as the underlying string type + */ +class QCString +{ + public: + QCString() = default; + ~QCString() = default; + QCString( const QCString &s ) = default; + QCString &operator=( const QCString &s ) = default; + QCString( QCString &&s ) = default; + QCString &operator=( QCString &&s ) = default; + + QCString( const std::string &s ) : m_rep(s) {} + + /** creates a string with room for size characters + * @param[in] size the number of character to allocate (also counting the 0-terminator!) + */ + explicit QCString( uint size ) { m_rep.resize(size>0 ? size-1 : 0); } + + /** creates a string from a plain C string. + * @param[in] str A zero terminated C string. When 0 an empty string is created. + */ + QCString( const char *str ) : m_rep(str?str:"") {} + + /** creates a string from \a str and copies over the first \a maxlen characters. */ + QCString( const char *str, uint maxlen ) : m_rep(str?str:"") { m_rep.resize(maxlen); } + + /** replaces the contents by that of string \a s. */ + + /** replaces the contents by that of C string \a str. */ + QCString &operator=( const char *str) { m_rep = str?str:""; return *this; } + + /** Returns TRUE iff the string is empty. Equivalent to isEmpty(). */ + bool isNull() const { return m_rep.empty(); } + + /** Returns TRUE iff the string is empty */ + bool isEmpty() const { return m_rep.empty(); } + + /** Returns the length of the string, not counting the 0-terminator. Equivalent to size(). */ + uint length() const { return (uint)m_rep.size(); } + + /** Returns the length of the string, not counting the 0-terminator. */ + uint size() const { return (uint)m_rep.size(); } + + /** Returns a pointer to the contents of the string in the form of a 0-terminated C string */ + const char *data() const { return m_rep.empty() ? 0 : m_rep.c_str(); } + + /** Returns a writable pointer to the data. + * @warning if the string is shared it will modifying the string directly and + * this will overwrite all copies as well! + */ + char *rawData() const { return m_rep.empty() ? 0 : const_cast<char*>(&m_rep[0]); } + + /** Resizes the string to hold \a newlen characters + * (this value should also count the 0-terminator). + * If the string is enlarged the contents will + * be left unmodified. + */ + bool resize( uint newlen ) { m_rep.resize( newlen>0 ? newlen-1 : 0 ); return TRUE; } + + /** Truncates the string at position \a pos. */ + bool truncate( uint pos ) { return resize( pos + 1 ); } + + /** Fills a string with a predefined character + * @param[in] c the character used to fill the string with. + * @param[in] len the number of character to fill. Use -1 to fill the whole string. + * @note the string will be resized to contain \a len characters. The contents of the + * string will be lost. + */ + bool fill( char c, int len = -1 ) + { + int l = len==-1 ? (int)m_rep.size() : len; + m_rep = std::string(l,c); + return TRUE; + } + + /** Returns a deep copy of the string. */ + QCString copy() const { return *this; } + + QCString &sprintf( const char *format, ... ); + + int find( char c, int index=0, bool cs=TRUE ) const; + int find( const char *str, int index=0, bool cs=TRUE ) const; + int find( const QCString &str, int index=0, bool cs=TRUE ) const; + //int find( const QRegExp &rx, int index=0 ) const; + + int findRev( char c, int index=-1, bool cs=TRUE) const; + int findRev( const char *str, int index=-1, bool cs=TRUE) const; + //int findRev( const QRegExp &rx, int index=-1 ) const; + + int contains( char c, bool cs=TRUE ) const; + int contains( const char *str, bool cs=TRUE ) const; + //int contains( const QRegExp &rx ) const; + + bool stripPrefix(const char *prefix) + { + if (prefix==0 || m_rep.empty()) return FALSE; + if (m_rep.rfind(prefix,0)==0) // string starts with prefix + { + m_rep.erase(0,qstrlen(prefix)); + return TRUE; + } + return FALSE; + } + + QCString left( uint len ) const + { + return m_rep.empty() ? QCString() : QCString(m_rep.substr(0,len)); + } + + QCString right( uint len ) const + { + return m_rep.empty() ? QCString() : + len<m_rep.size() ? QCString(m_rep.substr(m_rep.size()-len,len)) : + *this; + } + + QCString mid( uint index, uint len=(uint)-1) const + { + uint slen = (uint)m_rep.size(); + if (len==(uint)-1) len = slen-index; + return m_rep.empty() || index>slen || len==0 ? QCString() : + QCString(m_rep.substr(index,len)); + } + + QCString lower() const + { + std::string s = m_rep; + std::transform(s.begin(),s.end(),s.begin(), + [](unsigned char c){ return (unsigned char)std::tolower(c); }); + return s; + } + + QCString upper() const + { + std::string s = m_rep; + std::transform(s.begin(),s.end(),s.begin(), + [](unsigned char c){ return (unsigned char)std::toupper(c); }); + return s; + } + + QCString stripWhiteSpace() const + { + int sl = (uint)m_rep.size(); + if (sl==0 || (!std::isspace(m_rep[0]) && !std::isspace(m_rep[sl-1]))) return *this; + int start=0,end=sl-1; + while (start<sl && std::isspace(m_rep[start])) start++; + if (start==sl) return QCString(); // only whitespace + while (end>start && std::isspace(m_rep[end])) end--; + return QCString(m_rep.substr(start,1+end-start)); + } + + QCString simplifyWhiteSpace() const; + + QCString &insert( uint index, const char *s ) + { + uint len = s ? qstrlen(s) : 0; + if (len>0) + { + uint ol = (uint)m_rep.size(); + if (index>ol) // insert beyond end of string and fill gap with spaces + { + m_rep.resize(index+len); + std::memset(&m_rep[ol],' ',index-ol); + std::memcpy(&m_rep[index],s,len+1); + } + else // insert inside the string + { + m_rep.insert(index,s); + } + } + return *this; + } + + QCString &insert( uint index, char c) + { + char s[2] = { c, '\0' }; + return insert(index,s); + } + + QCString &append( const char *s ) + { + return operator+=(s); + } + + QCString &prepend( const char *s ) + { + return insert(0,s); + } + + QCString &remove( uint index, uint len ) + { + uint ol = (uint)m_rep.size(); + if (index<ol && len>0) m_rep.erase(index,index+len>=ol ? std::string::npos : len); + return *this; + } + + QCString &replace( uint index, uint len, const char *s); + //QCString &replace( const QRegExp &rx, const char *str ); + + short toShort( bool *ok=0, int base=10 ) const; + ushort toUShort( bool *ok=0, int base=10 ) const; + int toInt( bool *ok=0, int base=10 ) const; + uint toUInt( bool *ok=0, int base=10 ) const; + long toLong( bool *ok=0, int base=10 ) const; + ulong toULong( bool *ok=0, int base=10 ) const; + uint64 toUInt64( bool *ok=0, int base=10 ) const; + + QCString &setNum(short n) + { + m_rep = std::to_string(n); + return *this; + } + + QCString &setNum(ushort n) + { + m_rep = std::to_string(n); + return *this; + } + + QCString &setNum(int n) + { + m_rep = std::to_string(n); + return *this; + } + + QCString &setNum(uint n) + { + m_rep = std::to_string(n); + return *this; + } + + QCString &setNum(long n) + { + m_rep = std::to_string(n); + return *this; + } + + QCString &setNum(ulong n) + { + m_rep = std::to_string(n); + return *this; + } + + bool startsWith( const char *s ) const + { + if (m_rep.empty() || s==0) return s==0; + return m_rep.rfind(s,0)==0; // looking "backward" starting and ending at index 0 + } + + /** Converts the string to a plain C string */ + operator const char *() const + { + return data(); + } + + std::string str() const + { + return m_rep; + } + + QCString &operator+=( const QCString &s) + { + m_rep+=s.str(); + return *this; + } + + QCString &operator+=( const std::string &s) + { + m_rep+=s; + return *this; + } + + /** Appends string \a str to this string and returns a reference to the result. */ + QCString &operator+=( const char *s ) + { + if (s) m_rep+=s; + return *this; + } + + /** Appends character \a c to this string and returns a reference to the result. */ + QCString &operator+=( char c ) + { + m_rep+=c; + return *this; + } + + /** Returns a reference to the character at index \a i. */ + char &at( uint i) const + { + return const_cast<char&>(m_rep[i]); + } + + /** Indexing operator. Equivalent to at(). */ + char &operator[]( int i ) const + { + return const_cast<char&>(m_rep[i]); + } + + private: + std::string m_rep; +}; + +/***************************************************************************** + QCString non-member operators + *****************************************************************************/ + +inline bool operator==( const QCString &s1, const QCString &s2 ) +{ return qstrcmp(s1.data(),s2.data()) == 0; } + +inline bool operator==( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) == 0; } + +inline bool operator==( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) == 0; } + +inline bool operator!=( const QCString &s1, const QCString &s2 ) +{ return qstrcmp(s1.data(),s2.data()) != 0; } + +inline bool operator!=( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) != 0; } + +inline bool operator!=( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) != 0; } + +inline bool operator<( const QCString &s1, const QCString& s2 ) +{ return qstrcmp(s1.data(),s2.data()) < 0; } + +inline bool operator<( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) < 0; } + +inline bool operator<( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) < 0; } + +inline bool operator<=( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) <= 0; } + +inline bool operator<=( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) <= 0; } + +inline bool operator>( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) > 0; } + +inline bool operator>( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) > 0; } + +inline bool operator>=( const QCString &s1, const char *s2 ) +{ return qstrcmp(s1.data(),s2) >= 0; } + +inline bool operator>=( const char *s1, const QCString &s2 ) +{ return qstrcmp(s1,s2.data()) >= 0; } + +inline QCString operator+( const QCString &s1, const QCString &s2 ) +{ + return QCString(s1.str()+s2.str()); +} + + +inline QCString operator+( const QCString &s1, const char *s2 ) +{ + QCString tmp(s1); + tmp += s2; + return tmp; +} + +inline QCString operator+( const char *s1, const QCString &s2 ) +{ + QCString tmp(s1); + tmp += s2; + return tmp; +} + +inline QCString operator+( const QCString &s1, char c2 ) +{ + QCString tmp( s1.data() ); + tmp += c2; + return tmp; +} + +inline QCString operator+( char c1, const QCString &s2 ) +{ + QCString tmp; + tmp += c1; + tmp += s2; + return tmp; +} + +inline const char *qPrint(const char *s) +{ + if (s) return s; else return ""; +} + +inline const char *qPrint(const QCString &s) +{ + if (!s.isEmpty()) return s.data(); else return ""; +} + +inline const char *qPrint(const std::string &s) +{ + return s.c_str(); +} + +inline std::string toStdString(const QCString &s) +{ + return s.str(); +} + +// helper functions +QCString substitute(const QCString &str,const QCString &find,const QCString &replace); +QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq); + +inline QCString substitute(const QCString &s,char srcChar,char dstChar) +{ + std::string ss = s.str(); + std::replace(ss.begin(),ss.end(),srcChar,dstChar); + return ss; +} + +inline std::ostream& operator<<(std::ostream& os, const QCString& s) +{ + os << s.str(); + return os; +} + +#endif // QCSTRING_H diff --git a/src/qhp.cpp b/src/qhp.cpp index 181ed67..dd199ad 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -22,9 +22,9 @@ #include "groupdef.h" #include "doxygen.h" #include "filedef.h" +#include "util.h" #include <fstream> -#include <qcstringlist.h> #include <string.h> static QCString makeFileName(const char * withoutExtension) @@ -101,10 +101,11 @@ void Qhp::initialize() { "name", filterName, 0 }; m_doc.open("customFilter", tagAttributes); - QCStringList customFilterAttributes = QCStringList::split(' ', Config_getString(QHP_CUST_FILTER_ATTRS)); - for (int i = 0; i < (int)customFilterAttributes.count(); i++) + StringVector customFilterAttributes = + split(Config_getString(QHP_CUST_FILTER_ATTRS).str(), " "); + for (const auto &attr : customFilterAttributes) { - m_doc.openCloseContent("filterAttribute", customFilterAttributes[i]); + m_doc.openCloseContent("filterAttribute", attr.c_str()); } m_doc.close("customFilter"); } @@ -112,15 +113,16 @@ void Qhp::initialize() m_doc.open("filterSection"); // Add section attributes - QCStringList sectionFilterAttributes = QCStringList::split(' ', - Config_getString(QHP_SECT_FILTER_ATTRS)); - if (!sectionFilterAttributes.contains("doxygen")) + StringVector sectionFilterAttributes = + split(Config_getString(QHP_SECT_FILTER_ATTRS).str(), " "); + if (std::find(sectionFilterAttributes.begin(), sectionFilterAttributes.end(), "doxygen") == + sectionFilterAttributes.end()) { - sectionFilterAttributes << "doxygen"; + sectionFilterAttributes.push_back("doxygen"); } - for (int i = 0; i < (int)sectionFilterAttributes.count(); i++) + for (const auto &attr : sectionFilterAttributes) { - m_doc.openCloseContent("filterAttribute", sectionFilterAttributes[i]); + m_doc.openCloseContent("filterAttribute", attr.c_str()); } m_toc.open("toc"); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 49e97f2..bb49a18 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -2313,7 +2313,7 @@ static void encodeForOutput(std::ostream &t,const char *s) QCString encoding; bool converted=FALSE; int l = qstrlen(s); - static QByteArray enc; + static std::vector<char> enc; if (l*4>(int)enc.size()) enc.resize(l*4); // worst case encoding.sprintf("CP%s",theTranslator->trRTFansicp().data()); if (!encoding.isEmpty()) @@ -2325,7 +2325,7 @@ static void encodeForOutput(std::ostream &t,const char *s) size_t iLeft=l; size_t oLeft=enc.size(); char *inputPtr = (char*)s; - char *outputPtr = enc.data(); + char *outputPtr = &enc[0]; if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { enc.resize(enc.size()-(unsigned int)oLeft); diff --git a/src/util.cpp b/src/util.cpp index f402bac..c5bc40e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7396,3 +7396,17 @@ int findIndex(const std::string &s,const reg::Ex &re) return reg::search(s,match,re) ? (int)match.position() : -1; } +/// create a string where the string in the vector are joined by the given delimiter +std::string join(const StringVector &sv,const std::string &delimiter) +{ + std::string result; + bool first=true; + for (const auto &s : sv) + { + if (!first) result+=delimiter; + first=false; + result+=s; + } + return result; +} + @@ -446,6 +446,7 @@ StringVector split(const std::string &s,const std::string &delimiter); StringVector split(const std::string &s,const reg::Ex &delimiter); int findIndex(const StringVector &sv,const std::string &s); int findIndex(const std::string &s,const reg::Ex &re); +std::string join(const StringVector &s,const std::string &delimiter); bool recognizeFixedForm(const char* contents, FortranFormat format); FortranFormat convertFileNameFortranParserCode(QCString fn); diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 29a8e0b..36b7e6d 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -37,7 +37,6 @@ #include <stdio.h> #include <assert.h> #include <ctype.h> -#include <qcstringlist.h> #include "vhdlcode.h" #include "entry.h" @@ -573,26 +572,25 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } <ParsePackage>[^:;]* { //found package - QCString temp(yytext); - QCStringList strl=QCStringList::split(".",temp); - if (strl.count()>2) + StringVector strl=split(yytext,"."); + if (strl.size()>2) { - QCString s1=strl[0]; - QCString s2=strl[1]; - QCString s3=strl[2]; + std::string s1=strl[0]; + std::string s2=strl[1]; + std::string s3=strl[2]; s1.append("."); - s3.prepend("."); - codifyLines(yyscanner,s1.data(),yyextra->currClass.data()); - ClassDef *cd=VhdlDocGen::getPackageName(s2); + s3.insert(0,"."); + codifyLines(yyscanner,s1.c_str(),yyextra->currClass.data()); + ClassDef *cd=VhdlDocGen::getPackageName(s2.c_str()); if (cd) { - generateClassOrGlobalLink(yyscanner,*yyextra->code,s2.data()); + generateClassOrGlobalLink(yyscanner,*yyextra->code,s2.c_str()); } else { - codifyLines(yyscanner,s2.data()); + codifyLines(yyscanner,s2.c_str()); } - codifyLines(yyscanner,s3.data()); + codifyLines(yyscanner,s3.c_str()); } else { @@ -677,9 +675,9 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI <Bases>^{B}*("package "){BN}*("body"){BN}*{FUNCNAME} { // found package body QCString ss(yytext); QCString temp=VhdlDocGen::getIndexWord(yytext,2); - QCStringList ql=QCStringList::split(temp,ss); - QCString ll=ql[0]; - codifyLines(yyscanner,ll.data(),yyextra->currClass.data()); + StringVector ql=split(yytext,temp.str()); + std::string ll=ql[0]; + codifyLines(yyscanner,ll.c_str(),yyextra->currClass.data()); temp=temp.stripWhiteSpace(); temp.prepend("_"); generateClassOrGlobalLink(yyscanner,*yyextra->code,temp.data()); @@ -1500,7 +1498,7 @@ static void writeFuncProto(yyscan_t yyscanner) codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data()); return; } - QCStringList qlist=QCStringList::split(name,yyextra->funcProto); + StringVector qlist=split(yyextra->funcProto.str(),name.str()); QCString temp=qlist[0]; codifyLines(yyscanner,temp.data(),yyextra->currClass.data()); yyextra->funcProto.stripPrefix(temp.data()); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 87dcd72..07ee7ad 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -28,7 +28,6 @@ #include <algorithm> #include <qcstring.h> -#include <qcstringlist.h> /* --------------------------------------------------------------- */ @@ -858,7 +857,7 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) } else if (ii==VhdlDocGen::ARCHITECTURE) { - QCStringList qlist=QCStringList::split("-",nn); + StringVector qlist=split(nn.str(),"-"); nn=qlist[1]; cd=VhdlDocGen::getClass(nn.data()); } @@ -869,7 +868,7 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) VhdlDocGen::findAllArchitectures(ql,cd); for (const auto &s : ql) { - QCStringList qlist=QCStringList::split("-",s); + StringVector qlist=split(s.str(),"-"); QCString s1=qlist[0]; QCString s2=qlist[1]; s1.stripPrefix("_"); @@ -917,8 +916,8 @@ const ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) for (const auto &citer : *Doxygen::classLinkedMap) { QCString jj=citer->name(); - QCStringList ql=QCStringList::split(":",jj); - if (ql.count()>1) + StringVector ql=split(jj.str(),":"); + if (ql.size()>1) { if (ql[0]==nn ) { @@ -2626,12 +2625,12 @@ void VhdlDocGen::writeRecUnitDocu( QCString largs) { - QCStringList ql=QCStringList::split("#",largs); - uint len=ql.count(); + StringVector ql=split(largs.str(),"#"); + size_t len=ql.size(); ol.startParameterList(TRUE); bool first=TRUE; - for(uint i=0;i<len;i++) + for(size_t i=0;i<len;i++) { QCString n=ql[i]; ol.startParameterType(first,""); @@ -3053,14 +3052,14 @@ void FlowChart::alignCommentNode(std::ostream &t,QCString com) { uint max=0; QCString s; - QCStringList ql=QCStringList::split("\n",com); - for (uint j=0;j<ql.count();j++) + StringVector ql=split(com.str(),"\n"); + for (size_t j=0;j<ql.size();j++) { - s=(QCString)ql[j]; + s=ql[j]; if (max<s.length()) max=s.length(); } - s=ql.last(); + s=ql.back(); int diff=max-s.length(); QCString n(1); @@ -3069,14 +3068,14 @@ void FlowChart::alignCommentNode(std::ostream &t,QCString com) n.fill(' ',2*diff); n.append("."); s+=n; - ql.remove(ql.last()); - ql.append(s); + ql.pop_back(); + ql.push_back(s.str()); } - for (uint j=0;j<ql.count();j++) + for (size_t j=0;j<ql.size();j++) { s=ql[j]; - if (j<ql.count()-1) + if (j<ql.size()-1) { s+="\n"; } diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index ac4e2db..4f68728 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -318,12 +318,13 @@ int VHDLOutlineParser::checkInlineCode(QCString &doc) code = stripLeadingAndTrailingEmptyLines(code, iLine); int val = code.contains('\n'); VhdlDocGen::prepareComment(p->strComment); - QCStringList ql = QCStringList::split('\n', p->strComment); + StringVector ql = split(p->strComment.str(),"\n"); QCString co; QCString na; - for (QCString qcs : ql) + for (const auto &qcs_ : ql) { + QCString qcs = qcs_; qcs = qcs.simplifyWhiteSpace(); if (findRe(qcs,csRe)!=-1) { @@ -521,9 +522,9 @@ void VHDLOutlineParser::addVhdlType(const char *n,int startLine,int section, spec= VhdlDocGen::GENERIC; } - QCStringList ql=QCStringList::split(",",name); + StringVector ql=split(name.str(),","); - for (uint u=0;u<ql.count();u++) + for (size_t u=0;u<ql.size();u++) { s->current->name=ql[u]; s->current->startLine=startLine; @@ -583,11 +584,11 @@ void VHDLOutlineParser::createFunction(const char *imp,uint64 spec,const char *f VhdlDocGen::deleteAllChars(s->current->args,' '); if (!fname.isEmpty()) { - QCStringList q1=QCStringList::split(",",fname); - for (uint ii=0;ii<q1.count();ii++) + StringVector q1=split(fname.str(),","); + for (const auto &name : q1) { Argument arg; - arg.name=q1[ii]; + arg.name=name; s->current->argList.push_back(arg); } } @@ -630,12 +631,12 @@ void VHDLOutlineParser::addProto(const char *s1,const char *s2,const char *s3, VhdlParser::SharedState *s = &p->shared; (void)s5; // avoid unused warning QCString name=s2; - QCStringList ql=QCStringList::split(",",name); + StringVector ql=split(name.str(),","); - for (uint u=0;u<ql.count();u++) + for (const auto &n : ql) { Argument arg; - arg.name=ql[u]; + arg.name=n; if (s3) { arg.type=s3; diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index 249842e..01316a7 100755 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -4,7 +4,6 @@ #include <vector> #include <memory> #include <string> -#include <qcstringlist.h> #include "parserintf.h" #include <stdio.h> @@ -16,6 +15,7 @@ #include "entry.h" #include "vhdldocgen.h" #include "config.h" +#include "util.h" enum { GEN_SEC=0x1, PARAM_SEC,CONTEXT_SEC,PROTECTED_SEC } ; //void parserVhdlfile(const char* inputBuffer); |