C# Class Sage.Extensibility.TextEvaluator

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

Public Methods

Method 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

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

Method Details

ExtractParameter() public static method

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.
return string

InvokeFunction() public static method

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.
return string

InvokeVariable() public static method

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.
return string

Process() public method

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

Process() public static method

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.
return string

RegisterFunction() public static method

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.
return void

RegisterVariable() public static method

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.
return void

TextEvaluator() public method

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.
return System