MIRA
Public Types | Public Member Functions | Public Attributes | List of all members
Scope Struct Reference

Variable scope of the macro processor. More...

#include <xml/macros/Scope.h>

Public Types

using Ptr = std::shared_ptr< Scope >
 

Public Member Functions

MacroPtr findOptional (const Identifier &id) const
 
MacroPtr find (const Identifier &name) const
 
void define (Identifier id, MacroPtr macro)
 
void collectGarbage ()
 Remove any definitions that no one else depends on. More...
 

Public Attributes

Scope::Ptr parent = nullptr
 
std::unordered_map< std::string, Definitionsnamespaces
 

Detailed Description

Variable scope of the macro processor.

Scopes work similarly to scopes in C++. Each scope may contain a number of definitions. Each scope may have a parent scope from which definitions are inherited.

Member Typedef Documentation

◆ Ptr

using Ptr = std::shared_ptr<Scope>

Member Function Documentation

◆ findOptional()

MacroPtr findOptional ( const Identifier id) const
inline

◆ find()

MacroPtr find ( const Identifier name) const
inline

◆ define()

void define ( Identifier  id,
MacroPtr  macro 
)
inline

◆ collectGarbage()

void collectGarbage ( )
inline

Remove any definitions that no one else depends on.

This may be required to avoid memory leaks in definitions which themselves hold a shared_ptr to this scope.

Member Data Documentation

◆ parent

Scope::Ptr parent = nullptr

◆ namespaces

std::unordered_map<std::string, Definitions> namespaces

The documentation for this struct was generated from the following file: