34 #if ALIB_DEBUG_CRITICAL_SECTIONS
59 backwardsParser= backwardsParser.
Substring(0, dotPos);
63 #if ALIB_DEBUG_CRITICAL_SECTIONS
88 while (entityIterator.
IsValid()) {
90 entityIterator.
Next();
96 int expectedFileMapSize = 0;
97 int expectedAnchorMapSize= 0;
115 fileMap .Reserve(expectedFileMapSize , lang::ValueReference::Absolute );
116 anchorMap .Reserve(expectedAnchorMapSize , lang::ValueReference::Absolute );
122 while (entityIterator.
IsValid()) {
143 auto result=
anchorMap.InsertIfNotExistent(
145 entityIterator.
Node().Export() );
146 if ( !result.second ) {
147 Lox_Info(
"In HTML file {!Q}, the anchor {!Q} already exists. (Skipped)\n"
148 " Previous anchor: {}:{} Kind: {:10} FileName: {}\n"
149 " New anchor: {}:{} Kind: {:10} FileName: {}"
153 ,
ImportNode(result.first.Mapped()).HTMLFile()
159 auto result=
anchorMap.InsertIfNotExistent(
161 entityIterator.
Node().Export() );
162 if ( !result.second ) {
163 Lox_Warning(
"In HTML file {!Q}, the DocAnchor {!Q} already exists. (Skipped)\n"
164 " Previous anchor: {}:{} Kind: {:10} FileName: {}\n"
165 " New anchor: {}:{} Kind: {:10} FileName: {}"
169 ,
ImportNode(result.first.Mapped()).HTMLFile()
176 if ( scu->SpecializationArgs ) {
183 "Parse error (only specialization args should appear in the name and those "
184 "have been removed already.")
190 || mf->Qualifiers.IsNotEmpty() ) {
197 entityIterator.
Next();
201 "Expected size of entityMap {} != {} real size.",
Size() ,
entityMap.Size())
204 "Expected size of fileMap {} != {} real size.", expectedFileMapSize ,
fileMap.Size())
207 "Expected size of anchorMap {} < {} real size.", expectedAnchorMapSize,
anchorMap.Size())
215 auto it=
fileMap.Find(htmlFile.Name());
217 Lox_Warning(
"HTML-File {!Q} not found in index: ", htmlFile.Name() )
218 return CursorHandle(0);
232 buffer.
Delete(startPos, 1);
246 auto parent= entry.
Parent();
247 while (!parent.IsRoot()) {
248 pathNameStack[stackSize++]= parent.Name();
249 parent= parent.Parent();
261 pathNameStack[stackSize++]= tagFileName;
264 pathNameStack[stackSize++]= tagFileName.
Substring(dotPos + 1);
265 tagFileName= tagFileName.
Substring(0, dotPos);
270 int stackPointer= stackSize-1;
274 pos= pathNameStack[stackPointer].
IndexOf<
CHK, lang::Case::Ignore>(
275 searchLink.
Hint(hintNo), pos );
283 if ( --stackPointer < 0)
292 range.first!=range.second ;
306 bool foundParentScope=
true;
307 for (
int i= xLink.
ScopeSize() - 1; i>= 0 ; --i) {
309 if ( !parent.IsValid() || !parent.Name().Equals(componentName) ) {
310 foundParentScope=
false;
316 if (!foundParentScope)
337 ,0,
false,
false,
false,
false,
false,
false
348 bool isIndirectByInheritance,
bool isIndirectByTypeDef ) {
363 if (var->Subscript.IndexOf(xLink.
Subscript) < 0) {
376 if (!rec->TemplateArgs) {
396 if (!rec->SpecializationArgs) {
410 bool skipThis=
false;
412 for (
auto& it : xLink.
Targets ) {
416 while (parent.IsValid()) {
417 if (parent == node.
Parent()) {
426 if ( skipThis )
return;
430 std::erase_if(xLink.
Targets, [&](
const auto& it) {
431 if ( !it.Node.IsA(Target::Typedef) )
433 Node parent = node.Parent();
434 while (parent.IsValid()) {
435 if ( parent == it.Node.Parent())
437 parent= parent.Parent();
445 std::erase_if(xLink.Targets, [&,node](
const auto& it) {
446 Node parent = it.Node.Parent();
447 while (parent.IsValid()) {
450 parent = parent.Parent();
456 for (
auto& it : xLink.Targets) {
457 Node parent = node.Parent();
458 while (parent.IsValid()) {
459 if (parent == it.Node) {
463 parent= parent.Parent();
467 if (skipThis)
return;
472 if ( target->IsA(Target::Function | Target::Macro) ) {
474 if ( target->IsA(Target::Function) )
475 funcArgMatch= Target::FunctionArguments::MATCH( xLink.Args,
476 Cast<TGTFunction,NC>(target)->Args );
481 auto* targetArgs= Cast<TGTMacro,NC>(target)->Args;
482 if ( xLink.Args && !targetArgs)
485 funcArgMatch= Target::FunctionArguments::MATCH(xLink.Args, targetArgs);
488 if ( funcArgMatch == 0)
492 bool hasBetterMatch=
false;
493 std::erase_if(xLink.Targets, [&](
const auto& it) {
494 if ( it.FunctionArgumentMatch < funcArgMatch)
496 if ( it.FunctionArgumentMatch > funcArgMatch)
497 hasBetterMatch= true;
506 bool qualifiersHintMatch=
false;
507 if (xLink.Qualifiers.IsNotNull()) {
508 if ( !target->IsA(Target::Function)
509 || Cast<TGTFunction,NC>(target)->Qualifiers.IndexOf(xLink.Qualifiers) < 0)
511 qualifiersHintMatch=
true;
514 std::erase_if(xLink.Targets, [&,node](
const auto& it) {
515 return it.Node.IsA(Target::Function)
516 && Cast<TGTFunction,NC>(it.Node)->Qualifiers.IsEmpty();
520 if (
auto* func= Cast<TGTFunction>(target); func ) {
521 if ( func->Qualifiers.IsNotEmpty()) {
522 bool hasBetterMatch=
false;
523 for (
auto& it : xLink.Targets) {
524 if (
auto* f= Cast<TGTFunction>(it.Node); f ) {
525 hasBetterMatch= f->Qualifiers.IsEmpty();
534 std::erase_if(xLink.Targets, [&,node](
const auto& it) {
535 return it.Node.IsA(Target::Function)
536 && Cast<TGTFunction,NC>(it.Node)->Qualifiers.IsNotEmpty();
543 std::erase_if(xLink.Targets, [&](
const auto& it) {
546 if ( it.Node.Parent() == node.Parent() ) {
547 if (target->IsA(Target::RECORD)) {
548 if ( it.Node.IsA(Target::Function)
549 && xLink.Args==nullptr)
559 xLink.Targets.push_back({ node
562 , target->IsA(Target::MEMBER) ? Cast<TGTMember ,NC>(target)->Anchor
563 : target->IsA(Target::DocAnchor) ? Cast<TGTDocAnchor,NC>(target)->Name
567 ,isIndirectByInheritance
590 results.reserve(1024/
sizeof(CursorHandle) - 4);
592 for (
auto range=
entityMap.EqualRange( xLink.
Name()) ; range.first!=range.second ; ++range.first)
593 results.push_back(range.first->second);
596 for (
auto handle : results ) {
613 bool scopeMatches=
true;
619 int fileNameComponentIdx= -1;
620 for (
int i= xLink.
ScopeSize() - 1; i>= 0 ; --i) {
623 if ( templatePos > 0 )
624 componentName= componentName.
Substring(0, templatePos);
626 if ( !parent.IsRoot() ) {
627 if ( !componentName.
Equals( parent.Name() ) ) {
638 if ( scopeMatches && xLink.
IsLocal)
639 scopeMatches &= (parent.Export().value == xLink.
LocalLinkEntity.value);
661 for (
auto cursorHandle : results ) {
667 if (inheritanceParent == node.
Parent())
674 if (typeDefTarget == node.
Parent() )
688 bool hasNonGroupResults=
false;
689 for (
auto& it : targets)
690 if ( it.Node.Parent().IsRoot()
692 hasNonGroupResults=
true;
695 if ( hasNonGroupResults)
696 std::erase_if(targets, [](
const auto& it) {
697 return !it.Node.Parent().IsRoot()
#define ALIB_LOCK_SHARED_WITH(lock)
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define ALIB_LOCK_WITH(lock)
void Initialize(CursorType startNode, lang::Inclusion includeStartNode)
void SetPathGeneration(lang::Switch pathGeneration)
constexpr CharacterType Separator() const noexcept
void ConstructRootValue(TArgs &&... args)
TAString & Delete(integer regionStart, integer regionLength=MAX_LEN)
integer SearchAndReplace(const TString< TChar > &needle, const TString< TChar > &replacement, integer startIdx=0, integer maxReplacements=strings::MAX_LEN, lang::Case sensitivity=lang::Case::Sensitive, integer endIdx=strings::MAX_LEN)
constexpr integer Length() const
TChar CharAt(integer idx) const
integer IndexOf(const TString &needle, integer startIdx=0, integer endIdx=strings::MAX_LEN) const
integer LastIndexOf(TChar needle, integer startIndex=MAX_LEN) const
TString< TChar > Substring(integer regionStart, integer regionLength=MAX_LEN) const
bool Equals(const TString< TChar > &rhs) const
TSubstring & TrimEnd(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
Index(const alib::PathString &tagFilePath, const alib::String &baseURL, bool isMainTagFile)
alib::MonoAllocator ma
The allocator used for the parent #"StringTree" and for the hashtable in the field map.
void dedupGroupEntries(alib::StdVectorMA< SearchResult > &targets)
void Search(XLink &xLink)
alib::Ticks::Duration LoadTime
A timestamp set when loaded.
alib::containers::HashMap< alib::MonoAllocator, const alib::String &, CursorHandle, std::hash< alib::String >, std::equal_to< const alib::String >, alib::lang::Caching::Disabled, alib::Recycling::None > fileMap
Maps HTML-files found to their corresponding tree nodes.
const alib::String & BaseURL
The URL of the HTML-output created with this tag-file.
ConstCursorHandle GetHTMLFileEntity(const alib::FTFile &htmlFile)
int fileNameDotComponentsSize
The number of components in fileNameDotComponents.
alib::PathString FilePath
The path to the doxygenTagFile.
void Load()
Loads the tag-file and creates the index.
void ReplaceToTreeSeparator(alib::AString &buffer, Target::Kinds kind, alib::integer startPos=0)
alib::containers::HashMap< alib::MonoAllocator, AnchorKey, CursorHandle, AnchorKey::Hash, std::equal_to< AnchorKey >, alib::lang::Caching::Enabled > anchorMap
Maps HTML-files found to their corresponding tree nodes.
void ReplaceFromTreeSeparator(alib::AString &buffer, Target::Kinds kind, alib::integer startPos=0)
void searchFile(XLink &xLink)
void evaluateEntity(XLink &xLink, Node node, bool isIndirectByInheritance, bool isIndirectByTypeDef)
void loadTagFile()
Loads the tag-file. This is called by Load.
Node ImportNode(CursorHandle handle)
alib::containers::HashMap< alib::MonoAllocator, alib::String, CursorHandle > entityMap
bool ScopeHintMatch(Node entry, XLink &searchLink)
alib::PathString FileName
The base name component of FilePath.
Target::KindStats KindStats
Statistics on the number of entities found per kind in #"Target::Kinds;2".
StringTree TreeType
The type of the string tree that holds the tag-file.
alib::String fileNameDotComponents[10]
static Target * GetRootNodeTarget()
bool IsA(Kinds aKind) const
alib::String HTMLFile
The HTML file that this target links to (or into).
Kinds
Enumerates the kinds of compounds found in a the Doxygen tagfile.
@ Struct
Denotes a struct.
@ Function
Denotes a namespace- or member-function.
@ Variable
Denotes a namespace- or member-variable.
@ UNSPECIFIED
Used with the field #"XLink::KindSpec;2".
@ Typedef
Denotes a type definition.
@ File
Denotes a source file.
@ EnumElement
Denotes an enumeration element.
@ Concept
Denotes a C++20 concept.
@ Macro
Denotes a preprocessor definition.
@ Dir
Denotes a source folder.
@ Enumeration
Denotes an enumeration.
@ FILEPATH_COMPONENT
A node of a file path (not a doxygen kind).
@ Namespace
Denotes a namespace.
@ DocAnchor
Denotes a preprocessor definition.
@ RECORD
Mask to identify records types.
int LineNo
The line number in the Doxygen tag-file where this entity is defined.
alib::String & Name() const
Index::Node DidYouMeanTemplateType
alib::StdVectorMA< Index::Node > DidYouMeanSameName
A list of target nodes with the same name.
alib::StdVectorMA< Index::Node > DidYouMeanNotATemplate
A list of entries that are not templates, while a template type was searched.
alib::ListMA< Index::Node > * TypeDefinitionTargets
const alib::String & Scope(int n) const
Target::FunctionArguments * Args
Function arguments provided with the source XLink.
const alib::String & Hint(int n) const
Target::TemplateArguments * TemplateArgs
alib::StdVectorMA< Index::SearchResult > Targets
alib::ListMA< Index::Node > * BaseTypes
alib::String Subscript
A variable subscript provided by the source XLink.
alib::StdVectorMA< Index::Node > DidYouMeanSpecializations
Index::ConstCursorHandle LocalLinkEntity
XLink * GetLinkToParent()
alib::StdVectorMA< Index::Node > DidYouMeanVariable
A list of entries that are variables, while the XLink's subscript does not match.
Target::Kinds KindSpec
Function arguments provided with the source XLink.
Target::TemplateArguments * SpecializationArgs
alib::StdVectorMA< Index::Node > DidYouMeanFunctionOverload
bool NoIndirectionWarning
monomem::TLocalAllocator< 1 > LocalAllocator1K
constexpr const String EMPTY_STRING
strings::TString< character > String
strings::TSubstring< character > Substring
strings::TString< PathCharType > PathString
constexpr PathCharType DIRECTORY_SEPARATOR
strings::TAString< character, lang::HeapAllocator > AString
std::vector< T, StdMA< T > > StdVectorMA
containers::StringTreeIterator< TTree > StringTreeIterator
const TGT * Cast(const Index::Node &node)
HashTable< TAllocator, typename NodeKey::ValueDescriptor, typename NodeKey::Hash, typename NodeKey::EqualTo, lang::Caching::Enabled, TRecycling > nodeTable
Index & index
The index to load.
A pod-like struct providing the key for the hash table found in the field #"Index::anchorMap;2".
The cursor type of the #"StringTree".
const alib::String & HTMLFile() const
const Target * Target() const
bool IsA(Target::Kinds kind) const
Target::Kinds Kind() const
Node()=default
Defaulted default constructor. Creates an invalid node.
int Match(TemplateArguments &target)