Class MacroProvider
Implementation of IGetsMacro which uses an expression evaluator to get macros from attributes.
Inheritance
Implements
Inherited Members
Namespace: ZptSharp.Metal
Assembly: ZptSharp.dll
Syntax
public class MacroProvider : IGetsMacro
Constructors
| Improve this Doc View SourceMacroProvider(IEvaluatesExpression, ILogger<MacroProvider>)
Initializes a new instance of the MacroProvider class.
Declaration
public MacroProvider(IEvaluatesExpression expressionEvaluator, ILogger<MacroProvider> logger)
Parameters
Type | Name | Description |
---|---|---|
IEvaluatesExpression | expressionEvaluator | Expression evaluator. |
Microsoft.Extensions.Logging.ILogger<MacroProvider> | logger | A logger. |
Methods
| Improve this Doc View SourceGetMacroAsync(INode, ExpressionContext, IEnumerable<AttributeSpec>, CancellationToken)
Gets the METAL macro referenced by the specified node's attribute, if such an attribute is present.
Declaration
public Task<MetalMacro> GetMacroAsync(INode node, ExpressionContext context, IEnumerable<AttributeSpec> attributeSpecs, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
INode | node | The node from which to get the macro. |
ExpressionContext | context | The current expression context. |
System.Collections.Generic.IEnumerable<AttributeSpec> | attributeSpecs | A collection of attribute specs. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<MetalMacro> | The METAL macro, or a null reference if the |
Exceptions
Type | Condition |
---|---|
MacroNotFoundException | If the node does have an attribute matching
the |
GetMacroAsync(INode, ExpressionContext, AttributeSpec, CancellationToken)
Gets the METAL macro referenced by the specified node's attribute, if such an attribute is present.
Declaration
public Task<MetalMacro> GetMacroAsync(INode node, ExpressionContext context, AttributeSpec attributeSpec, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
INode | node | The node from which to get the macro. |
ExpressionContext | context | The current expression context. |
AttributeSpec | attributeSpec | An attribute spec. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<MetalMacro> | The METAL macro, or a null reference if the |
Exceptions
Type | Condition |
---|---|
MacroNotFoundException | If the node does have an attribute matching
the |