C# Class Sage.Extensibility.TextEvaluator

Implements a text processing system using statically and dynamically registered functions and variables.
Afficher le fichier Open project: igorfrance/sage Class Usage Examples

Méthodes publiques

Méthode Description
ExtractParameter ( IEnumerable parameters, int index, string defaultValue = null ) : string

Gets the entry with the specified index from the specified parameters list.

InvokeFunction ( SageContext context, string name, string arguments ) : string

Invokes the function with the specified name using the specified context and arguments.

InvokeVariable ( SageContext context, string name ) : string

Invokes the variable with the specified name using the specified context.

Process ( string value ) : string

Processes any dynamic expressions embedded in the specified value.

Process ( string value, SageContext context ) : string

Processes any dynamic expressions embedded in the specified value, using the specified context.

RegisterFunction ( string name, TextFunction handler ) : void

Registers a function handler with the specified name.

RegisterVariable ( string name, TextVariable handler ) : void

Registers a variable handler with the specified name.

TextEvaluator ( SageContext context ) : System

Initializes a new instance of the TextEvaluator class, using the specified context.

Private Methods

Méthode Description
DiscoverFunctionsAndVariables ( ) : void
OnAssembliesUpdated ( object sender, EventArgs arg ) : void
ProcessChunk ( SageContext context, string value ) : string
TextEvaluator ( ) : System

Method Details

ExtractParameter() public static méthode

Gets the entry with the specified index from the specified parameters list.
public static ExtractParameter ( IEnumerable parameters, int index, string defaultValue = null ) : string
parameters IEnumerable The list parameters.
index int The index.
defaultValue string The default value.
Résultat string

InvokeFunction() public static méthode

Invokes the function with the specified name using the specified context and arguments.
public static InvokeFunction ( SageContext context, string name, string arguments ) : string
context SageContext The context to use when invoking the function.
name string The name of the function to invoke.
arguments string The arguments to use when invoking the function.
Résultat string

InvokeVariable() public static méthode

Invokes the variable with the specified name using the specified context.
public static InvokeVariable ( SageContext context, string name ) : string
context SageContext The context to use when invoking the variable.
name string The name of the variable to invoke.
Résultat string

Process() public méthode

Processes any dynamic expressions embedded in the specified value.
public Process ( string value ) : string
value string The value to process.
Résultat string

Process() public static méthode

Processes any dynamic expressions embedded in the specified value, using the specified context.
public static Process ( string value, SageContext context ) : string
value string The value to process.
context SageContext The context to use.
Résultat string

RegisterFunction() public static méthode

Registers a function handler with the specified name.
public static RegisterFunction ( string name, TextFunction handler ) : void
name string Name of the function.
handler TextFunction The function that provides the result value.
Résultat void

RegisterVariable() public static méthode

Registers a variable handler with the specified name.
public static RegisterVariable ( string name, TextVariable handler ) : void
name string Name of the variable.
handler TextVariable The function that provides the variable value.
Résultat void

TextEvaluator() public méthode

Initializes a new instance of the TextEvaluator class, using the specified context.
public TextEvaluator ( SageContext context ) : System
context SageContext The context to use with this instance.
Résultat System