Doxygen
Loading...
Searching...
No Matches
namespacedef.h File Reference
#include <memory>
#include <unordered_set>
#include "definition.h"
#include "filedef.h"
#include "linkedmap.h"
#include "membergroup.h"
Include dependency graph for namespacedef.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  NamespaceLinkedMap
class  NamespaceLinkedRefMap
class  NamespaceDef
 An abstract interface of a namespace symbol. More...
class  NamespaceDefMutable

Typedefs

using NamespaceDefSet = std::unordered_set<const NamespaceDef*>

Functions

std::unique_ptr< NamespaceDefcreateNamespaceDef (const QCString &defFileName, int defLine, int defColumn, const QCString &name, const QCString &ref=QCString(), const QCString &refFile=QCString(), const QCString &type=QCString(), bool isPublished=false)
 Factory method to create new NamespaceDef instance.
std::unique_ptr< NamespaceDefcreateNamespaceDefAlias (const Definition *newScope, const NamespaceDef *nd)
 Factory method to create an alias of an existing namespace.
NamespaceDeftoNamespaceDef (Definition *d)
NamespaceDeftoNamespaceDef (DefinitionMutable *d)
const NamespaceDeftoNamespaceDef (const Definition *d)
NamespaceDefMutabletoNamespaceDefMutable (Definition *d)
void replaceNamespaceAliases (QCString &name)
NamespaceDefgetResolvedNamespace (const QCString &key)
NamespaceDefMutablegetResolvedNamespaceMutable (const QCString &key)
bool namespaceHasNestedNamespace (const NamespaceDef *nd)
bool namespaceHasNestedConcept (const NamespaceDef *nd)
bool namespaceHasNestedClass (const NamespaceDef *nd, bool filterClasses, ClassDef::CompoundType ct)

Typedef Documentation

◆ NamespaceDefSet

using NamespaceDefSet = std::unordered_set<const NamespaceDef*>

Definition at line 39 of file namespacedef.h.

Function Documentation

◆ createNamespaceDef()

std::unique_ptr< NamespaceDef > createNamespaceDef ( const QCString & defFileName,
int defLine,
int defColumn,
const QCString & name,
const QCString & ref = QCString(),
const QCString & refFile = QCString(),
const QCString & type = QCString(),
bool isPublished = false )

Factory method to create new NamespaceDef instance.

Definition at line 173 of file namespacedef.cpp.

177{
178 //printf("createNamespaceDef(%s)\n",qPrint(name));
179 return std::make_unique<NamespaceDefImpl>(defFileName,defLine,defColumn,name,ref,refFile,type,isPublished);
180}

Referenced by adjustConfiguration(), buildNamespaceList(), buildScopeFromQualifiedName(), findUsingDirectives(), and NamespaceDefMutable::setInline().

◆ createNamespaceDefAlias()

std::unique_ptr< NamespaceDef > createNamespaceDefAlias ( const Definition * newScope,
const NamespaceDef * nd )

Factory method to create an alias of an existing namespace.

Used for inline namespaces.

Definition at line 261 of file namespacedef.cpp.

262{
263 auto alnd = std::make_unique<NamespaceDefAliasImpl>(newScope,nd);
264 //printf("alnd name=%s localName=%s qualifiedName=%s displayName()=%s\n",
265 // qPrint(alnd->name()),qPrint(alnd->localName()),qPrint(alnd->qualifiedName()),
266 // qPrint(alnd->displayName()));
267 return alnd;
268}

Referenced by buildNamespaceList(), and NamespaceDefMutable::setInline().

◆ getResolvedNamespace()

NamespaceDef * getResolvedNamespace ( const QCString & key)

Definition at line 1830 of file namespacedef.cpp.

1831{
1832 //printf("> getResolvedNamespace(%s)\n",qPrint(name));
1833 if (name.isEmpty()) return nullptr;
1834 StringSet namespacesTried;
1835 auto ns = getResolvedNamespaceRec(namespacesTried,NamespaceAliasInfo(name.str()));
1836 //printf("< getResolvedNamespace(%s)=%s\n",qPrint(name),ns?qPrint(ns->qualifiedName()):"nullptr");
1837 return ns;
1838}
std::set< std::string > StringSet
Definition containers.h:31
static NamespaceDef * getResolvedNamespaceRec(StringSet &namespacesTried, const NamespaceAliasInfo &aliasInfo)

References getResolvedNamespaceRec(), QCString::isEmpty(), and QCString::str().

Referenced by addMemberFunction(), buildFunctionList(), buildTypedefList(), extractNamespaceName(), findUsedNamespace(), findUsingDeclImports(), findUsingDirectives(), generateClassOrGlobalLink(), generateClassOrGlobalLink(), getResolvedNamespaceMutable(), CCodeParser::parseCode(), NamespaceDefMutable::setInline(), and writeAlphabeticalClassList().

◆ getResolvedNamespaceMutable()

NamespaceDefMutable * getResolvedNamespaceMutable ( const QCString & key)
inline

Definition at line 151 of file namespacedef.h.

152{
154}
NamespaceDef * getResolvedNamespace(const QCString &key)
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)

References getResolvedNamespace(), getResolvedNamespaceMutable(), and toNamespaceDefMutable().

Referenced by addEnumValuesToEnums(), addGlobalFunction(), addVariableToFile(), findEnums(), findUsingDeclarations(), findUsingDirectives(), and getResolvedNamespaceMutable().

◆ namespaceHasNestedClass()

bool namespaceHasNestedClass ( const NamespaceDef * nd,
bool filterClasses,
ClassDef::CompoundType ct )

Definition at line 1878 of file namespacedef.cpp.

1879{
1880 //printf(">namespaceHasNestedClass(%s,filterClasses=%d)\n",qPrint(nd->name()),filterClasses);
1881 for (const auto &cnd : nd->getNamespaces())
1882 {
1883 if (namespaceHasNestedClass(cnd,filterClasses,ct))
1884 {
1885 //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case1\n",qPrint(nd->name()),filterClasses);
1886 return true;
1887 }
1888 }
1889
1890 ClassLinkedRefMap list = nd->getClasses();
1891 if (filterClasses)
1892 {
1893 switch (ct)
1894 {
1896 list = nd->getInterfaces();
1897 break;
1898 case ClassDef::Struct:
1899 list = nd->getStructs();
1900 break;
1902 list = nd->getExceptions();
1903 break;
1904 default:
1905 break;
1906 }
1907 }
1908
1909 for (const auto &cd : list)
1910 {
1911 //printf("candidate %s isLinkableInProject()=%d\n",qPrint(cd->name()),cd->isLinkableInProject());
1912 if (cd->isLinkableInProject())
1913 {
1914 //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case2\n",qPrint(nd->name()),filterClasses);
1915 return true;
1916 }
1917 }
1918 //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case3\n",qPrint(nd->name()),filterClasses);
1919 return false;
1920}
@ Interface
Definition classdef.h:112
@ Exception
Definition classdef.h:115
virtual ClassLinkedRefMap getStructs() const =0
virtual ClassLinkedRefMap getExceptions() const =0
virtual NamespaceLinkedRefMap getNamespaces() const =0
virtual ClassLinkedRefMap getClasses() const =0
virtual ClassLinkedRefMap getInterfaces() const =0
bool namespaceHasNestedClass(const NamespaceDef *nd, bool filterClasses, ClassDef::CompoundType ct)

References ClassDef::Exception, NamespaceDef::getClasses(), NamespaceDef::getExceptions(), NamespaceDef::getInterfaces(), NamespaceDef::getNamespaces(), NamespaceDef::getStructs(), ClassDef::Interface, namespaceHasNestedClass(), and ClassDef::Struct.

Referenced by namespaceHasNestedClass(), writeClassTreeInsideNamespaceElement(), and writeNamespaceTreeElement().

◆ namespaceHasNestedConcept()

bool namespaceHasNestedConcept ( const NamespaceDef * nd)

Definition at line 1854 of file namespacedef.cpp.

1855{
1856 //printf(">namespaceHasNestedConcept(%s)\n",qPrint(nd->name()));
1857 for (const auto &cnd : nd->getNamespaces())
1858 {
1860 {
1861 //printf("<namespaceHasNestedConcept(%s): case1\n",qPrint(nd->name()));
1862 return true;
1863 }
1864 }
1865 for (const auto &cnd : nd->getConcepts())
1866 {
1867 //printf("candidate %s isLinkableInProject()=%d\n",qPrint(cnd->name()),cnd->isLinkableInProject());
1868 if (cnd->isLinkableInProject())
1869 {
1870 //printf("<namespaceHasNestedConcept(%s): case2\n",qPrint(nd->name()));
1871 return true;
1872 }
1873 }
1874 //printf("<namespaceHasNestedConcept(%s): case3\n",qPrint(nd->name()));
1875 return false;
1876}
virtual ConceptLinkedRefMap getConcepts() const =0
bool namespaceHasNestedConcept(const NamespaceDef *nd)

References NamespaceDef::getConcepts(), NamespaceDef::getNamespaces(), and namespaceHasNestedConcept().

Referenced by namespaceHasNestedConcept(), writeConceptTreeInsideNamespaceElement(), and writeNamespaceTreeElement().

◆ namespaceHasNestedNamespace()

bool namespaceHasNestedNamespace ( const NamespaceDef * nd)

Definition at line 1842 of file namespacedef.cpp.

1843{
1844 for (const auto &cnd : nd->getNamespaces())
1845 {
1846 if (cnd->isLinkableInProject() && !cnd->isAnonymous())
1847 {
1848 return true;
1849 }
1850 }
1851 return false;
1852}

References NamespaceDef::getNamespaces().

Referenced by writeNamespaceTreeElement().

◆ replaceNamespaceAliases()

void replaceNamespaceAliases ( QCString & name)

Definition at line 1822 of file namespacedef.cpp.

1823{
1824 //printf("> replaceNamespaceAliases(%s)\n",qPrint(name));
1825 StringSet namespacesTried;
1826 name = replaceNamespaceAliasesRec(namespacesTried,name);
1827 //printf("< replaceNamespaceAliases: result=%s\n",qPrint(name));
1828}
static QCString replaceNamespaceAliasesRec(StringSet &namespacesTried, const QCString &name)

References replaceNamespaceAliasesRec().

Referenced by findClassRelation(), findUsedClassesForClass(), getMemberFromSymbol(), SymbolResolver::Private::getResolvedSymbolRec(), SymbolResolver::Private::getResolvedTypeRec(), and NamespaceDefMutable::setInline().

◆ toNamespaceDef() [1/3]

const NamespaceDef * toNamespaceDef ( const Definition * d)

Definition at line 1707 of file namespacedef.cpp.

1708{
1709 if (d && (typeid(*d)==typeid(NamespaceDefImpl) || typeid(*d)==typeid(NamespaceDefAliasImpl)))
1710 {
1711 return static_cast<const NamespaceDef*>(d);
1712 }
1713 else
1714 {
1715 return nullptr;
1716 }
1717}
An abstract interface of a namespace symbol.

◆ toNamespaceDef() [2/3]

◆ toNamespaceDef() [3/3]

NamespaceDef * toNamespaceDef ( DefinitionMutable * d)

Definition at line 1693 of file namespacedef.cpp.

1694{
1695 Definition *d = toDefinition(md);
1696 if (d && typeid(*d)==typeid(NamespaceDefImpl))
1697 {
1698 return static_cast<NamespaceDef*>(d);
1699 }
1700 else
1701 {
1702 return nullptr;
1703 }
1704}
The common base class of all entity definitions found in the sources.
Definition definition.h:77
Definition * toDefinition(DefinitionMutable *dm)

References toDefinition().

◆ toNamespaceDefMutable()