summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 12:33:07 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 12:33:07 +0900
commit15e5c5601a13a41757e2a5e1a9105d1714d40215 (patch)
treeb3d78685874664026425debdf3298c29c8eb5dda /src/util.cpp
parent558fa54c62ec59357cb5c40a411f16f1c1754f33 (diff)
downloaddoxygen-15e5c5601a13a41757e2a5e1a9105d1714d40215.tar.gz
doxygen-15e5c5601a13a41757e2a5e1a9105d1714d40215.tar.bz2
doxygen-15e5c5601a13a41757e2a5e1a9105d1714d40215.zip
Imported Upstream version 1.9.3upstream/1.9.3
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp64
1 files changed, 35 insertions, 29 deletions
diff --git a/src/util.cpp b/src/util.cpp
index cab6530..9d9cc41 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -166,7 +166,7 @@ const int maxInheritanceDepth = 100000;
QCString removeAnonymousScopes(const QCString &str)
{
std::string result;
- if (str.isEmpty()) return result;
+ if (str.isEmpty()) return QCString(result);
// helper to check if the found delimiter starts with a colon
auto startsWithColon = [](const std::string &del)
@@ -227,7 +227,7 @@ QCString replaceAnonymousScopes(const QCString &s,const QCString &replacement)
std::string result = reg::replace(s.str(),marker,
replacement.isEmpty() ? replacement.data() : "__anonymous__");
//printf("replaceAnonymousScopes('%s')='%s'\n",qPrint(s),qPrint(result));
- return result;
+ return QCString(result);
}
@@ -889,12 +889,12 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
bool keepSpaces,int indentLevel)
{
if (text.isEmpty()) return;
- //printf("linkify='%s'\n",text);
+ //printf("linkify='%s'\n",qPrint(text));
std::string txtStr=text.str();
size_t strLen = txtStr.length();
if (strLen==0) return;
- static const reg::Ex regExp(R"(\a[\w~!\\.:$]*)");
+ static const reg::Ex regExp(R"((::)?\a[\w~!\\.:$]*)");
reg::Iterator it(txtStr,regExp);
reg::Iterator end;
@@ -1204,14 +1204,6 @@ QCString tempArgListToString(const ArgumentList &al,SrcLangExt lang,bool include
if (!first) result+=", ";
if (!a.name.isEmpty()) // add template argument name
{
- if (a.type.left(4)=="out") // C# covariance
- {
- result+="out ";
- }
- else if (a.type.left(3)=="in") // C# contravariance
- {
- result+="in ";
- }
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
result+=a.type+" ";
@@ -1412,7 +1404,7 @@ QCString fileToString(const QCString &name,bool filter,bool isSourceCode)
{
contents+=line+'\n';
}
- return contents;
+ return QCString(contents);
}
else // read from file
{
@@ -4004,7 +3996,7 @@ QCString convertToXML(const QCString &s, bool keepEntities)
}
/*! Converts a string to an DocBook-encoded string */
-QCString convertToDocBook(const QCString &s)
+QCString convertToDocBook(const QCString &s, const bool retainNewline)
{
if (s.isEmpty()) return s;
GrowBuf growBuf;
@@ -4016,6 +4008,7 @@ QCString convertToDocBook(const QCString &s)
{
switch (c)
{
+ case '\n': if (retainNewline) growBuf.addStr("<literallayout>&#160;&#xa;</literallayout>"); growBuf.addChar(c); break;
case '<': growBuf.addStr("&lt;"); break;
case '>': growBuf.addStr("&gt;"); break;
case '&': // possibility to have a special symbol
@@ -4407,13 +4400,13 @@ int extractClassNameFromType(const QCString &type,int &pos,QCString &name,QCStri
pos=i+l;
}
//printf("extractClassNameFromType([in] type=%s,[out] pos=%d,[out] name=%s,[out] templ=%s)=TRUE i=%d\n",
- // type,pos,qPrint(name),qPrint(templSpec),i);
+ // qPrint(type),pos,qPrint(name),qPrint(templSpec),i);
return i;
}
}
pos = typeLen;
//printf("extractClassNameFromType([in] type=%s,[out] pos=%d,[out] name=%s,[out] templ=%s)=FALSE\n",
- // type,pos,qPrint(name),qPrint(templSpec));
+ // qPrint(type),pos,qPrint(name),qPrint(templSpec));
return -1;
}
@@ -4428,7 +4421,7 @@ QCString normalizeNonTemplateArgumentsInString(
p++;
QCString result = name.left(p);
- std::string s = result.mid(p).str();
+ std::string s = name.mid(p).str();
static const reg::Ex re(R"([\a:][\w:]*)");
reg::Iterator it(s,re);
reg::Iterator end;
@@ -4488,7 +4481,7 @@ QCString substituteTemplateArgumentsInString(
const std::unique_ptr<ArgumentList> &actualArgs)
{
//printf("substituteTemplateArgumentsInString(name=%s formal=%s actualArg=%s)\n",
- // qPrint(name),qPrint(argListToString(formalArgs)),qPrint(argListToString(actualArgs)));
+ // qPrint(nm),qPrint(argListToString(formalArgs)),actualArgs ? qPrint(argListToString(*actualArgs)): "");
if (formalArgs.empty()) return nm;
QCString result;
@@ -4793,10 +4786,6 @@ PageDef *addRelatedPage(const QCString &name,const QCString &ptitle,
pd->setRefItems(sli);
newPage = false;
}
- else if (pd) // we are from a tag file
- {
- Doxygen::pageLinkedMap->del(name);
- }
if (newPage) // new page
{
@@ -4807,9 +4796,21 @@ PageDef *addRelatedPage(const QCString &name,const QCString &ptitle,
baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length());
//printf("Appending page '%s'\n",qPrint(baseName));
- pd = Doxygen::pageLinkedMap->add(baseName,
- std::unique_ptr<PageDef>(
- createPageDef(fileName,docLine,baseName,doc,title)));
+ if (pd) // replace existing page
+ {
+ pd->setDocumentation(doc,fileName,docLine);
+ pd->setFileName(::convertNameToFile(baseName,FALSE,TRUE));
+ pd->setShowLineNo(FALSE);
+ pd->setNestingLevel(0);
+ pd->setPageScope(0);
+ pd->setTitle(title);
+ }
+ else // newPage
+ {
+ pd = Doxygen::pageLinkedMap->add(baseName,
+ std::unique_ptr<PageDef>(
+ createPageDef(fileName,docLine,baseName,doc,title)));
+ }
pd->setBodySegment(startLine,startLine,-1);
pd->setRefItems(sli);
@@ -4932,7 +4933,7 @@ void addGroupListToTitle(OutputList &ol,const Definition *d)
}
void filterLatexString(TextStream &t,const QCString &str,
- bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces)
+ bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces, const bool retainNewline)
{
if (str.isEmpty()) return;
//if (strlen(str)<2) stackTrace();
@@ -4971,6 +4972,8 @@ void filterLatexString(TextStream &t,const QCString &str,
case '-': t << "-\\/"; break;
case '^': insideTable ? t << "\\string^" : t << (char)c; break;
case '~': t << "\\string~"; break;
+ case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
+ break;
case ' ': if (keepSpaces) t << "~"; else t << ' ';
break;
default:
@@ -5058,6 +5061,8 @@ void filterLatexString(TextStream &t,const QCString &str,
break;
case '\'': t << "\\textquotesingle{}";
break;
+ case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
+ break;
case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
break;
@@ -6269,7 +6274,7 @@ QCString filterTitle(const QCString &title)
p=i+l;
}
tf+=t.substr(p);
- return tf;
+ return QCString(tf);
}
//----------------------------------------------------------------------------
@@ -6430,7 +6435,7 @@ QCString replaceColorMarkers(const QCString &str)
p=i+l;
}
if (p<sl) result+=s.substr(p);
- return result;
+ return QCString(result);
}
/** Copies the contents of file with name \a src to the newly created
@@ -7031,7 +7036,7 @@ bool mainPageHasTitle()
QCString getDotImageExtension()
{
- QCString imgExt = Config_getEnum(DOT_IMAGE_FORMAT);
+ QCString imgExt = Config_getEnumAsString(DOT_IMAGE_FORMAT);
int i= imgExt.find(':'); // strip renderer part when using e.g. 'png:cairo:gd' as format
return i==-1 ? imgExt : imgExt.left(i);
}
@@ -7381,3 +7386,4 @@ QCString integerToRoman(int n, bool upper)
return result;
}
+