118 enum class Kind {
None=-1,
Class,
Struct,
Record,
Union,
Interface,
Exception,
Protocol,
Category, Enum,
Service,
Singleton };
263 std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&
m_variant);
264 return p ? p->get() :
nullptr;
270 const std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&
m_variant);
271 return p ? p->get() :
nullptr;
275 template<
class R,
typename... Args>
343#define p_warn(fmt,...) do { \
344 warn(m_locator->fileName(),m_locator->lineNr(),fmt,##__VA_ARGS__); \
362 void endElement(
const DString &name );
366 warn(fileName,lineNr,
"{}",
msg);
370 void buildLists(
const std::shared_ptr<Entry> &root);
391 p_warn(
"tag 'compound' was not expected!");
405 if (protStr==
"protected")
409 else if (protStr==
"private")
413 if (virtStr==
"virtual")
417 else if (virtStr==
"pure")
421 if (staticStr==
"yes")
425 if (!typeStr.
empty())
453 p_warn(
"Unexpected tag 'member' found");
472 p_warn(
"Found 'enumvalue' tag outside of member tag");
506 p_warn(
"Unexpected tag 'docanchor' found");
570 p_warn(
"Unexpected tag 'class' found");
598 p_warn(
"Unexpected tag 'concept' found");
614 p_warn(
"Unexpected tag 'module' found");
642 p_warn(
"Unexpected tag 'namespace' found");
664 p_warn(
"Unexpected tag 'file' found");
680 p_warn(
"Unexpected tag 'page' found");
696 p_warn(
"Unexpected tag 'subpage' found");
712 p_warn(
"Unexpected tag 'dir' found");
737 p_warn(
"Unexpected tag 'type' found");
763 p_warn(
"Unexpected tag 'name' found");
779 p_warn(
"Unexpected tag 'id' found");
794 if (protStr==
"protected")
796 prot = Protection::Protected;
798 else if (protStr==
"private")
800 prot = Protection::Private;
802 if (virtStr==
"virtual")
804 virt = Specifier::Virtual;
810 p_warn(
"Unexpected tag 'base' found");
823 p_warn(
"Unexpected tag 'base' found");
849 p_warn(
"Unexpected tag 'includes' found");
862 p_warn(
"Unexpected tag 'templarg' found");
886 p_warn(
"Unexpected tag 'filename' found");
908 p_warn(
"Unexpected tag 'path' found");
926 p_warn(
"Unexpected tag 'anchor' found");
948 p_warn(
"Unexpected tag 'clangid' found");
962 p_warn(
"Unexpected tag 'anchorfile' found");
974 p_warn(
"Unexpected tag 'arglist' found");
1001 p_warn(
"Unexpected tag 'title' found");
1015 p_warn(
"Unexpected tag 'subgroup' found");
1027 void buildMemberList(
const std::shared_ptr<Entry> &ce,
const std::vector<TagMemberInfo> &members);
1028 void addDocAnchors(
const std::shared_ptr<Entry> &e,
const std::vector<TagAnchorInfo> &l);
1053 std::unordered_map<std::string,std::unique_ptr<ClassNode>>
children;
1173 it->second.startCb(*
this,attrib);
1177 p_warn(
"Unknown start tag '{}' found!",name);
1187 it->second.endCb(*
this);
1191 p_warn(
"Unknown end tag '{}' found!",name);
1211 p_warn(
"Unknown compound attribute '{}' found!",kind);
1216 if (isObjC==
"yes" && classInfo)
1218 classInfo->
isObjC =
true;
1239 for (
const auto &md : cd->
members)
1285 for (
const auto &md : nd->
members)
1314 for (
const auto &md : fd->
members)
1323 for (
const auto &ii : fd->
includes)
1347 for (
const auto &fi : gd->
fileList)
1355 for (
const auto &pg : gd->
pageList)
1360 for (
const auto &md : gd->
members)
1392 for (
const auto &fi : dd->
fileList)
1420 for (
const auto &ta : l)
1427 ta.label,ta.fileName,-1,ta.title,
1429 e->anchors.push_back(si);
1436 ta.label,ta.fileName,-1,ta.title,
1444 for (
const auto &tmi : members)
1446 std::shared_ptr<Entry> me = std::make_shared<Entry>();
1447 me->type = tmi.type;
1448 me->name = tmi.name;
1449 me->args = tmi.arglist;
1450 if (!me->args.empty())
1454 if (tmi.enumValues.size()>0)
1456 me->spec.setStrong(
true);
1457 for (
const auto &evi : tmi.enumValues)
1459 std::shared_ptr<Entry> ev = std::make_shared<Entry>();
1461 ev->name = evi.name;
1462 ev->id = evi.clangid;
1463 ev->section = EntryType::makeVariable();
1465 ev->tagInfoData.anchor = evi.anchor;
1466 ev->tagInfoData.fileName = evi.file;
1467 ev->hasTagInfo =
true;
1468 me->moveToSubEntryAndKeep(ev);
1471 me->protection = tmi.prot;
1472 me->virt = tmi.virt;
1473 me->isStatic = tmi.isStatic;
1474 me->fileName = ce->fileName;
1475 me->id = tmi.clangId;
1476 me->startLine = tmi.lineNr;
1477 if (ce->section.isGroupDoc())
1483 me->tagInfoData.anchor = tmi.anchor;
1484 me->tagInfoData.fileName = tmi.anchorFile;
1485 me->hasTagInfo =
true;
1486 if (tmi.kind==
"define")
1489 me->section = EntryType::makeDefine();
1491 else if (tmi.kind==
"enumvalue")
1493 me->section = EntryType::makeVariable();
1494 me->mtype = MethodTypes::Method;
1496 else if (tmi.kind==
"property")
1498 me->section = EntryType::makeVariable();
1499 me->mtype = MethodTypes::Property;
1501 else if (tmi.kind==
"event")
1503 me->section = EntryType::makeVariable();
1504 me->mtype = MethodTypes::Event;
1506 else if (tmi.kind==
"variable")
1508 me->section = EntryType::makeVariable();
1509 me->mtype = MethodTypes::Method;
1511 else if (tmi.kind==
"typedef")
1513 me->section = EntryType::makeVariable();
1514 me->type.prepend(
"typedef ");
1515 me->mtype = MethodTypes::Method;
1517 else if (tmi.kind==
"enumeration")
1519 me->section = EntryType::makeEnum();
1520 me->mtype = MethodTypes::Method;
1522 else if (tmi.kind==
"function")
1524 me->section = EntryType::makeFunction();
1525 me->mtype = MethodTypes::Method;
1527 else if (tmi.kind==
"signal")
1529 me->section = EntryType::makeFunction();
1530 me->mtype = MethodTypes::Signal;
1532 else if (tmi.kind==
"prototype")
1534 me->section = EntryType::makeFunction();
1535 me->mtype = MethodTypes::Method;
1537 else if (tmi.kind==
"friend")
1539 me->section = EntryType::makeFunction();
1540 me->type.prepend(
"friend ");
1541 me->mtype = MethodTypes::Method;
1543 else if (tmi.kind==
"dcop")
1545 me->section = EntryType::makeFunction();
1546 me->mtype = MethodTypes::DCOP;
1548 else if (tmi.kind==
"slot")
1550 me->section = EntryType::makeFunction();
1551 me->mtype = MethodTypes::Slot;
1553 ce->moveToSubEntryAndKeep(me);
1559 std::shared_ptr<Entry> ce = std::make_shared<Entry>();
1560 ce->section = EntryType::makeClass();
1578 ce->name = tci->
name;
1585 ce->tagInfoData.anchor = tci->
anchor;
1586 ce->tagInfoData.fileName = tci->
filename;
1587 ce->startLine = tci->
lineNr;
1589 ce->hasTagInfo =
true;
1591 ce->lang = tci->
isObjC ? SrcLangExt::ObjC : SrcLangExt::Unknown;
1593 ce->extends = tci->
bases;
1608 root->moveToSubEntryAndKeep(ce);
1617 for (
const auto &child : node.
children)
1641 for (
size_t i=0; i<parts.size(); ++i)
1643 const auto &part = parts[i];
1646 current->
children[part] = std::make_unique<ClassNode>(part);
1648 current = current->
children[part].get();
1649 if (i==parts.size()-1)
1667 std::shared_ptr<Entry> fe = std::make_shared<Entry>();
1669 fe->name = tfi->
name;
1672 fe->tagInfoData.fileName = tfi->
filename;
1673 fe->hasTagInfo =
true;
1676 fe->fileName = fullName;
1677 fe->startLine = tfi->
lineNr;
1684 mn->push_back(std::move(fd));
1689 mn->push_back(std::move(fd));
1692 root->moveToSubEntryAndKeep(fe);
1702 std::shared_ptr<Entry> ce = std::make_shared<Entry>();
1703 ce->section = EntryType::makeConcept();
1704 ce->name = tci->
name;
1707 ce->tagInfoData.fileName = tci->
filename;
1708 ce->startLine = tci->
lineNr;
1710 ce->hasTagInfo =
true;
1713 root->moveToSubEntryAndKeep(ce);
1730 std::vector<const SectionInfo *> anchorList;
1738 ta.label,ta.fileName,-1,ta.title,
1740 anchorList.push_back(si);
1744 p_warn(
"Duplicate anchor {} found",ta.label);
1759 std::shared_ptr<Entry> ne = std::make_shared<Entry>();
1760 ne->section = EntryType::makeNamespace();
1761 ne->name = tni->
name;
1764 ne->tagInfoData.fileName = tni->
filename;
1765 ne->startLine = tni->
lineNr;
1767 ne->hasTagInfo =
true;
1771 root->moveToSubEntryAndKeep(ne);
1781 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1782 pe->section = EntryType::makePackage();
1783 pe->name = tpgi->
name;
1786 pe->tagInfoData.fileName = tpgi->
filename;
1787 pe->startLine = tpgi->
lineNr;
1789 pe->hasTagInfo =
true;
1792 root->moveToSubEntryAndKeep(pe);
1802 std::shared_ptr<Entry> ge = std::make_shared<Entry>();
1803 ge->section = EntryType::makeGroupDoc();
1804 ge->name = tgi->
name;
1805 ge->type = tgi->
title;
1808 ge->tagInfoData.fileName = tgi->
filename;
1809 ge->startLine = tgi->
lineNr;
1811 ge->hasTagInfo =
true;
1814 root->moveToSubEntryAndKeep(ge);
1826 const auto &children = root->children();
1827 auto i = std::find_if(children.begin(),children.end(),
1828 [&](
const std::shared_ptr<Entry> &e) { return e->name == sg; });
1829 if (i!=children.end())
1843 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1845 pe->section = isIndex ? EntryType::makeMainpageDoc() : EntryType::makePageDoc();
1846 pe->name = tpi->
name;
1847 pe->args = tpi->
title;
1848 for (
const auto &subpage : tpi->
subpages)
1852 pe->extends.emplace_back(
stripExtension(subpage),Protection::Public,Specifier::Normal);
1857 pe->startLine = tpi->
lineNr;
1859 pe->hasTagInfo =
true;
1860 root->moveToSubEntryAndKeep(pe);
1870 std::shared_ptr<Entry> pe = std::make_shared<Entry>();
1871 pe->section = EntryType::makeRequirementDoc();
1873 pe->type = tri->
title;
1875 pe->tagInfoData.fileName = tri->
filename;
1876 pe->startLine = tri->
lineNr;
1878 pe->hasTagInfo =
true;
1880 root->moveToSubEntryAndKeep(pe);
1896 for (
const auto &fd : *fn)
1902 for (
const auto &ii : tfi->
includes)
1909 for (
const auto &ifd : *ifn)
1913 if (ifd->getOutputFileBase()==ii.id)
1920 else if (ii.isImported)
1924 else if (ii.isLocal)
1928 fd->addIncludeDependency(ifd.get(),ii.text,kind);
1950 handlers.
startDocument = [&tagFileParser]() { tagFileParser.startDocument(); };
1952 handlers.
endElement = [&tagFileParser](
const std::string &name) { tagFileParser.endElement(name); };
1953 handlers.
characters = [&tagFileParser](
const std::string &chars) { tagFileParser.characters(chars); };
1954 handlers.
error = [&tagFileParser](
const std::string &fileName,
int lineNr,
const std::string &
msg) { tagFileParser.error(fileName,lineNr,
msg); };
1956 tagFileParser.setDocumentLocator(&parser);
1958 [&]() { DebugLex::print(Debug::Lex_xml,
"Entering",
"libxml/xml.l",fullName); },
1959 [&]() { DebugLex::print(Debug::Lex_xml,
"Finished",
"libxml/xml.l",fullName); }
1961 tagFileParser.buildLists(root);
1962 tagFileParser.addIncludes();
1965 tagFileParser.dump();
static bool looksGenerated(const std::string &anchor)
Returns true if anchor is a potentially generated anchor.
This class contains the information about the argument of a function or template.
This class represents an function or template argument list.
void push_back(const Argument &a)
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString 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.
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
static EntryType guessSection(const DString &name)
Class representing all files with a certain base name.
T * add(const char *k, Args &&... args)
const T * find(const std::string &key) const
static ModuleManager & instance()
class that provide information about a section.
SectionInfo * replace(const DString &label, const DString &fileName, int lineNr, const DString &title, SectionType type, int level, const DString &ref=DString())
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 DString &f, const DString &l, const DString &t=DString())
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)
TagFileParser(const char *tagName)
const XMLLocator * m_locator
void startStringValue(const XMLHandlers::Attributes &)
void setDocumentLocator(const XMLLocator *locator)
TagCompoundVariant m_curCompound
void startBase(const XMLHandlers::Attributes &attrib)
void characters(const DString &ch)
TagMemberInfo m_curMember
void startIgnoreElement(const XMLHandlers::Attributes &)
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 endElement(const DString &name)
void buildClassTree(const std::shared_ptr< Entry > &root, const ClassNode &node)
TagIncludeInfo m_curIncludes
std::vector< TagCompoundVariant > m_tagFileCompounds
void startElement(const DString &name, const XMLHandlers::Attributes &attrib)
std::stack< State > m_stateStack
void error(const DString &fileName, int lineNr, const DString &msg)
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 DString &argsString, DString *extraTypeChars=nullptr)
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &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
Some helper functions for std::string.
StringVector split(const std::string &s, const std::string &delimiter, bool retainEmpty=false)
split input string s by string delimiter delimiter.
This class stores information about an inheritance relation.
DString 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)
DString stripExtension(const DString &fName)
DString stripExtensionGeneral(const DString &fName, const DString &ext)
DString getFileNameExtension(const DString &fn)
DString fileToString(const DString &name, bool filter, bool isSourceCode)
DString stripPath(const DString &s)
A bunch of utility functions.