Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CppImport::MacroExpansions Class Reference

creates and stores all MacroExpansions for a translation unit. More...

Public Types

enum  NodeOriginType { Transitive , Direct }
 used to change the origin criterium for what nodes are returned by method topLevelNodes. More...
 

Public Member Functions

 MacroExpansions (ClangHelpers &clang, const MacroDefinitions &macroDefinitions)
 
void addMacroExpansion (clang::SourceRange sourceRange, const clang::MacroDirective *macroDirective, const clang::MacroArgs *macroArguments)
 
void clear ()
 
QList< MacroExpansion * > expansions () const
 
QSet< MacroExpansion * > expansions (Model::Node *node)
 return all expansions that node is a part of. More...
 
MacroExpansionimmediateExpansion (clang::SourceLocation loc) const
 
QList< MacroExpansion * > topLevelExpansions () const
 return all registered expansions that are not children of other expansions. More...
 
QList< Model::Node * > topLevelNodes (MacroExpansion *expansion, NodeOriginType filter)
 return all top level nodes of expansion matching the origin criterium. More...
 

Private Member Functions

MacroExpansionexpansion (clang::SourceLocation loc) const
 return the top most expansion registered for loc. More...
 

Private Attributes

ClangHelpersclang_
 
MacroExpansioncurrentXMacroParent {}
 
QHash< Model::Node *, QSet< MacroExpansion * > > expansionCache_
 
QList< MacroExpansion * > expansions_
 
const MacroDefinitionsmacroDefinitions_
 

Detailed Description

creates and stores all MacroExpansions for a translation unit.

Member Enumeration Documentation

◆ NodeOriginType

used to change the origin criterium for what nodes are returned by method topLevelNodes.

Enumerator
Transitive 

return all nodes created directly by expansion or by one of its child expansions.

Direct 

return only the nodes created directly by expansion.

Constructor & Destructor Documentation

◆ MacroExpansions()

CppImport::MacroExpansions::MacroExpansions ( ClangHelpers clang,
const MacroDefinitions macroDefinitions 
)

Member Function Documentation

◆ addMacroExpansion()

void CppImport::MacroExpansions::addMacroExpansion ( clang::SourceRange  sourceRange,
const clang::MacroDirective *  macroDirective,
const clang::MacroArgs *  macroArguments 
)

◆ clear()

void CppImport::MacroExpansions::clear ( )

◆ expansion()

MacroExpansion * CppImport::MacroExpansions::expansion ( clang::SourceLocation  loc) const
private

return the top most expansion registered for loc.

◆ expansions() [1/2]

QList< MacroExpansion * > CppImport::MacroExpansions::expansions ( ) const
inline

◆ expansions() [2/2]

QSet< MacroExpansion * > CppImport::MacroExpansions::expansions ( Model::Node node)

return all expansions that node is a part of.

◆ immediateExpansion()

MacroExpansion * CppImport::MacroExpansions::immediateExpansion ( clang::SourceLocation  loc) const

◆ topLevelExpansions()

QList< MacroExpansion * > CppImport::MacroExpansions::topLevelExpansions ( ) const

return all registered expansions that are not children of other expansions.

◆ topLevelNodes()

QList< Model::Node * > CppImport::MacroExpansions::topLevelNodes ( MacroExpansion expansion,
NodeOriginType  filter 
)

return all top level nodes of expansion matching the origin criterium.

Member Data Documentation

◆ clang_

ClangHelpers& CppImport::MacroExpansions::clang_
private

◆ currentXMacroParent

MacroExpansion* CppImport::MacroExpansions::currentXMacroParent {}
private

◆ expansionCache_

QHash<Model::Node*, QSet<MacroExpansion*> > CppImport::MacroExpansions::expansionCache_
private

◆ expansions_

QList<MacroExpansion*> CppImport::MacroExpansions::expansions_
private

◆ macroDefinitions_

const MacroDefinitions& CppImport::MacroExpansions::macroDefinitions_
private