117 enum class Kind {
None=-1,
Class,
Struct,
Union,
Interface,
Exception,
Protocol,
Category, Enum,
Service,
Singleton };
262 std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&
m_variant);
263 return p ? p->get() :
nullptr;
269 const std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&
m_variant);
270 return p ? p->get() :
nullptr;
274 template<
class R,
typename... Args>
342#define p_warn(fmt,...) do { \
343 warn(m_locator->fileName(),m_locator->lineNr(),fmt,##__VA_ARGS__); \
361 void endElement(
const QCString &name );
365 warn(fileName,lineNr,
"{}",
msg);
369 void buildLists(
const std::shared_ptr<Entry> &root);
390 p_warn(
"tag 'compound' was not expected!");
403 if (protStr==
"protected")
407 else if (protStr==
"private")
411 if (virtStr==
"virtual")
415 else if (virtStr==
"pure")
419 if (staticStr==
"yes")
447 p_warn(
"Unexpected tag 'member' found");
466 p_warn(
"Found 'enumvalue' tag outside of member tag");
500 p_warn(
"Unexpected tag 'docanchor' found");
564 p_warn(
"Unexpected tag 'class' found");
592 p_warn(
"Unexpected tag 'concept' found");
608 p_warn(
"Unexpected tag 'module' found");
636 p_warn(
"Unexpected tag 'namespace' found");
658 p_warn(
"Unexpected tag 'file' found");
674 p_warn(
"Unexpected tag 'page' found");
690 p_warn(
"Unexpected tag 'subpage' found");
706 p_warn(
"Unexpected tag 'dir' found");
731 p_warn(
"Unexpected tag 'type' found");
757 p_warn(
"Unexpected tag 'name' found");
773 p_warn(
"Unexpected tag 'id' found");
788 if (protStr==
"protected")
790 prot = Protection::Protected;
792 else if (protStr==
"private")
794 prot = Protection::Private;
796 if (virtStr==
"virtual")
798 virt = Specifier::Virtual;
804 p_warn(
"Unexpected tag 'base' found");
817 p_warn(
"Unexpected tag 'base' found");
843 p_warn(
"Unexpected tag 'includes' found");
856 p_warn(
"Unexpected tag 'templarg' found");
880 p_warn(
"Unexpected tag 'filename' found");
902 p_warn(
"Unexpected tag 'path' found");
920 p_warn(
"Unexpected tag 'anchor' found");
942 p_warn(
"Unexpected tag 'clangid' found");
956 p_warn(
"Unexpected tag 'anchorfile' found");
968 p_warn(
"Unexpected tag 'arglist' found");
995 p_warn(
"Unexpected tag 'title' found");
1009 p_warn(
"Unexpected tag 'subgroup' found");
1021 void buildMemberList(
const std::shared_ptr<Entry> &ce,
const std::vector<TagMemberInfo> &members);
1022 void addDocAnchors(
const std::shared_ptr<Entry> &e,
const std::vector<TagAnchorInfo> &l);
1047 std::unordered_map<std::string,std::unique_ptr<ClassNode>>
children;
1165 it->second.startCb(*
this,attrib);
1169 p_warn(
"Unknown start tag '{}' found!",name);
1179 it->second.endCb(*
this);
1183 p_warn(
"Unknown end tag '{}' found!",name);
1203 p_warn(
"Unknown compound attribute '{}' found!",kind);
1208 if (isObjC==
"yes" && classInfo)
1231 for (
const auto &md : cd->
members)
1277 for (
const auto &md : nd->
members)
1306 for (
const auto &md : fd->
members)
1315 for (
const auto &ii : fd->
includes)
1339 for (
const auto &fi : gd->
fileList)
1347 for (
const auto &pg : gd->
pageList)
1352 for (
const auto &md : gd->
members)
1384 for (
const auto &fi : dd->
fileList)
1412 for (
const auto &ta : l)
1419 ta.label,ta.fileName,-1,ta.title,
1421 e->anchors.push_back(si);
1428 ta.label,ta.fileName,-1,ta.title,
1436 for (
const auto &tmi : members)
1438 std::shared_ptr<Entry> me = std::make_shared<Entry>();
1439 me->type = tmi.type;
1440 me->name = tmi.name;
1441 me->args = tmi.arglist;
1442 if (!me->args.isEmpty())
1446 if (tmi.enumValues.size()>0)
1448 me->spec.setStrong(
true);
1449 for (
const auto &evi : tmi.enumValues)
1451 std::shared_ptr<Entry> ev = std::make_shared<Entry>();
1453 ev->name = evi.name;
1454 ev->id = evi.clangid;
1455 ev->section = EntryType::makeVariable();
1457 ev->tagInfoData.anchor = evi.anchor;
1458 ev->tagInfoData.fileName = evi.file;
1459 ev->hasTagInfo =
TRUE;
1460 me->moveToSubEntryAndKeep(ev);
1463 me->protection = tmi.prot;
1464 me->virt = tmi.virt;
1465 me->isStatic = tmi.isStatic;
1466 me->fileName = ce->fileName;
1467 me->id = tmi.clangId;
1468 me->startLine = tmi.lineNr;
1469 if (ce->section.isGroupDoc())
1475 me->tagInfoData.anchor = tmi.anchor;
1476 me->tagInfoData.fileName = tmi.anchorFile;
1477 me->hasTagInfo =
TRUE;
1478 if (tmi.kind==
"define")
1481 me->section = EntryType::makeDefine();
1483 else if (tmi.kind==
"enumvalue")
1485 me->section = EntryType::makeVariable();
1486 me->mtype = MethodTypes::Method;
1488 else if (tmi.kind==
"property")
1490 me->section = EntryType::makeVariable();
1491 me->mtype = MethodTypes::Property;
1493 else if (tmi.kind==
"event")
1495 me->section = EntryType::makeVariable();
1496 me->mtype = MethodTypes::Event;
1498 else if (tmi.kind==
"variable")
1500 me->section = EntryType::makeVariable();
1501 me->mtype = MethodTypes::Method;
1503 else if (tmi.kind==
"typedef")
1505 me->section = EntryType::makeVariable();
1506 me->type.prepend(
"typedef ");
1507 me->mtype = MethodTypes::Method;
1509 else if (tmi.kind==
"enumeration")
1511 me->section = EntryType::makeEnum();
1512 me->mtype = MethodTypes::Method;
1514 else if (tmi.kind==
"function")
1516 me->section = EntryType::makeFunction();
1517 me->mtype = MethodTypes::Method;
1519 else if (tmi.kind==
"signal")
1521 me->section = EntryType::makeFunction();
1522 me->mtype = MethodTypes::Signal;
1524 else if (tmi.kind==
"prototype")
1526 me->section = EntryType::makeFunction();
1527 me->mtype = MethodTypes::Method;
1529 else if (tmi.kind==
"friend")
1531 me->section = EntryType::makeFunction();
1532 me->type.prepend(
"friend ");
1533 me->mtype = MethodTypes::Method;
1535 else if (tmi.kind==
"dcop")
1537 me->section = EntryType::makeFunction();
1538 me->mtype = MethodTypes::DCOP;
1540 else if (tmi.kind==
"slot")
1542 me->section = EntryType::makeFunction();
1543 me->mtype = MethodTypes::Slot;
1545 ce->moveToSubEntryAndKeep(me);
1551 std::shared_ptr<Entry> ce = std::make_shared<Entry>();
1552 ce->section = EntryType::makeClass();
1569 ce->name = tci->
name;
1576 ce->tagInfoData.anchor = tci->
anchor;
1577 ce->tagInfoData.fileName = tci->
filename;
1578 ce->startLine = tci->
lineNr;
1580 ce->hasTagInfo =
TRUE;
1582 ce->lang = tci->
isObjC ? SrcLangExt::ObjC : SrcLangExt::Unknown;
1584 ce->extends = tci->
bases;
1599 root->moveToSubEntryAndKeep(ce);
1608 for (
const auto &child : node.
children)
1632 for (
size_t i=0; i<parts.size(); ++i)
1634 const auto &part = parts[i];
1637 current->
children[part] = std::make_unique<ClassNode>(part);
1639 current = current->
children[part].get();
1640 if (i==parts.size()-1)
1658 std::shared_ptr<Entry> fe = std::make_shared<Entry>();
1660 fe->name = tfi->
name;
1663 fe->tagInfoData.fileName = tfi->
filename;
1664 fe->hasTagInfo =
TRUE;
1667 fe->fileName = fullName;
1668 fe->startLine = tfi->
lineNr;
1675 mn->push_back(std::move(fd));
1680 mn->push_back(std::move(fd));
1683 root->moveToSubEntryAndKeep(fe);
1693 std::shared_ptr<Entry> ce = std::make_shared<Entry>();
1694 ce->section = EntryType::makeConcept();
1695 ce->name = tci->
name;
1698 ce->tagInfoData.fileName = tci->
filename;
1699 ce->startLine = tci->
lineNr;
1701 ce->hasTagInfo =
TRUE;
1704 root->moveToSubEntryAndKeep(ce);
1721 std::vector<const SectionInfo *> anchorList;
1729 ta.label,ta.fileName,-1,ta.title,
1731 anchorList.push_back(si);
1735 p_warn(
"Duplicate anchor {} found",ta.label);
1750 std::shared_ptr<Entry> ne = std::make_shared<Entry>();
1751 ne->section = EntryType::makeNamespace();
1752 ne->name = tni->
name;
1755 ne->tagInfoData.fileName = tni->
filename;
1756 ne->startLine = tni->
lineNr;
1758 ne->hasTagInfo =
TRUE;
1762 root->moveToSubEntryAndKeep(ne);
1772 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1773 pe->section = EntryType::makePackage();
1774 pe->name = tpgi->
name;
1777 pe->tagInfoData.fileName = tpgi->
filename;
1778 pe->startLine = tpgi->
lineNr;
1780 pe->hasTagInfo =
TRUE;
1783 root->moveToSubEntryAndKeep(pe);
1793 std::shared_ptr<Entry> ge = std::make_shared<Entry>();
1794 ge->section = EntryType::makeGroupDoc();
1795 ge->name = tgi->
name;
1796 ge->type = tgi->
title;
1799 ge->tagInfoData.fileName = tgi->
filename;
1800 ge->startLine = tgi->
lineNr;
1802 ge->hasTagInfo =
TRUE;
1805 root->moveToSubEntryAndKeep(ge);
1817 const auto &children = root->children();
1818 auto i = std::find_if(children.begin(),children.end(),
1819 [&](
const std::shared_ptr<Entry> &e) { return e->name == sg; });
1820 if (i!=children.end())
1834 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1836 pe->section = isIndex ? EntryType::makeMainpageDoc() : EntryType::makePageDoc();
1837 pe->name = tpi->
name;
1838 pe->args = tpi->
title;
1839 for (
const auto &subpage : tpi->
subpages)
1843 pe->extends.emplace_back(
stripExtension(subpage),Protection::Public,Specifier::Normal);
1848 pe->startLine = tpi->
lineNr;
1850 pe->hasTagInfo =
TRUE;
1851 root->moveToSubEntryAndKeep(pe);
1861 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1862 pe->section = EntryType::makeRequirementDoc();
1864 pe->type = tri->
title;
1866 pe->tagInfoData.fileName = tri->
filename;
1867 pe->startLine = tri->
lineNr;
1869 pe->hasTagInfo =
true;
1871 root->moveToSubEntryAndKeep(pe);
1887 for (
const auto &fd : *fn)
1893 for (
const auto &ii : tfi->
includes)
1900 for (
const auto &ifd : *ifn)
1904 if (ifd->getOutputFileBase()==ii.id)
1911 else if (ii.isImported)
1915 else if (ii.isLocal)
1919 fd->addIncludeDependency(ifd.get(),ii.text,kind);
1941 handlers.
startDocument = [&tagFileParser]() { tagFileParser.startDocument(); };
1943 handlers.
endElement = [&tagFileParser](
const std::string &name) { tagFileParser.endElement(name); };
1944 handlers.
characters = [&tagFileParser](
const std::string &chars) { tagFileParser.characters(chars); };
1945 handlers.
error = [&tagFileParser](
const std::string &fileName,
int lineNr,
const std::string &
msg) { tagFileParser.error(fileName,lineNr,
msg); };
1947 tagFileParser.setDocumentLocator(&parser);
1949 [&]() { DebugLex::print(Debug::Lex_xml,
"Entering",
"libxml/xml.l",fullName); },
1950 [&]() { DebugLex::print(Debug::Lex_xml,
"Finished",
"libxml/xml.l",fullName); }
1952 tagFileParser.buildLists(root);
1953 tagFileParser.addIncludes();
1956 tagFileParser.dump();
static bool looksGenerated(const std::string &anchor)
Returns true if anchor is a potentially generated anchor.
This class represents an function or template argument list.
void push_back(const Argument &a)
static bool isFlagSet(const DebugMask mask)
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
virtual void addSectionsToDefinition(const std::vector< const SectionInfo * > &anchorList)=0
Class representing a directory in the file system.
static FileNameLinkedMap * inputNameLinkedMap
Class representing all files with a certain base name.
static ModuleManager & instance()
This is an alternative implementation of QCString.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
class that provide information about a section.
SectionInfo * replace(const QCString &label, const QCString &fileName, int lineNr, const QCString &title, SectionType type, int level, const QCString &ref=QCString())
SectionInfo * add(const SectionInfo &si)
static SectionManager & instance()
returns a reference to the singleton
static constexpr int Anchor
Wrapper class for a number of boolean properties.
Event handlers that can installed by the client and called while parsing a XML document.
std::unordered_map< std::string, std::string > Attributes
std::function< EndElementType > endElement
handler invoked when a closing tag has been found
std::function< StartElementType > startElement
handler invoked when an opening tag has been found
std::function< CharsType > characters
handler invoked when content between tags has been found
static std::string value(const Attributes &attrib, const std::string &key)
std::function< ErrorType > error
handler invoked when the parser encounters an error
std::function< StartDocType > startDocument
handler invoked at the start of the document
void parse(const char *fileName, const char *inputString, bool debugEnabled, std::function< void()> debugStart, std::function< void()> debugEnd, std::function< Transcode > transcoder=[](std::string &s, const char *){ return true;})
TagAnchorInfo(const QCString &f, const QCString &l, const QCString &t=QCString())
Variant class that holds a unique pointer to one of the specific container types.
TagPageInfo * getPageInfo()
const TagDirInfo * getDirInfo() const
TagGroupInfo * getGroupInfo()
const R * get() const
Generic const getter.
const TagConceptInfo * getConceptInfo() const
TagModuleInfo * getModuleInfo()
TagNamespaceInfo * getNamespaceInfo()
static TagCompoundVariant make(Args &&... args)
Generic factory method to create a variant holding a unique pointer to a given compound type.
const TagPackageInfo * getPackageInfo() const
const TagGroupInfo * getGroupInfo() const
TagConceptInfo * getConceptInfo()
TagDirInfo * getDirInfo()
const TagModuleInfo * getModuleInfo() const
TagRequirementInfo * getRequirementInfo()
const TagClassInfo * getClassInfo() const
TagCompoundVariant(VariantT &&v)
const TagPageInfo * getPageInfo() const
TagPackageInfo * getPackageInfo()
const TagFileInfo * getFileInfo() const
TagFileInfo * getFileInfo()
const TagNamespaceInfo * getNamespaceInfo() const
R * get()
Generic non-const getter.
TagCompoundInfo * getCompoundInfo()
Convenience method to get the shared compound info.
std::variant< std::monostate, TagClassInfoPtr, TagConceptInfoPtr, TagNamespaceInfoPtr, TagPackageInfoPtr, TagFileInfoPtr, TagGroupInfoPtr, TagPageInfoPtr, TagDirInfoPtr, TagModuleInfoPtr, TagRequirementInfoPtr > VariantT
TagClassInfo * getClassInfo()
const TagRequirementInfo * getRequirementInfo() const
Container for enum values that are scoped within an enum.
void addDocAnchors(const std::shared_ptr< Entry > &e, const std::vector< TagAnchorInfo > &l)
void startIncludes(const XMLHandlers::Attributes &attrib)
void startDocAnchor(const XMLHandlers::Attributes &attrib)
void endElement(const QCString &name)
TagFileParser(const char *tagName)
void startElement(const QCString &name, const XMLHandlers::Attributes &attrib)
const XMLLocator * m_locator
void startStringValue(const XMLHandlers::Attributes &)
void setDocumentLocator(const XMLLocator *locator)
TagCompoundVariant m_curCompound
void startBase(const XMLHandlers::Attributes &attrib)
void error(const QCString &fileName, int lineNr, const QCString &msg)
TagMemberInfo m_curMember
void startIgnoreElement(const XMLHandlers::Attributes &)
void characters(const QCString &ch)
void buildLists(const std::shared_ptr< Entry > &root)
TagEnumValueInfo m_curEnumValue
void startMember(const XMLHandlers::Attributes &attrib)
void buildMemberList(const std::shared_ptr< Entry > &ce, const std::vector< TagMemberInfo > &members)
void buildClassEntry(const std::shared_ptr< Entry > &root, const TagClassInfo *tci)
void startCompound(const XMLHandlers::Attributes &attrib)
void buildClassTree(const std::shared_ptr< Entry > &root, const ClassNode &node)
TagIncludeInfo m_curIncludes
std::vector< TagCompoundVariant > m_tagFileCompounds
std::stack< State > m_stateStack
void startEnumValue(const XMLHandlers::Attributes &attrib)
Container for include info that can be read from a tagfile.
Container for member specific info that can be read from a tagfile.
std::vector< TagEnumValueInfo > enumValues
std::vector< TagAnchorInfo > docAnchors
#define ONLY_DEFAULT_MOVABLE(cls)
Macro to help implementing the rule of 5 for a class that can be moved but not copied.
std::vector< std::string > StringVector
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=nullptr)
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
#define warn(file, line, fmt,...)
std::unique_ptr< TagPackageInfo > TagPackageInfoPtr
std::unique_ptr< TagRequirementInfo > TagRequirementInfoPtr
std::unique_ptr< TagFileInfo > TagFileInfoPtr
std::unique_ptr< TagClassInfo > TagClassInfoPtr
std::unique_ptr< TagNamespaceInfo > TagNamespaceInfoPtr
std::unique_ptr< TagDirInfo > TagDirInfoPtr
static const std::map< std::string, CompoundFactory > g_compoundFactory
std::unique_ptr< TagConceptInfo > TagConceptInfoPtr
std::unique_ptr< TagModuleInfo > TagModuleInfoPtr
std::unique_ptr< TagPageInfo > TagPageInfoPtr
ElementCallbacks::EndCallback endCb(void(TagFileParser::*fn)())
static const std::map< std::string, ElementCallbacks > g_elementHandlers
ElementCallbacks::StartCallback startCb(void(TagFileParser::*fn)(const XMLHandlers::Attributes &))
std::unique_ptr< TagGroupInfo > TagGroupInfoPtr
This class contains the information about the argument of a function or template.
This class stores information about an inheritance relation.
QCString name
the name of the base class
@ GROUPING_INGROUP
membership in group was defined by @ingroup
CompoundFactory(TagFileParser::State s, const CreateFunc &f)
TagFileParser::State state
std::function< TagCompoundVariant()> CreateFunc
std::function< void(TagFileParser &, const XMLHandlers::Attributes &)> StartCallback
std::function< void(TagFileParser &)> EndCallback
Container for class specific info that can be read from a tagfile.
StringVector templateArguments
std::vector< BaseInfo > bases
Base class for all compound types.
std::vector< TagAnchorInfo > docAnchors
std::vector< TagMemberInfo > members
Container for concept specific info that can be read from a tagfile.
Container for directory specific info that can be read from a tagfile.
Container for file specific info that can be read from a tagfile.
StringVector namespaceList
std::vector< TagIncludeInfo > includes
std::unordered_map< std::string, std::unique_ptr< ClassNode > > children
ClassNode(const std::string &n)
Container for group specific info that can be read from a tagfile.
StringVector namespaceList
StringVector subgroupList
Container for module specific info that can be read from a tagfile.
Container for namespace specific info that can be read from a tagfile.
StringVector namespaceList
Container for package specific info that can be read from a tagfile.
Container for page specific info that can be read from a tagfile.
Container for requirement specific info that can be read from a tagfile.
void parseTagFile(const std::shared_ptr< Entry > &root, const char *fullName)
QCString stripPath(const QCString &s)
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
QCString stripExtension(const QCString &fName)
EntryType guessSection(const QCString &name)
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
QCString getFileNameExtension(const QCString &fn)
A bunch of utility functions.