31 AUTO_TRACE(
"scope={} fileScope={} text={} autoBreak={} external={} keepSpaces={} indentLevel={}",
32 scope?scope->
name():
"",fileScope?fileScope->
name():
"",
34 if (text.
empty())
return;
37 std::string_view txtStr=text.
view();
38 size_t strLen = txtStr.length();
39 if (strLen==0)
return;
41 static const reg::Ex regExp(R
"((::)?\a[\w~!\\.:$"]*)");
51 size_t floatingIndex=0;
52 for (; it!=
end ; ++it)
54 const auto &match = *it;
55 size_t newIndex = match.position();
56 size_t matchLen = match.length();
57 floatingIndex+=newIndex-skipIndex+matchLen;
58 if (newIndex>0 && txtStr.at(newIndex-1)==
'0')
60 std::string_view part = txtStr.substr(skipIndex,newIndex+matchLen-skipIndex);
62 skipIndex=index=newIndex+matchLen;
67 bool insideString=
false;
68 for (
size_t i=index;i<newIndex;i++)
70 if (txtStr.at(i)==
'"') insideString=!insideString;
71 if (txtStr.at(i)==
'\\') i++;
78 std::string_view splitText = txtStr.substr(skipIndex,newIndex-skipIndex);
79 size_t splitLength = splitText.length();
81 size_t i = splitText.find(
',');
82 if (i==std::string::npos) { i=splitText.find(
'<');
if (i!=std::string::npos) offset=0; }
83 if (i==std::string::npos) { i=splitText.find(
"||");
if (i!=std::string::npos) offset=2; }
84 if (i==std::string::npos) { i=splitText.find(
"&&");
if (i!=std::string::npos) offset=2; }
85 if (i==std::string::npos) { i=splitText.find(
">>");
if (i!=std::string::npos) offset=2; }
86 if (i==std::string::npos) i=splitText.find(
'>');
87 if (i==std::string::npos) i=splitText.find(
' ');
89 if (i!=std::string::npos)
91 std::string_view part1 = splitText.substr(0,i+offset);
94 std::string_view part2 = splitText.substr(i+offset);
96 floatingIndex=splitLength-i-offset+matchLen;
106 std::string_view part = txtStr.substr(skipIndex,newIndex-skipIndex);
110 std::string_view word=txtStr.substr(newIndex,matchLen);
118 if (it1->name == matchWord)
153 auto writeCompoundName = [&](
const auto *cd_) {
154 if (options.
external() ? cd_->isLinkable() : cd_->isLinkableInProject())
159 out.
writeLink(cd_->getReference(),cd_->getOutputFileBase(),cd_->anchor(),word);
171 writeCompoundName(cd);
173 else if ((cd=
getClass(matchWord+
"-p")))
175 writeCompoundName(cd);
179 writeCompoundName(cnd);
183 writeCompoundName(d);
190 size_t m = matchWord.
rfind(
"::");
198 scopeName=scope->
name();
202 scopeName = matchWord.
left(m);
203 matchWord = matchWord.
mid(m+2);
212 if (result.
found && result.
md &&
219 if (result.
md!=self && (self==
nullptr || result.
md->
name()!=self->
name()))
248 skipIndex=index=newIndex+matchLen;
251 std::string_view lastPart = txtStr.substr(skipIndex);
A abstract class representing of a compound symbol.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
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
DString left(size_t len) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
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 bool isLinkable() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual bool isLinkableInProject() const =0
virtual DString qualifiedName() const =0
virtual DString anchor() const =0
virtual DString getReference() const =0
virtual Definition * getOuterScope() const =0
virtual DString getOutputFileBase() const =0
A model of a file symbol.
A model of a class/file/namespace member symbol.
virtual bool isVariable() const =0
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.
const MemberDef * getTypedef() const
In case a call to resolveClass() resolves to a type member (e.g. an enum) this method will return it.
Abstract interface for a hyperlinked text fragment.
virtual void writeString(std::string_view, bool) const =0
virtual void writeBreak(int indent) const =0
virtual void writeLink(const DString &extRef, const DString &file, const DString &anchor, std::string_view text) const =0
ClassDef * getClass(const DString &n)
Class representing a regular expression.
Class to iterate through matches.
ConceptDef * getConcept(const DString &n)
DirIterator end(const DirIterator &) noexcept
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
void linkifyText(const TextGeneratorIntf &out, const DString &text, const LinkifyTextOptions &options)
const ArgumentList * argumentList() const
const Definition * scope() const
const Definition * self() const
size_t breakThreshold() const
const FileDef * fileScope() const
GetDefResult getDefs(const GetDefInput &input)
A bunch of utility functions.