27#include <unordered_set>
65#define ENABLE_TRACINGSUPPORT 0
67#if defined(__APPLE__) && ENABLE_TRACINGSUPPORT
78#define REL_PATH_TO_ROOT "../../"
80static const char *
hex =
"0123456789ABCDEF";
101 if (str.
empty())
return result;
104 auto startsWithColon = [](
const std::string &del)
106 for (
size_t i=0;i<del.size();i++)
108 if (del[i]==
'@')
return false;
109 else if (del[i]==
':')
return true;
115 auto endsWithColon = [](
const std::string &del)
117 for (
int i=
static_cast<int>(del.size())-1;i>=0;i--)
119 if (del[i]==
'@')
return false;
120 else if (del[i]==
':')
return true;
125 static const reg::Ex re(R
"([\s:]*@\d+[\s:]*)");
126 std::string s = str.str();
130 size_t sl=s.length();
131 bool needsSeparator=
false;
132 for ( ; iter!=
end ; ++iter)
134 const auto &match = *iter;
135 size_t i = match.position();
138 if (needsSeparator) result+=
"::";
139 needsSeparator=
false;
140 result+=s.substr(p,i-p);
142 std::string delim = match.str();
143 needsSeparator = needsSeparator || (startsWithColon(delim) && endsWithColon(delim));
144 p = match.position()+match.length();
148 if (needsSeparator) result+=
"::";
157 if (s.
empty())
return s;
158 static const reg::Ex marker(R
"(@\d+)");
160 !replacement.empty() ? replacement.data() : "__anonymous__");
171 int sl =
static_cast<int>(s.
length());
179 if (!newScope.
empty()) newScope+=
"::";
180 newScope+=s.
mid(i,l);
185 if (!newScope.
empty()) newScope+=
"::";
186 newScope+=s.
right(sl-i);
202 for (
const auto &s : l)
205 if (
prefix.length() > length &&
212 if (length>0)
return potential;
235 AUTO_TRACE(
"context='{}' qualifiedName='{}'",context?context->
name():
"",qualifiedName);
237 if (qualifiedName.
empty())
244 if (typedefContext) *typedefContext=context;
252 size_t scopeIndex = qualifiedName.
rfind(
"::");
256 resName=qualifiedName.
mid(scopeIndex+2);
264 while (mContext && md==
nullptr)
271 DString resScopeName = qualifiedName.
left(scopeIndex);
278 DString qualScopePart = resScopeName.
mid(is,l);
280 if (!tmp.
empty()) qualScopePart=tmp;
283 if (resScope==
nullptr)
break;
295 bool searchRelated=
false;
296 bool mustBeRelated=
false;
307 if (mn==0 && searchRelated)
315 for (
const auto &tmd_p : *mn)
318 AUTO_TRACE_ADD(
"found candidate member '{}' isTypeDef={}' isRelated={} mustBeRelated={}",
333 if (dist!=-1 && (md==
nullptr || dist<minDist))
379static const char constScope[] = {
'c',
'o',
'n',
's',
't',
':' };
380static const char volatileScope[] = {
'v',
'o',
'l',
'a',
't',
'i',
'l',
'e',
':' };
381static const char virtualScope[] = {
'v',
'i',
'r',
't',
'u',
'a',
'l',
':' };
382static const char operatorScope[] = {
'o',
'p',
'e',
'r',
'a',
't',
'o',
'r',
'?',
'?',
'?' };
383static const char staticScope[] = {
's',
't',
'a',
't',
'i',
'c',
' ' };
389 charMap[
static_cast<int>(
'(')].before=
false;
390 charMap[
static_cast<int>(
'=')].before=
false;
391 charMap[
static_cast<int>(
'&')].before=
false;
392 charMap[
static_cast<int>(
'*')].before=
false;
393 charMap[
static_cast<int>(
'[')].before=
false;
394 charMap[
static_cast<int>(
'|')].before=
false;
395 charMap[
static_cast<int>(
'+')].before=
false;
396 charMap[
static_cast<int>(
';')].before=
false;
397 charMap[
static_cast<int>(
':')].before=
false;
398 charMap[
static_cast<int>(
'/')].before=
false;
400 charMap[
static_cast<int>(
'=')].after=
false;
401 charMap[
static_cast<int>(
' ')].after=
false;
402 charMap[
static_cast<int>(
'[')].after=
false;
403 charMap[
static_cast<int>(
']')].after=
false;
404 charMap[
static_cast<int>(
'\t')].after=
false;
405 charMap[
static_cast<int>(
'\n')].after=
false;
406 charMap[
static_cast<int>(
')')].after=
false;
407 charMap[
static_cast<int>(
',')].after=
false;
408 charMap[
static_cast<int>(
'<')].after=
false;
409 charMap[
static_cast<int>(
'|')].after=
false;
410 charMap[
static_cast<int>(
'+')].after=
false;
411 charMap[
static_cast<int>(
'(')].after=
false;
412 charMap[
static_cast<int>(
'/')].after=
false;
438 if (s.
length()*3+1 > growBuf.size())
440 growBuf.resize(s.
length()*3+1);
443 const char *src=s.
data();
444 char *dst=growBuf.data();
455 while (i<l && isspace(
static_cast<uint8_t
>(src[i])))
462 char nc=i+1<l ? src[i+1] :
' ';
464 auto searchForKeyword = [&](
const char *kw,
size_t &matchLen,
size_t totalLen)
466 if (matchLen<=totalLen && c==kw[matchLen] &&
502 if (c==
'\\' && i+1<l)
526 if (i>0 && !isspace(
static_cast<uint8_t
>(pc)) &&
527 (
isId(pc) || pc==
'*' || pc==
'&' || pc==
'.' || pc==
'>') &&
528 (osp<8 || (osp==8 && pc!=
'-'))
534 if (i+1<l && (nc==
'-' || nc==
'&'))
541 if (i>0 && !isspace(
static_cast<uint8_t
>(pc)) &&
542 ((i+1<l && (
isId(nc) || nc==
'[')) ||
543 (i+2<l && nc==
'$' &&
isId(src[i+2])) ||
544 (i+3<l && nc==
'&' && src[i+2]==
'$' &&
isId(src[i+3]))
554 if (cliSupport && i+1<l && (
isId(nc) || nc==
'-'))
561 if (i+1<l && (
isId(nc) || nc==
'-'))
567 if (i>0 && pc!=
' ' && pc!=
'\t' && pc!=
':' &&
568 pc!=
'*' && pc!=
'&' && pc!=
'(' && pc!=
'/' && pc!=
'[' &&
578 if (i>0 &&
isId(pc) && osp<9)
598 if (i>0 && i+1<l && pc!=
'=' && pc!=
':' && !isspace(
static_cast<uint8_t
>(pc)) &&
629 !(pc==
',' && nc==
'.') &&
630 (osp<8 || (osp>=8 &&
isId(pc) &&
isId(nc)))
638 else if (ssp==7 && nc==
'(')
643 else if ((pc==
'*' || pc==
'&' || pc==
'.') && nc==
'>')
651 auto correctKeywordAllowedInsideScope = [&](
char cc,
size_t &matchLen,
size_t totalLen) {
652 if (c==cc && matchLen==totalLen)
654 if ((i+2<l && src[i+1] ==
':' && src[i+2] ==
':') ||
655 ((i>matchLen && src[i-matchLen] ==
':' && src[i-matchLen-1] ==
':'))
659 correctKeywordAllowedInsideScope(
't',csp, 5);
660 correctKeywordAllowedInsideScope(
'e',vosp,8);
661 correctKeywordAllowedInsideScope(
'l',vsp, 7);
663 auto correctKeywordNotPartOfScope = [&](
char cc,
size_t &matchLen,
size_t totalLen)
665 if (c==cc && matchLen==totalLen && i+1<l &&
673 correctKeywordNotPartOfScope(
't',csp, 5);
674 correctKeywordNotPartOfScope(
'e',vosp,8);
675 correctKeywordNotPartOfScope(
'l',vsp, 7);
682 return growBuf.data();
695 if (templateDepth > 0)
697 size_t nextOpenPos = name.rfind(
'>', pos);
698 size_t nextClosePos = name.rfind(
'<', pos);
716 size_t lastAnglePos = name.rfind(
'>', pos);
717 size_t bracePos = name.rfind(
'(', pos);
725 size_t bp = bracePos>0 ? name.rfind(
'(',bracePos-1) :
DString::npos;
727 return bp==
DString::npos || (bp>=8 && name.mid(bp-8,10)==
"operator()") ? bracePos : bp;
737 size_t nl=name.length();
738 return (name==scope ||
739 (scope.
right(nl)==name &&
740 sl>1+nl && scope.
at(sl-nl-1)==
':' && scope.
at(sl-nl-2)==
':'
748 size_t nl=name.length();
749 return (name==scope ||
750 (name.left(sl)==scope &&
751 nl>sl+1 && name.at(sl)==
':' && name.at(sl+1)==
':'
759 std::function<
void(
size_t)> replaceFunc)
761 static const reg::Ex marker(R
"(@(\d+))");
765 for ( ; it!=
end ; ++it)
767 const auto &match = *it;
768 size_t newIndex = match.position();
769 size_t matchLen = match.length();
770 ol.
parseText(markerText.substr(index,newIndex-index));
771 unsigned long entryIndex = std::stoul(match[1].str());
772 if (entryIndex<
static_cast<unsigned long>(numMarkers))
774 replaceFunc(entryIndex);
776 index=newIndex+matchLen;
782 std::function<
DString(
size_t)> replaceFunc)
785 static const reg::Ex marker(R
"(@(\d+))");
789 for ( ; it!=
end ; ++it)
791 const auto &match = *it;
792 size_t newIndex = match.position();
793 size_t matchLen = match.length();
794 result += markerText.
substr(index,newIndex-index);
795 unsigned long entryIndex = std::stoul(match[1].str());
796 if (entryIndex<
static_cast<unsigned long>(numMarkers))
798 result+=replaceFunc(entryIndex);
800 index=newIndex+matchLen;
802 if (index<markerText.size())
804 result += markerText.
substr(index);
811 auto replaceFunc = [&list,&ol](
size_t entryIndex)
813 const auto &e = list[entryIndex];
848 paramDocs+=
" \\ilinebr @tparam "+a.name+
" "+a.docs;
850 else if (!a.type.empty())
856 paramDocs+=
" \\ilinebr @tparam "+type+
" "+a.docs;
869 for (
auto it = al.
begin() ; it!=al.
end() ;)
889 result+= type1+type2;
896 if (it!=al.
end()) result+=
", ";
911 if (al.
empty())
return result;
914 for (
const auto &a : al)
916 if (a.defval.empty() || includeDefault)
918 if (!first) result+=
", ";
921 if (lang==SrcLangExt::Java || lang==SrcLangExt::CSharp)
929 int i =
static_cast<int>(a.type.length())-1;
930 while (i>=0 &&
isId(a.type.at(i))) i--;
933 result+=a.type.
right(a.type.length()-i-1);
944 if (!a.typeConstraint.empty() && lang==SrcLangExt::Java)
947 result+=a.typeConstraint;
968 size_t len = contents.length();
972 char c = contents[src++];
976 if (src<len && contents[src] ==
'\n')
981 else if ( c ==
'\0' && src<len-1)
985 contents[dest++] = c;
987 contents.resize(dest);
994 for (
const auto &filterStr : filterList)
1003 filterPattern = filterPattern.
lower();
1004 input = input.
lower();
1013 filterName=
"\""+filterName+
"\"";
1028 if (name.empty())
return "";
1035 if (isSourceCode && !filterSrcList.empty())
1039 if (!found && filterName.
empty())
1050 if (filterName.
length()>=2 && filterName[0]==
'"' && filterName[
static_cast<int>(filterName.
length())-1]==
'"')
1052 filterName = filterName.
mid(1,filterName.
length()-2);
1060 if (name.empty())
return DString();
1061 bool fileOpened=
false;
1062 if (name[0]==
'-' && name[1]==0)
1064 std::string contents;
1066 while (getline(std::cin,line))
1068 contents+=line+
'\n';
1077 err(
"file '{}' not found\n",name);
1090 err(
"cannot open file '{}' for reading\n",name);
1098 for (
const auto &bcd : bcl)
1118 AUTO_TRACE(
"target='{}' str='{}'",target,str);
1119 if (target==str) { target.
clear();
return; }
1126 for (
size_t q=p;q<i;q++)
1128 if (target[q]==
'<') sharpCount++;
1129 else if (target[q]==
'>' && sharpCount>0) sharpCount--;
1131 bool isMatch = (i==0 || !
isId(target.
at(i-1))) &&
1133 !insideTemplate && sharpCount==0;
1136 size_t i1=target.
find(
'*',i+l);
1137 size_t i2=target.
find(
'&',i+l);
1141 target=target.
left(i)+target.
mid(i+l);
1148 target=str+
" "+target.
left(i)+target.
mid(i+l);
1188 size_t i=s.
find(
" class ");
1190 i=s.
find(
" typename ");
1192 i=s.
find(
" union ");
1194 i=s.
find(
" struct ");
1196 i=s.
find(
" record ");
1210 if (!templSpec.
empty() && templSpec.
at(0) ==
'<')
1215 if (!resolvedType.
empty())
1217 templSpec = resolvedType;
1229 if (count>10)
return word;
1231 DString symName,result,templSpec,tmpName;
1232 if (tSpec && !tSpec->
empty())
1235 AUTO_TRACE(
"d='{}' fs='{}' word='{}' templSpec='{}'",d?d->
name():
"",fs?fs->
name():
"",word,templSpec);
1253 bool isTemplInst = cd && !templSpec.
empty();
1254 if (!cd && !templSpec.
empty())
1265 cd?cd->
name():
"",mType?mType->
name():
"",ts,resolvedType);
1288 if (cd==d && tSpec) *tSpec=
"";
1292 result = resolvedType+ts;
1300 if (tSpec) *tSpec=
"";
1312 if (!templSpec.
empty())
1314 result=cd->
name()+templSpec;
1364 resolvedType = lang==SrcLangExt::Java ? word :
resolveTypeDef(d,word);
1366 if (resolvedType.
empty())
1372 result = resolvedType;
1408 if (i-pp>=2 && type[i-2]==
':' && type[i-1]==
':')
1410 canType += type.
mid(pp,i-pp-2);
1414 canType += type.
mid(pp,i-pp);
1423 if (ct.
empty() && type.
mid(p,2)==
"::")
1433 if (!templSpec.
empty())
1437 std::string ts = templSpec.
str();
1438 static const reg::Ex re(R
"(\a\w*)");
1445 for (; it!=
end ; ++it)
1447 const auto &match = *it;
1448 size_t ti = match.position();
1449 size_t tl = match.length();
1450 std::string matchStr = match.str();
1451 canType += ts.
substr(tp,ti-tp);
1460 canType += type.
mid(pp);
1471 if ((type==
"const" || type==
"volatile") && !name.empty())
1476 if (name==
"const" || name==
"volatile")
1478 if (!type.
empty()) type+=
" ";
1496#define MATCH AUTO_TRACE_EXIT("match at line {}",__LINE__);
1497#define NOMATCH AUTO_TRACE_EXIT("no match at line {}",__LINE__);
1504 AUTO_TRACE(
"srcType='{}' dstType='{}'",srcType,dstType);
1505 if (srcType==dstType)
return true;
1508 size_t i1=srcType.
find(
")(");
1510 size_t i2=dstType.
find(
")(");
1511 if (i1!=i2)
return false;
1514 size_t j1=srcType.
find(
"(");
1516 size_t j2=dstType.
find(
"(");
1517 if (j2!=j1)
return false;
1518 if (srcType.
left(j1)!=dstType.
left(j2))
return false;
1527 dstScope,dstFileScope,dstType.
left(j2),dstAl.get(),
1538 static const reg::Ex re(R
"(\a[\w:]*)");
1539 std::string src = srcType.str();
1540 std::string dst = dstType.str();
1542 size_t srcPos=0, dstPos=0;
1543 for (; srcIt!=
end && dstIt!=
end; ++srcIt,++dstIt)
1545 const auto &srcMatch=*srcIt;
1546 const auto &dstMatch=*dstIt;
1547 if (src.substr(srcPos,srcMatch.position()-srcPos)!=dst.substr(dstPos,dstMatch.position()-dstPos))
return false;
1550 if (srcWord!=dstWord)
1558 fileScope=srcFileScope;
1559 unqualified=srcWord;
1564 fileScope=dstFileScope;
1565 unqualified=dstWord;
1573 if (cd || resolver.
getTypedef())
return false;
1575 srcPos=srcMatch.position()+srcMatch.length();
1576 dstPos=dstMatch.position()+dstMatch.length();
1578 return srcIt==
end && dstIt==
end && src.substr(srcPos)==dst.substr(dstPos);
1587 AUTO_TRACE(
"src: scope={} type={} name={} canType={}, dst: scope={} type={} name={} canType={}",
1606 srcA.
type+=sSrcName;
1610 else if (sDstName==srcType.
right(sDstName.
length()))
1612 dstA.
type+=sDstName;
1628 dstScope,dstFileScope,dstA.
canType,
1631 dstScope,dstFileScope,dstA.
canType)))
1651 bool checkCV,
SrcLangExt lang,
bool allowUnresolved)
1653 ASSERT(srcScope!=
nullptr && dstScope!=
nullptr);
1655 AUTO_TRACE(
"srcScope='{}' dstScope='{}' srcArgs='{}' dstArgs='{}' checkCV={} lang={}",
1658 if (srcAl==
nullptr || dstAl==
nullptr)
1660 bool match = srcAl==dstAl;
1691 if (srcAl->
size() != dstAl->
size())
1725 auto srcIt = srcAl->
begin();
1726 auto dstIt = dstAl->
begin();
1727 for (;srcIt!=srcAl->
end() && dstIt!=dstAl->
end();++srcIt,++dstIt)
1732 dstScope,dstFileScope,dstA,
1733 lang,allowUnresolved)
1751 AUTO_TRACE(
"srcAl='{}',dstAl='{}',forceNameOverwrite={}",
1759 auto srcIt=srcAl.
begin();
1760 auto dstIt=dstAl.
begin();
1761 while (srcIt!=srcAl.
end() && dstIt!=dstAl.
end())
1766 AUTO_TRACE_ADD(
"before merge: src=[type='{}',name='{}',def='{}'] dst=[type='{}',name='{}',def='{}']",
1782 if (srcA.
name==
"const" || srcA.
name==
"volatile")
1787 if (dstA.
name==
"const" || dstA.
name==
"volatile")
1813 if (forceNameOverwrite)
1885 AUTO_TRACE_ADD(
"after merge: src=[type='{}',name='{}',def='{}'] dst=[type='{}',name='{}',def='{}']",
1901 auto isUnconstraintTemplate = [](
const DString &type)
1903 return type==
"typename" || type==
"class" || type.startsWith(
"typename ") || type.startsWith(
"class ");
1905 auto srcIt = srcAl.
begin();
1906 auto dstIt = dstAl.
begin();
1907 while (srcIt!=srcAl.
end() && dstIt!=dstAl.
end())
1911 if ((!isUnconstraintTemplate(srcA.
type) || !isUnconstraintTemplate(dstA.
type)) && srcA.
type!=dstA.
type)
1930 AUTO_TRACE(
"scopeName={},memberName={},forceEmptyScope={}",
1957 size_t qualifierIndex=memberName.
rfind(
"::");
1960 explicitFile=memberName.
left(qualifierIndex);
1961 memberName=memberName.
mid(qualifierIndex+2);
1962 std::string normalized=explicitFile.
str();
1963 for (
size_t i=0; i+1<normalized.size(); )
1965 if (normalized[i]==
':' && normalized[i+1]==
':')
1967 normalized.replace(i,2,
".");
1975 explicitFile=normalized.
c_str();
1986 if (!mdFile)
continue;
1987 if (!explicitFile.
empty())
1990 if (fileName!=explicitFile &&
1991 !fileName.
endsWith(
"/"+explicitFile) &&
1992 !fileName.
endsWith(
"\\"+explicitFile))
1999 if (explicitFile.
empty())
2006 if (uniqueStatic && uniqueStatic!=md)
2008 uniqueStatic=
nullptr;
2016 symbol=uniqueStatic;
2027 result.
found =
true;
2032 result.
found =
true;
2037 result.
found =
true;
2042 result.
found =
true;
2047 result.
found =
true;
2077 if (scopeName.
empty())
return false;
2079 bool explicitGlobalScope=
false;
2080 if (scopeName.
at(0)==
':' && scopeName.
at(1)==
':')
2082 scopeName=scopeName.
mid(2);
2083 explicitGlobalScope=
true;
2085 if (scopeName.
empty())
2090 DString docScopeName=docScope;
2091 int scopeOffset=explicitGlobalScope ? 0 :
static_cast<int>(docScopeName.
length());
2096 if (scopeOffset>0) fullName.
prepend(docScopeName.
left(scopeOffset)+
"::");
2122 size_t o = docScopeName.
rfind(
"::",scopeOffset-1);
2125 }
while (scopeOffset>=0);
2132 if (s.
empty())
return true;
2133 const char *p=s.
data();
2135 while ((c=
static_cast<uint8_t
>(*p++)))
if (!islower(c))
return false;
2145 bool lookForSpecialization,
2150 AUTO_TRACE(
"scope={} name={} inSeeBlock={} lang={} lookForSpecialization={} currentFile={} checkScope={}",
2151 scName,name,inSeeBlock,lang,lookForSpecialization,currentFile ? currentFile->
name() :
"", checkScope);
2165 size_t templStartPos;
2166 if (lang==SrcLangExt::CSharp && (templStartPos=fullName.
find(
'<'))!=
DString::npos)
2168 size_t templEndPos = fullName.
rfind(
'>');
2178 size_t scopePos = fullName.
rfind(
"::",endNamePos);
2179 bool explicitScope = fullName.
startsWith(
"::") &&
2184 bool allowTypeOnly=
false;
2187 *resContext=
nullptr;
2208 if (scName!=fullName &&
getScopeDefs(scName,fullName,cd,cnd,nd,modd))
2231 else if (scName==fullName || (!inSeeBlock && scopePos==
DString::npos))
2250 if (explicitScope) nameStr=nameStr.
mid(2);
2259 size_t templPos = nameStr.
find(
'<');
2260 bool tryUnspecializedVersion =
false;
2263 size_t endTemplPos=nameStr.
rfind(
'>');
2266 if (!lookForSpecialization)
2268 nameStr=nameStr.
left(templPos)+nameStr.
mid(endTemplPos+1);
2272 tryUnspecializedVersion =
true;
2280 nameStr=nameStr.
mid(scopeStr.
length()+2);
2298 size_t np = nameStr.
find(
"::");
2307 *resContext=
nullptr;
2317 *resMember=result.
md;
2318 *resContext=result.
md;
2322 *resContext=
nullptr;
2328 else if (result.
cd) *resContext=result.
cd;
2329 else if (result.
nd) *resContext=result.
nd;
2330 else if (result.
fd) *resContext=result.
fd;
2331 else if (result.
gd) *resContext=result.
gd;
2332 else if (result.
cnd) *resContext=result.
cnd;
2333 else if (result.
modd) *resContext=result.
modd;
2336 *resContext=
nullptr; *resMember=
nullptr;
2375 if (tryUnspecializedVersion)
2377 bool b =
resolveRef(scName,name,inSeeBlock,resContext,resMember,lang,
false,
nullptr,checkScope);
2400 if (!result.
empty())
2407 if (result.
at(0)==
':' && result.
at(1)==
':')
2409 result=result.
mid(2);
2428 for (
const auto &path : stripPaths)
2449 *resContext=
nullptr;
2452 if (lang==SrcLangExt::CSharp)
2457 AUTO_TRACE(
"scName='{}',ref='{}'",scName,lr);
2462 const DirDef *dir =
nullptr;
2468 if (linkRef.
empty())
2480 if (si) resAnchor = si->
label();
2492 resAnchor = si->
label();
2499 resAnchor = si->
label();
2529 else if (lang==SrcLangExt::Java &&
2530 (cd=
getClass(linkRefWithoutTemplates)))
2537 else if ((cd=
getClass(linkRef+
"-p")))
2554 resAnchor=modd->
anchor();
2573 bool res =
resolveRef(scName,lr,
true,resContext,&md,lang,
true,currentFile);
2574 if (md) resAnchor=md->
anchor();
2600 for (
const auto &s : examplePathList)
2628 std::string substRes;
2630 const char *p = s.
data();
2634 substRes.reserve(s.
length()+1024);
2641 for (
const auto &kw : keywords)
2643 size_t keyLen =
dstrlen(kw.keyword);
2644 if (
dstrncmp(p,kw.keyword,keyLen)==0)
2646 const char *startArg = p+keyLen;
2647 bool expectParam = std::holds_alternative<KeywordSubstitution::GetValueWithParam>(kw.getValueVariant);
2649 if (expectParam && *startArg==
'(')
2652 const char *endArg =
nullptr;
2653 while ((c=*(startArg+j)) && c!=
')' && c!=
'\n' && c!=0) j++;
2654 if (c==
')') endArg=startArg+j;
2658 auto &&getValue = std::get<KeywordSubstitution::GetValueWithParam>(kw.getValueVariant);
2659 substRes+=getValue(value).str();
2666 warn(file,line,
"Missing argument for '{}'",kw.keyword);
2670 else if (!expectParam)
2672 auto &&getValue = std::get<KeywordSubstitution::GetValue>(kw.getValueVariant);
2673 substRes+=getValue().str();
2680 warn(file,line,
"Expected arguments for '{}' but none were specified",kw.keyword);
2690 if (c==
'\n') line++;
2715 if (!projectLogo.
empty())
2720 projectLogo = projectLogo.
left(wi);
2724 projectLogo = projectLogo.
left(hi);
2735 if (!projectLogo.
empty())
2737 auto extractDimension = [&projectLogo](
const char *startMarker,
size_t startPos,
size_t endPos) ->
DString
2740 if (result.
length()>=2 && result.
at(0)!=
'"' && result.
at(result.
length()-1)!=
'"')
2742 result=
"\""+result+
"\"";
2748 size_t wi = projectLogo.
find(
" width=");
2749 size_t hi = projectLogo.
find(
" height=");
2754 sizeVal = extractDimension(
" width=", wi+7, hi) +
" "
2755 + extractDimension(
" height=", hi+8, projectLogo.
length());
2759 sizeVal = extractDimension(
" height=", hi+8, wi) +
" "
2760 + extractDimension(
" width=", wi+7, projectLogo.
length());
2765 sizeVal = extractDimension(
" width=", wi+7, projectLogo.
length());
2769 sizeVal = extractDimension(
" height=", hi+8, projectLogo.
length());
2785 if (name.empty())
return 0;
2788 for (
const auto &s : sl)
2790 const char *ps=s.c_str();
2791 const char *pd=name.data();
2793 while (*ps!=0 && *pd!=0 && *ps==*pd)
2799 if (*ps==0 && *pd!=0)
2805 if (result<
static_cast<int>(name.length())-1 && name.at(result)==
'[') result++;
2815 if (caseSenseNames == CASE_SENSE_NAMES_t::YES)
return true;
2816 else if (caseSenseNames == CASE_SENSE_NAMES_t::NO)
return false;
2822 if (name.empty())
return name;
2826 result.
reserve(name.length()+8);
2828 const char *p=name.data();
2833 case '_':
if (allowUnderscore) result+=
'_';
else result+=
"__";
break;
2834 case '-': result+=
'-';
break;
2835 case ':': result+=
"_1";
break;
2836 case '/': result+=
"_2";
break;
2837 case '<': result+=
"_3";
break;
2838 case '>': result+=
"_4";
break;
2839 case '*': result+=
"_5";
break;
2840 case '&': result+=
"_6";
break;
2841 case '|': result+=
"_7";
break;
2842 case '.':
if (allowDots) result+=
'.';
else result+=
"_8";
break;
2843 case '!': result+=
"_9";
break;
2844 case ',': result+=
"_00";
break;
2845 case ' ': result+=
"_01";
break;
2846 case '{': result+=
"_02";
break;
2847 case '}': result+=
"_03";
break;
2848 case '?': result+=
"_04";
break;
2849 case '^': result+=
"_05";
break;
2850 case '%': result+=
"_06";
break;
2851 case '(': result+=
"_07";
break;
2852 case ')': result+=
"_08";
break;
2853 case '+': result+=
"_09";
break;
2854 case '=': result+=
"_0a";
break;
2855 case '$': result+=
"_0b";
break;
2856 case '\\': result+=
"_0c";
break;
2857 case '@': result+=
"_0d";
break;
2858 case ']': result+=
"_0e";
break;
2859 case '[': result+=
"_0f";
break;
2860 case '#': result+=
"_0g";
break;
2861 case '"': result+=
"_0h";
break;
2862 case '~': result+=
"_0i";
break;
2863 case '\'': result+=
"_0j";
break;
2864 case ';': result+=
"_0k";
break;
2865 case '`': result+=
"_0l";
break;
2869 bool doEscape =
true;
2870 if (allowUnicodeNames)
2883 unsigned char id =
static_cast<unsigned char>(c);
2892 else if (caseSenseNames || !isupper(c))
2899 result+=
static_cast<char>(tolower(c));
2909 if (s.
empty())
return s;
2913 const char *p = s.
data();
2923 case '_': result+=c; p++;
break;
2924 case '1': result+=
':'; p++;
break;
2925 case '2': result+=
'/'; p++;
break;
2926 case '3': result+=
'<'; p++;
break;
2927 case '4': result+=
'>'; p++;
break;
2928 case '5': result+=
'*'; p++;
break;
2929 case '6': result+=
'&'; p++;
break;
2930 case '7': result+=
'|'; p++;
break;
2931 case '8': result+=
'.'; p++;
break;
2932 case '9': result+=
'!'; p++;
break;
2936 case '0': result+=
','; p+=2;
break;
2937 case '1': result+=
' '; p+=2;
break;
2938 case '2': result+=
'{'; p+=2;
break;
2939 case '3': result+=
'}'; p+=2;
break;
2940 case '4': result+=
'?'; p+=2;
break;
2941 case '5': result+=
'^'; p+=2;
break;
2942 case '6': result+=
'%'; p+=2;
break;
2943 case '7': result+=
'('; p+=2;
break;
2944 case '8': result+=
')'; p+=2;
break;
2945 case '9': result+=
'+'; p+=2;
break;
2946 case 'a': result+=
'='; p+=2;
break;
2947 case 'b': result+=
'$'; p+=2;
break;
2948 case 'c': result+=
'\\'; p+=2;
break;
2949 case 'd': result+=
'@'; p+=2;
break;
2950 case 'e': result+=
']'; p+=2;
break;
2951 case 'f': result+=
'['; p+=2;
break;
2952 case 'g': result+=
'#'; p+=2;
break;
2953 case 'h': result+=
'"'; p+=2;
break;
2954 case 'i': result+=
'~'; p+=2;
break;
2955 case 'j': result+=
'\''; p+=2;
break;
2956 case 'k': result+=
';'; p+=2;
break;
2957 case 'l': result+=
'`'; p+=2;
break;
2964 if (!caseSenseNames && c>=
'a' && c<=
'z')
2966 result+=
static_cast<char>(toupper(*p));
2997 if (name.empty())
return name;
3020 size_t resultLen = result.
length();
3029 int l1Dir=0,l2Dir=0;
3030 int createSubdirsLevel =
Config_getInt(CREATE_SUBDIRS_LEVEL);
3031 int createSubdirsBitmaskL2 = (1<<createSubdirsLevel)-1;
3035 l1Dir = md5_sig[14] & 0xf;
3036 l2Dir = md5_sig[15] & createSubdirsBitmaskL2;
3064 DString absIncFileName = incFileName;
3074 else if (searchIncludes)
3077 for (
const auto &incPath : includePath)
3096 return absIncFileName;
3106 int createSubdirsLevelPow2 = 1 <<
Config_getInt(CREATE_SUBDIRS_LEVEL);
3107 for (
int l1=0; l1<16; l1++)
3113 term(
"Failed to create output directory '{}'\n",subdir);
3115 for (
int l2=0; l2<createSubdirsLevelPow2; l2++)
3118 subsubdir.
sprintf(
"d%x/d%02x",l1,l2);
3121 term(
"Failed to create output directory '{}'\n",subsubdir);
3133 int createSubdirsLevelPow2 = 1 <<
Config_getInt(CREATE_SUBDIRS_LEVEL);
3134 for (
int l1=0;l1<16;l1++)
3138 for (
int l2=0; l2 < createSubdirsLevelPow2; l2++)
3141 subsubdir.
sprintf(
"d%x/d%02x",l1,l2);
3160 bool allowEmptyClass)
3168 namespaceName=nd->
name();
3172 p=
static_cast<int>(clName.
length())-2;
3180 namespaceName=nd->
name();
3181 className=clName.
mid(i+2);
3184 p=
static_cast<int>(i)-2;
3189 className=scopeName;
3190 namespaceName.
clear();
3193 if (className.
empty() && !namespaceName.
empty() && !allowEmptyClass)
3196 className=namespaceName;
3197 namespaceName.
clear();
3203 className = className.
left(className.
length()-2);
3229 result=scope.
left(si) + templ + scope.
mid(si);
3244 int l =
static_cast<int>(result.
length());
3247 bool skipBracket=
false;
3254 while (p>=0 && count>=0)
3256 char c=result.
at(p);
3262 if (p>0 && result.
at(p-1)==
':' && (count==0 || skipBracket))
3264 return result.
right(l-p-1);
3275 if (p>0 && result.
at(p-1)==
'>')
3283 bool foundMatch=
false;
3284 while (p>=0 && !foundMatch)
3296 if (round==0) count++;
3303 if (result.
at(p-1) ==
'<')
3310 foundMatch = count==0;
3325 done = count==0 || skipBracket;
3336 if (s.
empty())
return s;
3339 const char *p = s.
data();
3345 if ((c>=
'0' && c<=
'9') || (c>=
'a' && c<=
'z') || (c>=
'A' && c<=
'Z') || c==
'-')
3347 if (first && c>=
'0' && c<=
'9') result+=
'a';
3353 encChar[1]=
hex[
static_cast<unsigned char>(c)>>4];
3354 encChar[2]=
hex[
static_cast<unsigned char>(c)&0xF];
3366 if (s.
empty())
return s;
3369 const char *p = s.
data();
3375 case '<': result+=
"<";
break;
3376 case '>': result+=
">";
break;
3377 case '&':
if (keepEntities)
3383 if (ce==
';' || (!(
isId(ce) || ce==
'#')))
break;
3389 while (p<e) result+=*p++;
3409 case '\'': result+=
"'";
break;
3410 case '"': result+=
""";
break;
3411 case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
3412 case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
3413 case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
3414 case 27:
case 28:
case 29:
case 30:
case 31:
3416 default: result+=c;
break;
3425 if (s.
empty())
return s;
3428 const char *p=s.
data();
3434 case '<': result+=
"<";
break;
3435 case '>': result+=
">";
break;
3436 case '&':
if (keepEntities)
3442 if (ce==
';' || (!(
isId(ce) || ce==
'#')))
break;
3448 while (p<e) result+=*p++;
3460 case '\'': result+=
"'";
break;
3461 case '"': result+=
""";
break;
3464 uint8_t uc =
static_cast<uint8_t
>(c);
3465 if (uc<32 && !isspace(c))
3469 result+=
hex[uc&0xF];
3485 if (s.
empty())
return s;
3488 const char *p=s.
data();
3494 case '"':
if (!singleQuotes) result+=
"\\\"";
else result+=c;
3496 case '\'':
if (singleQuotes) result+=
"\\\'";
else result+=c;
3498 case '\\':
if (*p==
'u' && *(p+1)==
'{') result+=
"\\";
3499 else result+=
"\\\\";
3501 default: result+=c;
break;
3514 AUTO_TRACE(
"type='{}' pos={} name='{}' lang={}",type,pos,name,lang);
3515 static const reg::Ex re_norm(R
"(\a[\w:]*)");
3516 static const reg::Ex re_fortran(R
"(\a[\w:()=]*)");
3526 size_t typeLen=type.
length();
3529 if (lang == SrcLangExt::Fortran)
3541 std::string s = type.
str();
3547 const auto &match = *it;
3548 size_t i = match.position();
3549 size_t l = match.length();
3554 while (ts<typeLen && type[
static_cast<uint32_t
>(ts)]==
' ') { ts++; tl++; }
3555 if (ts<typeLen && type[
static_cast<uint32_t
>(ts)]==
'<')
3560 while (te<typeLen && brCount!=0)
3562 if (type[
static_cast<uint32_t
>(te)]==
'<')
3564 if (te<typeLen-1 && type[
static_cast<uint32_t
>(te)+1]==
'<') te++;
else brCount++;
3566 if (type[
static_cast<uint32_t
>(te)]==
'>')
3568 if (te<typeLen-1 && type[
static_cast<uint32_t
>(te)+1]==
'>') te++;
else brCount--;
3578 pos=
static_cast<int>(i+l+tl);
3582 pos=
static_cast<int>(i+l);
3587 return static_cast<int>(i);
3590 pos =
static_cast<int>(typeLen);
3603 size_t p=name.find(
'<');
3606 DString result = name.left(p);
3608 std::string s = name.mid(p).str();
3609 static const reg::Ex re(R
"([\a:][\w:]*)");
3614 for (; it!=
end ; ++it)
3616 const auto &match = *it;
3617 size_t i = match.position();
3618 size_t l = match.length();
3619 result += s.
substr(pi,i-pi);
3622 for (
const Argument &formArg : formalArgs)
3624 if (formArg.name == n)
3662 if (formalArgs.
empty())
return nm;
3665 static const reg::Ex re(R
"(\a\w*)");
3666 std::string name = nm.str();
3671 for (; it!=
end ; ++it)
3673 const auto &match = *it;
3674 size_t i = match.position();
3675 size_t l = match.length();
3676 if (i>p) result += name.substr(p,i-p);
3681 actIt = actualArgs->
begin();
3688 for (
auto formIt = formalArgs.
begin();
3689 formIt!=formalArgs.
end() && !found;
3695 if (actualArgs && actIt!=actualArgs->
end())
3702 formArg.
type =
"class";
3707 formArg.
type =
"typename";
3711 formArg.
name +=
"...";
3716 formArg.
name +=
"...";
3723 if (formArg.
name==n && actualArgs && actIt!=actualArgs->
end() && !actArg.
type.
empty())
3730 ii = subst.find(
'<');
3739 bool beforeNonWord = ii==0 || !
isId(subst.at(ii-1));
3740 bool afterNonWord = subst.length()==ii+nameArg.length() || !
isId(subst.at(ii+nameArg.length()));
3741 if (beforeNonWord && afterNonWord)
3745 pp=ii+nameArg.length();
3750 AUTO_TRACE_ADD(
"result={} n={} type={} hasRecursion={}",result,n,actArg.
type,hasRecursion(result,n,actArg.
type));
3751 if (!hasRecursion(result,n,actArg.
type))
3763 result += actArg.
type;
3769 result += actArg.
type+
" "+actArg.
name;
3774 else if (formArg.
name==n &&
3775 (actualArgs==
nullptr || actIt==actualArgs->
end()) &&
3784 else if (formArg.
name==n &&
3785 (actualArgs==
nullptr || actIt==actualArgs->
end()) &&
3793 if (actualArgs && actIt!=actualArgs->
end())
3804 result+=name.substr(p);
3822 bool allowArtificial)
3825 size_t i=fullName.
find(
'<');
3829 size_t l=fullName.
length();
3836 while (e<l && count>0)
3838 char c=fullName.
at(e++);
3841 case '(': round++;
break;
3842 case ')':
if (round>0) round--;
break;
3843 case '<':
if (round==0) count++;
break;
3844 case '>':
if (round==0) count--;
break;
3849 size_t si = fullName.
find(
"::",e);
3854 result+=fullName.
mid(p,i-p);
3857 if (cd!=
nullptr && (allowArtificial || !cd->
isArtificial()))
3859 result+=fullName.
mid(i,e-i);
3862 else if (pLastScopeStripped)
3865 *pLastScopeStripped=fullName.
mid(i,e-i);
3868 i=fullName.
find(
'<',p);
3870 result+=fullName.
right(l-p);
3887 AUTO_TRACE(
"leftScope='{}' rightScope='{}'",leftScope,rightScope);
3895 size_t i=0,p=leftScope.
length();
3904 result = leftScope.
left(i+2)+rightScope;
3917 if (!result.
empty() && !rightScope.
empty()) result+=
"::";
3932 int sl=
static_cast<int>(s.
length());
3936 if (sp>=sl)
return -1;
3960 while (sp<sl && !done)
3966 case '<': count++;
break;
3967 case '>': count--;
if (count==0) done=
true;
break;
4028 if (!first) { ol.
writeString(
" | "); }
else first=
false;
4040 if (!first) { ol.
writeString(
" | "); }
else first=
false;
4065 if (fName.
empty())
return;
4066 size_t i_fs = fName.
rfind(
'/');
4067 size_t i_bs = fName.
rfind(
'\\');
4070 size_t i = fName.
find(
'.',p);
4097 result=result.
mid(i+1);
4101 result=result.
mid(i+1);
4122 const char *p = s.
data();
4125 int i=0,li=-1,l=
static_cast<int>(s.
length());
4129 if (c==
' ' || c==
'\t' || c==
'\r') { i++; p++; }
4130 else if (c==
'\\' &&
literal_at(p,
"\\ilinebr")) { i+=8; li=i; p+=8; }
4131 else if (c==
'\n') { i++; li=i; docLine++; p++; }
4141 if (c==
' ' || c==
'\t' || c==
'\r') { b--; p--; }
4142 else if (c==
'r' && b>=7 &&
literal_at(p-7,
"\\ilinebr")) { bi=b-7; b-=8; p-=8; }
4143 else if (c==
'>' && b>=11 &&
literal_at(p-11,
"\\ilinebr<br>")) { bi=b-11; b-=12; p-=12; }
4144 else if (c==
'\n') { bi=b; b--; p--; }
4149 if (li==-1 && bi==-1)
return s;
4156 return s.
mid(li,bi-li);
4174 {
"idl",
"c", SrcLangExt::IDL,
".idl" },
4175 {
"java",
"c", SrcLangExt::Java,
".java"},
4176 {
"javascript",
"c", SrcLangExt::JS,
".js" },
4177 {
"csharp",
"c", SrcLangExt::CSharp,
".cs" },
4178 {
"d",
"c", SrcLangExt::D,
".d" },
4179 {
"php",
"c", SrcLangExt::PHP,
".php" },
4180 {
"objective-c",
"c", SrcLangExt::ObjC,
".m" },
4181 {
"c",
"c", SrcLangExt::Cpp,
".c" },
4182 {
"c++",
"c", SrcLangExt::Cpp,
".cpp" },
4183 {
"slice",
"c", SrcLangExt::Slice,
".ice" },
4184 {
"python",
"python", SrcLangExt::Python,
".py" },
4185 {
"fortran",
"fortran", SrcLangExt::Fortran,
".f" },
4186 {
"fortranfree",
"fortranfree", SrcLangExt::Fortran,
".f90" },
4187 {
"fortranfixed",
"fortranfixed", SrcLangExt::Fortran,
".f" },
4188 {
"vhdl",
"vhdl", SrcLangExt::VHDL,
".vhdl"},
4189 {
"xml",
"xml", SrcLangExt::XML,
".xml" },
4190 {
"sql",
"sql", SrcLangExt::SQL,
".sql" },
4191 {
"md",
"md", SrcLangExt::Markdown,
".md" },
4192 {
"lex",
"lex", SrcLangExt::Lex,
".l" },
4199 [&langName](
const auto &info) { return info.langName==langName; });
4205 if (extName.
empty())
return false;
4206 if (extName.
at(0)!=
'.') extName.
prepend(
".");
4216 err(
"Failed to assign extension {} to parser {} for language {}\n",
4217 extName.
data(),it1->parserName,language);
4305 if (extName.
empty()) extName=
".no_extension";
4306 if (extName.
at(0)!=
'.') extName.
prepend(
".");
4322 if (lang == SrcLangExt::Unknown)
4326 if (langName.
at(0)==
'.') langName = langName.
mid(1);
4328 [&langName](
const auto &info) { return info.langName==langName; });
4331 lang = it->parserId;
4332 fileName = it->defExt;
4336 return SrcLangExt::Cpp;
4344 if (fn.
empty())
return "";
4354 if (scope==
nullptr ||
4374 if (qualifierIndex!=-1)
4376 explicitScopePart = name.left(qualifierIndex);
4378 name = name.mid(qualifierIndex+2);
4382 int minDistance = 10000;
4391 if (distance!=-1 && distance<minDistance)
4393 minDistance = distance;
4407 if (bestMatch && bestMatch->
isTypedef())
4417 if (al.
empty())
return;
4434 .setIndexWords(
true));
4444#ifdef TRACINGSUPPORT
4445 void *backtraceFrames[128];
4446 int frameCount = backtrace(backtraceFrames, 128);
4447 const size_t cmdLen = 40960;
4448 static char cmd[cmdLen];
4450 p += snprintf(p,cmdLen,
"/usr/bin/atos -p %d ", (
int)getpid());
4451 for (
int x = 0; x < frameCount; x++)
4453 p += snprintf(p,cmdLen,
"%p ", backtraceFrames[x]);
4455 fprintf(stderr,
"========== STACKTRACE START ==============\n");
4459 while (
size_t len = fread(resBuf, 1,
sizeof(resBuf), fp))
4461 fwrite(resBuf, 1, len, stderr);
4465 fprintf(stderr,
"============ STACKTRACE END ==============\n");
4473 if (inputEncoding.
empty() || outputEncoding.
empty())
return;
4474 if (
dstricmp(inputEncoding,outputEncoding)==0)
return;
4476 if (cd==
reinterpret_cast<void *
>(-1))
4478 term(
"unsupported character conversion: '{}'->'{}': {}\n"
4479 "Check the INPUT_ENCODING setting in the config file!\n",
4480 inputEncoding,outputEncoding,strerror(errno));
4482 size_t iLeft = contents.size();
4483 const char *srcPtr = contents.data();
4484 size_t tmpBufSize = contents.size()*4+1;
4485 size_t oLeft = tmpBufSize;
4487 tmpBuf.resize(tmpBufSize);
4488 char *dstPtr = tmpBuf.data();
4492 newSize = tmpBufSize-oLeft;
4493 tmpBuf.resize(newSize);
4494 std::swap(contents,tmpBuf);
4499 term(
"{}: failed to translate characters from {} to {}: check INPUT_ENCODING\n",
4500 fileName,inputEncoding,outputEncoding);
4510 if (!fi.
exists())
return false;
4517 err(
"could not open file {}\n",fileName);
4521 auto fileSize = fi.
size();
4522 contents.resize(fileSize);
4523 f.read(contents.data(),fileSize);
4526 err(
"problems while reading file {}\n",fileName);
4532 DString cmd=filterName+
" \""+fileName+
"\"";
4537 err(
"could not execute filter {}\n",filterName);
4540 const int bufSize=4096;
4543 while ((numRead=
static_cast<int>(fread(buf,1,bufSize,f)))>0)
4546 contents.append(buf,numRead);
4557 if (contents.size()>=2 &&
4558 static_cast<uint8_t
>(contents[0])==0xFF &&
4559 static_cast<uint8_t
>(contents[1])==0xFE
4564 else if (contents.size()>=2 &&
4565 static_cast<uint8_t
>(contents[0])==0xFE &&
4566 static_cast<uint8_t
>(contents[1])==0xFF
4571 else if (contents.size()>=3 &&
4572 static_cast<uint8_t
>(contents[0])==0xEF &&
4573 static_cast<uint8_t
>(contents[1])==0xBB &&
4574 static_cast<uint8_t
>(contents[2])==0xBF
4577 contents.erase(0,3);
4593 std::string t = title.
str();
4594 static const reg::Ex re(R
"(%[a-z_A-Z]+)");
4598 for (; it!=
end ; ++it)
4600 const auto &match = *it;
4601 size_t i = match.position();
4602 size_t l = match.length();
4603 if (i>p) tf+=t.substr(p,i-p);
4604 tf+=match.str().substr(1);
4630 if (extLinksInWindow)
4631 return "target=\"_blank\" ";
4633 return "target=\"_parent\" ";
4641 const DString &targetFileName,
4649 if (!targetFileName.
empty())
4654 if (!anchor.
empty() && isLocalFile)
4665 if (!anchor.
empty())
4682 result = it->second;
4683 size_t l = result.
length();
4684 if (!relPath.
empty() && l>0 && result.
at(0)==
'.')
4689 if (l>0 && result.
at(l-1)!=
'/') result+=
'/';
4708 std::string s=str.
str();
4709 static const reg::Ex re(R
"(##[0-9A-Fa-f][0-9A-Fa-f])");
4715 size_t sl=s.length();
4717 for (; it!=
end ; ++it)
4719 const auto &match = *it;
4720 size_t i = match.position();
4721 size_t l = match.length();
4722 if (i>p) result+=s.substr(p,i-p);
4723 std::string lumStr = match.str().substr(2);
4724#define HEXTONUM(x) (((x)>='0' && (x)<='9') ? ((x)-'0') : \
4725 ((x)>='a' && (x)<='f') ? ((x)-'a'+10) : \
4726 ((x)>='A' && (x)<='F') ? ((x)-'A'+10) : 0)
4728 double r = 0,g = 0,b = 0;
4731 pow(level/255.0,gamma/100.0),&r,&g,&b);
4732 int red =
static_cast<int>(r*255.0);
4733 int green =
static_cast<int>(g*255.0);
4734 int blue =
static_cast<int>(b*255.0);
4737 colStr[1]=
hex[red>>4];
4738 colStr[2]=
hex[red&0xf];
4739 colStr[3]=
hex[green>>4];
4740 colStr[4]=
hex[green&0xf];
4741 colStr[5]=
hex[blue>>4];
4742 colStr[6]=
hex[blue&0xf];
4748 if (p<sl) result+=s.substr(p);
4759 err(
"could not copy file {} to {}\n",src,dest);
4767 if (lang==SrcLangExt::Java || lang==SrcLangExt::CSharp || lang==SrcLangExt::VHDL || lang==SrcLangExt::Python)
4771 else if (lang==SrcLangExt::PHP && !classScope)
4784 static const std::unordered_set<std::string> schemes = {
4785 "http",
"https",
"ftp",
"ftps",
"sftp",
"file",
"news",
"irc",
"ircs"
4788 size_t colonPos = loc_url.
find(
':');
4812 return (prot!=Protection::Private && prot!=Protection::Package) ||
4813 (prot==Protection::Private && extractPrivate) ||
4814 (prot==Protection::Package && extractPackage);
4821 if (s.
empty())
return s;
4825 const char *p=s.
data();
4828 int minIndent=1000000;
4829 bool searchIndent=
true;
4831 bool skipFirst = skipFirstLine;
4834 if (c==
'\t') { indent+=tabSize - (indent%tabSize); }
4835 else if (c==
'\n') { indent=0; searchIndent=
true; skipFirst=
false; }
4836 else if (c==
' ') { indent++; }
4837 else if (searchIndent && !skipFirst)
4840 if (indent<minIndent) minIndent=indent;
4845 if (minIndent==0)
return substitute(s,
"@ilinebr",
"\\ilinebr");
4851 skipFirst=skipFirstLine;
4860 else if (indent<minIndent && !skipFirst)
4864 int newIndent = indent+tabSize-(indent%tabSize);
4878 else if (c==
'\\' &&
literal_at(p,
"ilinebr "))
4881 result <<
"\\ilinebr ";
4884 for (
int j=0;j<minIndent;j++)
if (*(p+j)==
' ') skipAmount++;
4885 if (skipAmount==minIndent)
4892 result <<
"\\ilinebr";
4903 return result.
str();
4911 if (indentationLevel <= 0 || doc.
empty())
return;
4916 const char *src = doc.
data();
4918 bool insideIndent = !skipFirstLine;
4920 if (!skipFirstLine) cnt = indentationLevel;
4928 insideIndent =
true;
4929 cnt = indentationLevel;
4940 insideIndent =
false;
4950 insideIndent =
false;
4955 doc.
resize(
static_cast<uint32_t
>(dst-doc.
data()));
4967 std::string s = docs.
str();
4968 static const reg::Ex re(R
"(\[([ inout,]+)\])");
4973 const auto &match = *it;
4974 size_t p = match.position();
4975 size_t l = match.length();
4979 std::string dir = match[1].str();
4981 dir.erase(std::remove_if(dir.begin(),dir.end(),
4982 [](
const char c) { return c==
' ' || c==
','; }
4984 unsigned char ioMask=0;
4985 size_t inIndex = dir.find(
"in");
4986 if ( inIndex!=std::string::npos) { dir.erase( inIndex,2); ioMask|=(1<<0); }
4987 size_t outIndex = dir.find(
"out");
4988 if (outIndex!=std::string::npos) { dir.erase(outIndex,3); ioMask|=(1<<1); }
4989 if (dir.empty() && ioMask!=0)
4992 if (ioMask==((1<<0)|(1<<1)))
return "[in,out]";
4993 else if (ioMask==(1<<0))
return "[in]";
4994 else if (ioMask==(1<<1))
return "[out]";
5008 if (a.hasDocumentation(
true))
5010 DString docsWithoutDir = a.docs;
5017 paramDocs+=
" \\ilinebr @param"+direction+
" "+name+
" "+docsWithoutDir;
5050 *outListType1=inListType;
5053 if (inProt==Protection::Public)
5060 else if (inProt==Protection::Protected)
5068 *outListType2=inListType.
toPublic();
5071 else if (inProt==Protection::Private)
5081 *outListType1=inListType.
toPublic();
5106 size_t i= format.
find(
':');
5114 for (
size_t i = splitExt.size(); i > 0; )
5117 extGen += splitExt[i] + (i!=0 ?
"." :
"");
5125 bool fileOpened=
false;
5126 bool writeToStdout=outFile==
"-";
5129 f.basic_ios<char>::rdbuf(std::cout.rdbuf());
5144 fileOpened = f.is_open();
5154 if (s.
empty())
return s;
5157 auto skipBlock = [&markerInfo](
const char *p,
const SelectionBlock &blk)
5164 size_t len = markerInfo.
endLen;
5165 bool negate = *(p+markerInfo.
endLen)==
'!';
5167 size_t blkNameLen =
dstrlen(blk.name);
5168 if (
dstrncmp(p+len,blk.name,blkNameLen)==0 &&
5172 return p+len+blkNameLen+markerInfo.
closeLen;
5189 const char *p = s.
data();
5199 bool negate = *(p+len)==
'!';
5201 for (
const auto &blk : blockList)
5203 size_t blkNameLen =
dstrlen(blk.name);
5204 if (
dstrncmp(p+len,blk.name,blkNameLen)==0 &&
5207 bool blockEnabled = blk.enabled!=negate;
5209 p+=len+blkNameLen+markerInfo.
closeLen;
5228 size_t len = markerInfo.
endLen;
5229 bool negate = *(p+len)==
'!';
5231 for (
const auto &blk : blockList)
5233 size_t blkNameLen =
dstrlen(blk.name);
5234 if (
dstrncmp(p+len,blk.name,blkNameLen)==0 &&
5238 p+=len+blkNameLen+markerInfo.
closeLen;
5267 if (s.
empty())
return;
5269 const char *p = s.
data();
5278 bool negate = *(p+len)==
'!';
5284 if (markerInfo.
closeLen==0 && *p==
'\n')
5286 warn(fileName,-1,
"Remaining begin replacement with marker '{}'",marker);
5292 warn(fileName,-1,
"Remaining begin replacement with marker '{}'",marker);
5301 size_t len = markerInfo.
endLen;
5302 bool negate = *(p+len)==
'!';
5308 if (markerInfo.
closeLen==0 && *p==
'\n')
5310 warn(fileName,-1,
"Remaining end replacement with marker '{}'",marker);
5316 warn(fileName,-1,
"Remaining end replacement with marker '{}'",marker);
5333 size_t size = s.
length();
5336 const char *data = s.
data();
5339 constexpr auto doxy_nbsp =
"&_doxy_nbsp;";
5340 const int maxIndent=1000000;
5341 int minIndent=maxIndent;
5350 int stop = tabSize - (col%tabSize);
5353 while (stop--) result+=
' ';
5357 if (skip && data[i] ==
'\\' && i+8<size &&
literal_at(data+i+1,
"endiskip"))
5363 else if (data[i] ==
'\\')
5369 else if (i+5<size &&
literal_at(data+i,
"iskip"))
5374 else if (i+8<size &&
literal_at(data+i,
"endiskip"))
5394 if (
static_cast<signed char>(c)<0 && i<size)
5406 for (
int j=0;j<bytes-1 && c;j++)
5418 if (!skip && col<minIndent) minIndent=col;
5422 if (minIndent!=maxIndent) refIndent=minIndent;
else refIndent=0;
5437 int l =
static_cast<int>(name.length());
5438 int lastSepPos = -1;
5439 const char *p = name.data();
5448 if (sharpCount==0 && p[i+1]==
':' && p[i+2]==
':')
5462 if (ts==-1) ts=0;
else p+=++ts;
5463 for (i=ts;i<l-1;i++)
5466 if (c==
':' && *p==
':') lastSepPos=i;
5484 result+=name.mid(p,idx-p);
5489 for (; i<name.length(); i++)
5492 if (c==
'<') depth++;
5493 else if (c==
'>' && --depth==0)
break;
5494 else if (c==
',' && depth==1) count++;
5499 if (p<name.length()) result+=name.mid(p);
5508 size_t idx = result.
find(
'-');
5509 result = result.
left(idx)+templArgs;
5517 size_t i = text.
find(
'"');
5545 file.write( content.
data(), content.
length() );
5550 err(
"Could not open file {} for writing\n",fileName);
This class contains the information about the argument of a function or template.
This class represents an function or template argument list.
RefQualifierType refQualifier() const
bool pureSpecifier() const
bool hasParameters() const
DString trailingReturnType() const
typename Vec::const_iterator const_iterator
bool constSpecifier() const
bool hasDocumentation(bool allowEmptyNames=false) const
bool hasTemplateDocumentation() const
bool volatileSpecifier() const
A abstract class representing of a compound symbol.
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual bool isTemplate() const =0
Returns true if this class is a template.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const =0
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
virtual bool isUsedOnly() const =0
static void hsl2rgb(double h, double s, double l, double *pRed, double *pGreen, double *pBlue)
virtual const FileDef * getFileDef() const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString & setNum(short n)
void resize(size_t newlen)
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
DString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple internal white...
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString substr(size_t pos=0, size_t count=npos) const
Returns a substring of length count starting at pos.
char * rawData()
Returns a writable pointer to the data.
const char * c_str() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
std::string_view view() const
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
char & at(size_t i)
Returns a reference to the character at index i.
DString right(size_t len) const
DString & prepend(const char *s)
size_t find(char c, size_t pos=0) const
DString & sprintf(const char *format,...)
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
DString left(size_t len) const
const std::string & str() const
bool stripPrefix(const DString &prefix)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool startsWith(const char *s) const
bool endsWith(const char *s) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
The common base class of all entity definitions found in the sources.
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int docLine() const =0
virtual bool isLinkable() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual DString qualifiedName() const =0
virtual DString anchor() const =0
virtual DString getReference() const =0
virtual const GroupList & partOfGroups() const =0
virtual bool isArtificial() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual const Definition * findInnerCompound(const DString &name) const =0
virtual DString getOutputFileBase() const =0
A model of a directory symbol.
Class representing a directory in the file system.
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
bool remove(const std::string &path, bool acceptsAbsPath=true) const
bool empty(const std::string &subdir) const
bool rmdir(const std::string &path, bool acceptsAbsPath=true) const
bool rename(const std::string &orgName, const std::string &newName, bool acceptsAbsPath=true) const
static NamespaceLinkedMap * namespaceLinkedMap
static ConceptLinkedMap * conceptLinkedMap
static std::unique_ptr< PageDef > mainPage
static FileNameLinkedMap * inputNameLinkedMap
static ParserManager * parserManager
static InputFileEncodingList inputFileEncodingList
static MemberNameLinkedMap * functionNameLinkedMap
static PageLinkedMap * exampleLinkedMap
static NamespaceDefMutable * globalScope
static StringMap tagDestinationMap
static PageLinkedMap * pageLinkedMap
static DString htmlFileExtension
static DirLinkedMap * dirLinkedMap
static MemberNameLinkedMap * memberNameLinkedMap
static SymbolMap< Definition > * symbolMap
static FileNameLinkedMap * exampleNameLinkedMap
static GroupLinkedMap * groupLinkedMap
A model of a file symbol.
virtual ModuleDef * getModuleDef() const =0
virtual DString absFilePath() const =0
Minimal replacement for QFileInfo.
std::string extension(bool complete) const
bool match(const PatternList &patList, bool caseSenseNames, PatternElem *elem=nullptr, PatternGet getter=[](const std::string &s){ return s;}) const
Match the file name against a list of patterns.
std::string dirPath(bool absPath=true) const
std::string filePath() const
std::string absFilePath() const
FileDef * findFileDef(const DString &n, bool &ambig) const
Returns the file definition in fnMap that matches the file name n.
A model of a group of symbols.
const char * writeHtmlEntity(T &result, const char *s, HtmlEntityMapperFunc &&mapper, const char *fallback)
const char * xml(SymType symb) const
Access routine to the XML code of the HTML entity.
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
DString convertCharEntitiesToUTF8(const DString &s) const
const T * find(const std::string &key) const
A model of a class/file/namespace member symbol.
virtual DString argsString() const =0
virtual bool isRelated() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual bool isTypedef() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isStrongEnumValue() const =0
virtual bool isStatic() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual bool isEnumerate() const =0
virtual DString typeString() const =0
Wrapper class for the MemberListType type.
constexpr bool isPrivate() const noexcept
constexpr MemberListType toPublic() const noexcept
static constexpr MemberListType Invalid() noexcept
constexpr MemberListType toProtected() const noexcept
constexpr bool isProtected() const noexcept
ML_TYPES constexpr bool isPublic() const noexcept
Ordered dictionary of MemberName objects.
static ModuleManager & instance()
An abstract interface of a namespace symbol.
Class representing a list of output generators that are written to in parallel.
void parseText(const DString &textStr)
void disable(OutputType o)
void writeObjectLink(const DString &ref, const DString &file, const DString &anchor, const DString &name)
void startConstraintList(const DString &header)
void startConstraintParam()
void writeString(const DString &text)
void startConstraintDocs()
void startConstraintType()
void pushGeneratorState()
void disableAllBut(OutputType o)
void endConstraintParam()
void generateDoc(const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &docStr, const DocOptions &options)
A model of a page symbol.
virtual const GroupDef * getGroupDef() const =0
class that provide information about a section.
Definition * definition() const
static SectionManager & instance()
returns a reference to the singleton
const VectorPtr & find(const DString &name)
int isAccessibleFrom(const Definition *scope, const Definition *item)
Checks if symbol item is accessible from within scope.
const ClassDef * resolveClass(const Definition *scope, const DString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
Find the class definition matching name within the scope set.
const Definition * resolveSymbol(const Definition *scope, const DString &name, const DString &args=DString(), bool checkCV=false, bool insideCode=false, bool onlyLinkable=false)
Find the symbool definition matching name within the scope set.
DString getResolvedType() const
In case a call to resolveClass() points to a typedef or using declaration.
int isAccessibleFromWithExpScope(const Definition *scope, const Definition *item, const DString &explicitScopePart)
Check if symbol item is accessible from within scope, where it has to match the explicitScopePart.
DString getTemplateSpec() const
In case a call to resolveClass() points to a template specialization, the template part is return via...
void setFileScope(const FileDef *fd)
Sets or updates the file scope using when resolving symbols.
const MemberDef * getTypedef() const
In case a call to resolveClass() resolves to a type member (e.g. an enum) this method will return it.
Implements TextGeneratorIntf for an OutputDocInterface stream.
Text streaming class that buffers data.
std::string str() const
Return the contents of the buffer as a std::string object.
virtual DString trTypeConstraints()=0
virtual DString trModule(bool first_capital, bool singular)=0
virtual DString trWriteList(int numEntries)=0
ClassDef * getClass(const DString &n)
ClassDef * toClassDef(Definition *d)
std::vector< BaseClassDef > BaseClassList
Class representing a regular expression.
@ Wildcard
simple globbing pattern.
Class to iterate through matches.
ConceptDef * getConcept(const DString &n)
ConceptDef * toConceptDef(Definition *d)
#define Config_getInt(name)
#define Config_getList(name)
#define Config_getEnumAsString(name)
#define Config_getBool(name)
#define Config_getString(name)
#define Config_getEnum(name)
std::unordered_set< std::string > StringUnorderedSet
std::vector< std::string > StringVector
DString formatDateTime(const DString &format, const std::tm &dt, int &formatUsed)
Return a string representation for a given std::tm value that is formatted according to the pattern g...
DString dateTimeFromString(const DString &spec, std::tm &dt, int &format)
Returns the filled in std::tm for a given string representing a date and/or time.
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const DString &argsString, DString *extraTypeChars=nullptr)
DirIterator end(const DirIterator &) noexcept
#define AUTO_TRACE_ADD(...)
#define AUTO_TRACE_EXIT(...)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
int dstricmp(const char *s1, const char *s2)
bool isId(char c)
Returns true if c is a valid character for an identifier.
int dstrncmp(const char *str1, const char *str2, size_t len)
uint32_t dstrlen(const char *str)
Returns the length of string str, or 0 if a null pointer is passed.
const char * qPrint(const char *s)
FileDef * toFileDef(Definition *d)
Translator * theTranslator
void linkifyText(const TextGeneratorIntf &out, const DString &text, const LinkifyTextOptions &options)
DString md5str(const std::string_view &str)
std::array< uint8_t, 16 > md5hash(const std::string_view &str)
MemberDef * toMemberDef(Definition *d)
#define warn(file, line, fmt,...)
ModuleDef * toModuleDef(Definition *d)
FILE * popen(const DString &name, const DString &type)
std::ifstream openInputStream(const DString &name, bool binary=false, bool openAtEnd=false)
DString removeLongPathMarker(const DString &path)
bool fileSystemIsCaseSensitive()
std::ofstream openOutputStream(const DString &name, bool append=false)
void replaceNamespaceAliases(DString &name)
NamespaceDef * getResolvedNamespace(const DString &name)
NamespaceDef * toNamespaceDef(Definition *d)
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Token literal values and constants.
Portable versions of functions that are platform dependent.
int portable_iconv_close(void *cd)
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
void * portable_iconv_open(const char *tocode, const char *fromcode)
Some helper functions for std::string.
void addTerminalCharIfMissing(std::string &s, char c)
bool literal_at(const char *data, const char(&str)[N])
returns true iff data points to a substring that matches string literal str
StringVector split(const std::string &s, const std::string &delimiter, bool retainEmpty=false)
split input string s by string delimiter delimiter.
Helper class to pass options when calling OutputList::generateDoc().
int isUTF8NonBreakableSpace(const char *input)
Check if the first character pointed at by input is a non-breakable whitespace character.
uint8_t getUTF8CharNumBytes(char c)
Returns the number of bytes making up a single UTF8 character given the first byte in the sequence.
Various UTF8 related helper functions.
bool readInputFile(const DString &fileName, std::string &contents, const ReadInputFileOptions &options)
read a file name fileName and optionally filter and transcode it
DString stripExtension(const DString &fName)
bool useCaseSenseNames()
Returns true if the names of the symbols can be case sensitive.
bool isURL(const DString &url)
Checks whether the given url starts with a supported protocol.
DString substituteTemplateArgumentsInString(const DString &nm, const ArgumentList &formalArgs, const ArgumentList *actualArgs)
static DString extractDirection(DString &docs)
Strip the direction part from docs and return it as a string in canonical form.
static size_t findParameterList(const DString &name)
Returns the position in the string where a function parameter list begins, or DString::npos if one is...
static std::mutex writeFileContents_lock
DString inlineArgListToDoc(const ArgumentList &al)
DString stripLeadingAndTrailingEmptyLines(const DString &s, int &docLine)
Special version of DString::stripWhiteSpace() that only strips completely blank lines.
DString replaceColorMarkers(const DString &str)
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC,...
bool protectionLevelVisible(Protection prot)
DString stripFromIncludePath(const DString &path)
static bool matchUnresolvedTypes(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcType, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstType)
DString mergeScopes(const DString &leftScope, const DString &rightScope)
DString filterTitle(const DString &title)
DString detab(const DString &s, size_t &refIndent)
DString selectBlocks(const DString &s, const SelectionBlockList &blockList, const SelectionMarkerInfo &markerInfo)
remove disabled blocks and all block markers from s and return the result as a string
bool matchTemplateArguments(const ArgumentList &srcAl, const ArgumentList &dstAl)
void stripIndentationVerbatim(DString &doc, size_t indentationLevel, bool skipFirstLine)
void addCodeOnlyMappings()
static int g_usedNamesCount
static void filterCRLF(std::string &contents)
static void stripIrrelevantString(DString &target, const DString &str, bool insideTemplate)
static DString stripDeclKeywords(const DString &s)
void writeTypeConstraints(OutputList &ol, const Definition *d, const ArgumentList &al)
DString extractBeginRawStringDelimiter(const char *rawStart)
void stripIrrelevantConstVolatile(DString &s, bool insideTemplate)
static DString getFilterFromList(const DString &name, const StringVector &filterList, bool &found)
static DString extractCanonicalArgType(const Definition *d, const FileDef *fs, const Argument &arg, SrcLangExt lang)
static DString getCanonicalTemplateSpec(const Definition *d, const FileDef *fs, const DString &spec, SrcLangExt lang)
DString writeInlineGraph(const DString &baseName, const DString &extension, const DString &content, bool &exists)
bool resolveLink(const DString &scName, const DString &lr, bool, const Definition **resContext, DString &resAnchor, SrcLangExt lang, const DString &prefix, const FileDef *currentFile)
bool rightScopeMatch(const DString &scope, const DString &name)
bool checkIfTypedef(const Definition *scope, const FileDef *fileScope, const DString &n)
static const char constScope[]
static bool recursivelyAddGroupListToTitle(OutputList &ol, const Definition *d, bool root)
DString unescapeCharsInString(const DString &s)
bool resolveRef(const DString &scName, const DString &name, bool inSeeBlock, const Definition **resContext, const MemberDef **resMember, SrcLangExt lang, bool lookForSpecialization, const FileDef *currentFile, bool checkScope)
DString externalLinkTarget(const bool parent)
DString replaceAnonymousScopes(const DString &s, const DString &replacement)
void cleanupInlineGraphs()
DString correctURL(const DString &url, const DString &relPath)
Corrects URL url according to the relative path relPath.
int computeQualifiedIndex(const DString &name)
Return the index of the last :: in the string name that is still before the first <.
DString convertToJSString(const DString &s, bool keepEntities, bool singleQuotes)
DString convertToId(const DString &s)
void trimBaseClassScope(const BaseClassList &bcl, DString &s, int level=0)
DString insertTemplateSpecifierInScope(const DString &scope, const DString &templ)
DString removeRedundantWhiteSpace(const DString &s)
static std::unordered_map< std::string, SrcLangExt > g_extLookup
bool checkExtension(const DString &fName, const DString &ext)
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
DString showDate(const DString &fmt)
bool leftScopeMatch(const DString &scope, const DString &name)
DString stripExtensionGeneral(const DString &fName, const DString &ext)
DString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
static const char staticScope[]
static ModuleDef * findModuleDef(const Definition *d)
void addGroupListToTitle(OutputList &ol, const Definition *d)
DString extractEndRawStringDelimiter(const char *rawEnd)
static DString extractCanonicalType(const Definition *d, const FileDef *fs, DString type, SrcLangExt lang, bool insideTemplate)
void clearSubDirs(const Dir &d)
DString stripScope(const DString &name)
DString getFileNameExtension(const DString &fn)
void createSubDirs(const Dir &d)
DString convertToHtml(const DString &s, bool keepEntities)
static bool matchArgument2(const Definition *srcScope, const FileDef *srcFileScope, Argument &srcA, const Definition *dstScope, const FileDef *dstFileScope, Argument &dstA, SrcLangExt lang, bool allowUnresolved)
DString resolveTypeDef(const Definition *context, const DString &qualifiedName, const Definition **typedefContext)
DString normalizeNonTemplateArgumentsInString(const DString &name, const Definition *context, const ArgumentList &formalArgs)
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
DString getFileFilter(const DString &name, bool isSourceCode)
static MemberDef * getMemberFromSymbol(const Definition *scope, const FileDef *fileScope, const DString &n)
void initDefaultExtensionMapping()
void addHtmlExtensionIfMissing(DString &fName)
void checkBlocks(const DString &s, const DString fileName, const SelectionMarkerInfo &markerInfo)
static void transcodeCharacterBuffer(const DString &fileName, std::string &contents, const DString &inputEncoding, const DString &outputEncoding)
DString fileToString(const DString &name, bool filter, bool isSourceCode)
static const char virtualScope[]
DString linkToText(SrcLangExt lang, const DString &link, bool ignoreDots)
DString substituteKeywords(const DString &file, const DString &s, const KeywordSubstitutionList &keywords)
void extractNamespaceName(const DString &scopeName, DString &className, DString &namespaceName, bool allowEmptyClass)
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
DString stripTemplateSpecifiersFromScope(const DString &fullName, bool parentOnly, DString *pLastScopeStripped, DString scopeName, bool allowArtificial)
DString relativePathToRoot(const DString &name)
static const DirDef * resolveDirLink(const DString &linkRef)
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
DString projectLogoFile()
static StringUnorderedSet writeFileContents_set
void convertProtectionLevel(MemberListType inListType, Protection inProt, MemberListType *outListType1, MemberListType *outListType2)
Computes for a given list type inListType, which are the the corresponding list type(s) in the base c...
static const char volatileScope[]
DString getEncoding(const FileInfo &fi)
bool copyFile(const DString &src, const DString &dest)
Copies the contents of file with name src to the newly created file with name dest.
int getPrefixIndex(const DString &name)
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
bool updateLanguageMapping(const DString &extension, const DString &language)
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcReturnType, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstReturnType, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang, bool allowUnresolved)
DString demangleCSharpGenericName(const DString &name, const DString &templArgs)
DString createHtmlUrl(const DString &relPath, const DString &ref, bool isLocalFile, const DString &targetFileName, const DString &anchor)
DString projectLogoSize()
static DString getCanonicalTypeForIdentifier(const Definition *d, const FileDef *fs, const DString &word, SrcLangExt lang, DString *tSpec, int count=0)
DString mangleCSharpGenericName(const DString &name)
GetDefResult getDefs(const GetDefInput &input)
DString getDotImageExtension()
DString escapeCharsInString(const DString &name, bool allowDots, bool allowUnderscore)
static std::mutex g_usedNamesMutex
void mergeArguments(ArgumentList &srcAl, ArgumentList &dstAl, bool forceNameOverwrite)
int getScopeFragment(const DString &s, int p, int *l)
static bool getScopeDefs(const DString &docScope, const DString &scope, ClassDef *&cd, ConceptDef *&cnd, NamespaceDef *&nd, ModuleDef *&modd)
DString stripIndentation(const DString &s, bool skipFirstLine)
static bool matchCanonicalTypes(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcType, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstType, SrcLangExt lang)
int extractClassNameFromType(const DString &type, int &pos, DString &name, DString &templSpec, SrcLangExt lang)
DString determineAbsoluteIncludeName(const DString &curFile, const DString &incFileName)
static DString stripFromPath(const DString &p, StringVector l)
DString removeAnonymousScopes(const DString &str)
DString makeBaseName(const DString &name, const DString &ext)
DString getDotImageExtensionGenerated(const DString &format)
void writeMarkerList(OutputList &ol, const std::string &markerText, size_t numMarkers, std::function< void(size_t)> replaceFunc)
DString externalRef(const DString &relPath, const DString &ref)
static bool isLowerCase(DString &s)
DString stripPath(const DString &s)
static std::unordered_map< std::string, int > g_usedNames
static CharAroundSpace g_charAroundSpace
DString inlineTemplateArgListToDoc(const ArgumentList &al)
void writeExamples(OutputList &ol, const ExampleList &list)
static std::mutex g_matchArgsMutex
static const char operatorScope[]
bool openOutputFile(const DString &outFile, std::ofstream &f)
static std::vector< Lang2ExtMap > g_lang2extMap
DString stripAnonymousNamespaceScope(const DString &s)
DString findExampleFilePath(const DString &file, bool &ambig)
SrcLangExt getLanguageFromCodeLang(DString &fileName)
Routine to handle the language attribute of the \code command.
A bunch of utility functions.
std::vector< KeywordSubstitution > KeywordSubstitutionList
std::vector< SelectionBlock > SelectionBlockList