Doxygen
Loading...
Searching...
No Matches
classdef.h File Reference

#include <src/classdef.h>

Include dependency graph for classdef.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BaseClassDef
 Class that contains information about an inheritance relation. More...
struct  TemplateInstanceDef
 Class that contains information about a template instance relation. More...
class  ClassDef
 A abstract class representing of a compound symbol. More...
class  ClassDefMutable
struct  UsesClassDef
 Class that contains information about a usage relation. More...
class  UsesClassList
struct  ConstraintClassDef
 Class that contains information about a type constraint relations. More...
class  ConstraintClassList

Typedefs

using BaseClassList = std::vector<BaseClassDef>
using TemplateInstanceList = std::vector<TemplateInstanceDef>
using TemplateNameMap = std::map<std::string,int>
using ClassDefSet = std::unordered_set<const ClassDef*>

Functions

std::unique_ptr< ClassDef > createClassDef (const DString &fileName, int startLine, size_t startColumn, const DString &name, ClassDef::CompoundType ct, const DString &ref=DString(), const DString &fName=DString(), bool isSymbol=true, bool isJavaEnum=false)
 Factory method to create a new ClassDef object.
std::unique_ptr< ClassDef > createClassDefAlias (const Definition *newScope, const ClassDef *cd)
ClassDef * toClassDef (Definition *d)
ClassDef * toClassDef (DefinitionMutable *d)
const ClassDef * toClassDef (const Definition *d)
ClassDefMutable * toClassDefMutable (Definition *d)
ClassDef * getClass (const DString &key)
ClassDefMutable * getClassMutable (const DString &key)
bool classHasVisibleRoot (const BaseClassList &bcl)
bool classHasVisibleChildren (const ClassDef *cd)
bool classVisibleInIndex (const ClassDef *cd)
int minClassDistance (const ClassDef *cd, const ClassDef *bcd, int level=0)
Protection classInheritedProtectionLevel (const ClassDef *cd, const ClassDef *bcd, Protection prot=Protection::Public, int level=0)

Typedef Documentation

◆ BaseClassList

using BaseClassList = std::vector<BaseClassDef>

Definition at line 77 of file classdef.h.

◆ ClassDefSet

using ClassDefSet = std::unordered_set<const ClassDef*>

Definition at line 91 of file classdef.h.

◆ TemplateInstanceList

Definition at line 87 of file classdef.h.

◆ TemplateNameMap

using TemplateNameMap = std::map<std::string,int>

Definition at line 89 of file classdef.h.

Function Documentation

◆ classHasVisibleChildren()

bool classHasVisibleChildren ( const ClassDef * cd)

Definition at line 5631 of file classdef.cpp.

5632{
5633 BaseClassList bcl;
5634
5635 if (cd->getLanguage()==SrcLangExt::VHDL) // reverse baseClass/subClass relation
5636 {
5637 if (cd->baseClasses().empty()) return false;
5638 bcl=cd->baseClasses();
5639 }
5640 else
5641 {
5642 if (cd->subClasses().empty()) return false;
5643 bcl=cd->subClasses();
5644 }
5645
5646 for (const auto &bcd : bcl)
5647 {
5648 if (bcd.classDef->isVisibleInHierarchy())
5649 {
5650 return true;
5651 }
5652 }
5653 return false;
5654}
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
std::vector< BaseClassDef > BaseClassList
Definition classdef.h:77

References ClassDef::baseClasses(), Definition::getLanguage(), and ClassDef::subClasses().

Referenced by writeClassTreeForList(), and writeClassTreeToOutput().

◆ classHasVisibleRoot()

bool classHasVisibleRoot ( const BaseClassList & bcl)

Definition at line 5620 of file classdef.cpp.

5621{
5622 for (const auto &bcd : bcl)
5623 {
5624 const ClassDef *cd=bcd.classDef;
5625 if (cd->isVisibleInHierarchy()) return true;
5626 if (classHasVisibleRoot(cd->baseClasses())) return true;
5627 }
5628 return false;
5629}
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual bool isVisibleInHierarchy() const =0
the class is visible in a class diagram, or class hierarchy
bool classHasVisibleRoot(const BaseClassList &bcl)

References ClassDef::baseClasses(), classHasVisibleRoot(), and ClassDef::isVisibleInHierarchy().

Referenced by DotGfxHierarchyTable::addClassList(), DotGfxHierarchyTable::addHierarchy(), classHasVisibleRoot(), countClassesInTreeList(), writeClassTreeForList(), and writeClassTreeToOutput().

◆ classInheritedProtectionLevel()

Protection classInheritedProtectionLevel ( const ClassDef * cd,
const ClassDef * bcd,
Protection prot = Protection::Public,
int level = 0 )

Definition at line 5690 of file classdef.cpp.

5691{
5692 if (bcd->categoryOf()) // use class that is being extended in case of
5693 // an Objective-C category
5694 {
5695 bcd=bcd->categoryOf();
5696 }
5697 if (cd==bcd)
5698 {
5699 goto exit;
5700 }
5701 if (level==256)
5702 {
5703 err("Internal inconsistency: found class {} seem to have a recursive "
5704 "inheritance relation! Please send a bug report to doxygen@gmail.com\n",cd->name());
5705 }
5706 else if (prot!=Protection::Private)
5707 {
5708 for (const auto &bcdi : cd->baseClasses())
5709 {
5710 Protection baseProt = classInheritedProtectionLevel(bcdi.classDef,bcd,bcdi.prot,level+1);
5711 if (baseProt==Protection::Private) prot=Protection::Private;
5712 else if (baseProt==Protection::Protected) prot=Protection::Protected;
5713 }
5714 }
5715exit:
5716 //printf("classInheritedProtectionLevel(%s,%s)=%d\n",qPrint(cd->name()),qPrint(bcd->name()),prot);
5717 return prot;
5718}
virtual ClassDef * categoryOf() const =0
Returns the class of which this is a category (Objective-C only).
virtual const DString & name() const =0
Protection classInheritedProtectionLevel(const ClassDef *cd, const ClassDef *bcd, Protection prot, int level)
#define err(fmt,...)
Definition message.h:127
Protection
Definition types.h:32

References ClassDef::baseClasses(), ClassDef::categoryOf(), classInheritedProtectionLevel(), err, and Definition::name().

Referenced by classInheritedProtectionLevel().

◆ classVisibleInIndex()

bool classVisibleInIndex ( const ClassDef * cd)

Definition at line 5656 of file classdef.cpp.

5657{
5658 bool allExternals = Config_getBool(ALLEXTERNALS);
5659 return (allExternals && cd->isLinkable()) || cd->isLinkableInProject();
5660}
virtual bool isLinkable() const =0
virtual bool isLinkableInProject() const =0
#define Config_getBool(name)
Definition config.h:33

References Config_getBool, Definition::isLinkable(), and Definition::isLinkableInProject().

Referenced by writeClassTree().

◆ createClassDef()

std::unique_ptr< ClassDef > createClassDef ( const DString & fileName,
int startLine,
size_t startColumn,
const DString & name,
ClassDef::CompoundType ct,
const DString & ref = DString(),
const DString & fName = DString(),
bool isSymbol = true,
bool isJavaEnum = false )

Factory method to create a new ClassDef object.

Definition at line 584 of file classdef.cpp.

589{
590 return std::make_unique<ClassDefImpl>(fileName,startLine,startColumn,name,ct,ref,fName,isSymbol,isJavaEnum);
591}

Referenced by addClassToContext(), createTagLessInstance(), findClassRelation(), findUsedClassesForClass(), findUsingDeclarations(), and ClassDefMutable::setPrimaryConstructorParams().

◆ createClassDefAlias()

std::unique_ptr< ClassDef > createClassDefAlias ( const Definition * newScope,
const ClassDef * cd )

Definition at line 817 of file classdef.cpp.

818{
819 auto acd = std::make_unique<ClassDefAliasImpl>(newScope,cd);
820 //printf("cd name=%s localName=%s qualifiedName=%s qualifiedNameWith=%s displayName()=%s\n",
821 // qPrint(acd->name()),qPrint(acd->localName()),qPrint(acd->qualifiedName()),
822 // qPrint(acd->qualifiedNameWithTemplateParameters()),qPrint(acd->displayName()));
823 return acd;
824}

Referenced by ClassDefAliasImpl::deepCopy(), findUsingDeclImports(), resolveClassNestingRelations(), and ClassDefMutable::setPrimaryConstructorParams().

◆ getClass()

◆ getClassMutable()

◆ minClassDistance()

int minClassDistance ( const ClassDef * cd,
const ClassDef * bcd,
int level = 0 )

Definition at line 5666 of file classdef.cpp.

5667{
5668 const int maxInheritanceDepth = 100000;
5669 if (bcd->categoryOf()) // use class that is being extended in case of
5670 // an Objective-C category
5671 {
5672 bcd=bcd->categoryOf();
5673 }
5674 if (cd==bcd) return level;
5675 if (level==256)
5676 {
5677 warn_uncond("class {} seem to have a recursive inheritance relation!\n",cd->name());
5678 return -1;
5679 }
5680 int m=maxInheritanceDepth;
5681 for (const auto &bcdi : cd->baseClasses())
5682 {
5683 int mc=minClassDistance(bcdi.classDef,bcd,level+1);
5684 if (mc<m) m=mc;
5685 if (m<0) break;
5686 }
5687 return m;
5688}
int minClassDistance(const ClassDef *cd, const ClassDef *bcd, int level)
#define warn_uncond(fmt,...)
Definition message.h:122

References ClassDef::baseClasses(), ClassDef::categoryOf(), minClassDistance(), Definition::name(), and warn_uncond.

Referenced by ClassDefImpl::getMemberByName(), and minClassDistance().

◆ toClassDef() [1/3]

const ClassDef * toClassDef ( const Definition * d)

Definition at line 5585 of file classdef.cpp.

5586{
5587 if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
5588 {
5589 return static_cast<const ClassDef*>(d);
5590 }
5591 else
5592 {
5593 return nullptr;
5594 }
5595}
Implementation of the ClassDef interface.
Definition classdef.cpp:202

◆ toClassDef() [2/3]

ClassDef * toClassDef ( Definition * d)

◆ toClassDef() [3/3]

ClassDef * toClassDef ( DefinitionMutable * d)

Definition at line 5572 of file classdef.cpp.

5573{
5574 Definition *d = toDefinition(md);
5575 if (d && typeid(*d)==typeid(ClassDefImpl))
5576 {
5577 return static_cast<ClassDef*>(d);
5578 }
5579 else
5580 {
5581 return nullptr;
5582 }
5583}
The common base class of all entity definitions found in the sources.
Definition definition.h:77
Definition * toDefinition(DefinitionMutable *dm)

References toDefinition().

◆ toClassDefMutable()

ClassDefMutable * toClassDefMutable ( Definition * d)

Definition at line 5597 of file classdef.cpp.

5598{
5599 if (d && typeid(*d)==typeid(ClassDefImpl))
5600 {
5601 return static_cast<ClassDefMutable*>(d);
5602 }
5603 else
5604 {
5605 return nullptr;
5606 }
5607}

Referenced by addClassAndNestedClasses(), addClassToContext(), addClassToGroups(), ModuleDefImpl::addClassToModule(), ModuleManager::addClassToModule(), addMembersToMemberGroup(), ClassDefImpl::addMembersToTemplateInstance(), addMemberToGroups(), ClassDefImpl::addTypeConstraint(), applyToAllDefinitions(), buildCompleteMemberLists(), computeMemberReferences(), computeTemplateClassRelations(), VhdlDocGen::computeVhdlComponentRelations(), ClassDefImpl::countInheritedDecMembers(), countMembers(), createTagLessInstance(), createTemplateInstanceMembers(), ClassDefImpl::deepCopy(), distributeClassGroupRelations(), distributeMemberGroupDocumentation(), findClassRelation(), findSectionsInDocumentation(), findTemplateInstanceRelation(), findUsedClassesForClass(), findUsingDeclarations(), findUsingDeclImports(), generateClassDocs(), generateClassOrGlobalLink(), generateNamespaceClassDocs(), MemberDefImpl::getClassDefMutable(), getClassMutable(), ClassDefImpl::hideDerivedVariablesInPython(), insertMemberAlias(), ClassDefImpl::insertTemplateInstance(), ClassDefImpl::insertUsedFile(), ClassDefImpl::internalInsertMember(), mergeCategories(), ClassDefImpl::mergeCategory(), ClassDefImpl::mergeMembers(), ClassDefImpl::mergeMembersFromBaseClasses(), SymbolResolver::resolveClassMutable(), resolveClassNestingRelations(), setAnonymousEnumType(), ClassDefImpl::setGroupDefForAllMembers(), ClassDefMutable::setPrimaryConstructorParams(), sortMemberLists(), ClassDefImpl::writeInheritedMemberDeclarations(), and writeTagFile().