Show / Hide Table of Contents

Class MacroProvider

Implementation of IGetsMacro which uses an expression evaluator to get macros from attributes.

Inheritance
System.Object
MacroProvider
Implements
IGetsMacro
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ZptSharp.Metal
Assembly: ZptSharp.dll
Syntax
public class MacroProvider : IGetsMacro

Constructors

| Improve this Doc View Source

MacroProvider(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 Source

GetMacroAsync(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 node has no attribute matching any of the attributeSpecs.

Exceptions
Type Condition
MacroNotFoundException

If the node does have an attribute matching the attributeSpecs but no macro could be resolved from the attribute's expression.

| Improve this Doc View Source

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 node has no attribute matching the attributeSpec.

Exceptions
Type Condition
MacroNotFoundException

If the node does have an attribute matching the attributeSpec but no macro could be resolved from the attribute's expression.

Implements

IGetsMacro
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX