Iterates through a chain of rules with the same anchor to inspect their different replacement patterns.

ID: 955

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();

// Define multiple rules with the same anchor ("Log:")
t.FromTo("Log: {msg}", "DEFAULT: {msg}");
t.FromTo("Log: ERROR {msg}", "CRITICAL: {msg}");
var lastRule = t.FromTo("Log: INFO {msg}", "INFO: {msg}"); // This has the highest priority

Console.WriteLine("--- Overload Chain for 'Log:' anchor ---");
var currentRule = lastRule;
do {
   Console.WriteLine($"Pattern: '{currentRule.Pattern}' -> Replacement: '{currentRule.Replacement}'");
   currentRule = currentRule.NextOverload();
} while (currentRule.NotEmpty());
				
			
--- Overload Chain for 'Log:' anchor ---
Pattern: 'Log: INFO {msg}' -> Replacement: 'INFO: {msg}'
Pattern: 'Log: ERROR {msg}' -> Replacement: 'CRITICAL: {msg}'
Pattern: 'Log: {msg}' -> Replacement: 'DEFAULT: {msg}'
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;

   // Define multiple rules with the same anchor ("Log:")
   t.FromTo("Log: {msg}", "DEFAULT: {msg}");
   t.FromTo("Log: ERROR {msg}", "CRITICAL: {msg}");
   auto lastRule = t.FromTo("Log: INFO {msg}", "INFO: {msg}"); // This has the highest priority

   cout << "--- Overload Chain for 'Log:' anchor ---" << endl;
   auto currentRule = lastRule;
   do {
      cout << "Pattern: '" << currentRule.Pattern() << "' -> Replacement: '" << currentRule.Replacement() << "'" << endl;
      currentRule = currentRule.NextOverload();
   } while (currentRule.NotEmpty());
}
				
			
--- Overload Chain for 'Log:' anchor ---
Pattern: 'Log: INFO {msg}' -> Replacement: 'INFO: {msg}'
Pattern: 'Log: ERROR {msg}' -> Replacement: 'CRITICAL: {msg}'
Pattern: 'Log: {msg}' -> Replacement: 'DEFAULT: {msg}'
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      
      '// Define multiple rules with the same anchor ("Log:")
      t.FromTo("Log: {msg}", "DEFAULT: {msg}")
      t.FromTo("Log: ERROR {msg}", "CRITICAL: {msg}")
      Dim lastRule = t.FromTo("Log: INFO {msg}", "INFO: {msg}") '// This has the highest priority
      
      Console.WriteLine("--- Overload Chain for 'Log:' anchor ---")
      Dim currentRule = lastRule
      Do
         Console.WriteLine($"Pattern: '{currentRule.Pattern}' -> Replacement: '{currentRule.Replacement}'")
         currentRule = currentRule.NextOverload()
      Loop While currentRule.NotEmpty()
   End Sub
End Module
				
			
--- Overload Chain for 'Log:' anchor ---
Pattern: 'Log: INFO {msg}' -> Replacement: 'INFO: {msg}'
Pattern: 'Log: ERROR {msg}' -> Replacement: 'CRITICAL: {msg}'
Pattern: 'Log: {msg}' -> Replacement: 'DEFAULT: {msg}'