#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Create a transformer and perform a transformation auto t = uc.NewTransformer(); t.Text("if (x > 3) y = x * 2; else if(x == 5) y = x - 1;"); t.FromTo("1", "100"); t.Transform(); // --- Interoperability and Chaining --- auto Pattern = "if ({cond})"; // 1. Create a uCalc.String from a Transformer. // 2. Chain .After() to get a "live view" of the text after the pattern. uCalc::String s(t); auto after_first_if = s.After(Pattern); cout << after_first_if.Text() << endl; // 3. Chain another .After() on the child string. auto after_second_if = after_first_if.After(Pattern); cout << after_second_if.Text() << endl; // --- String to Transformer Conversion --- // 4. Create a uCalc.String and assign it text. uCalc::String s2; s2 = "This is a test"; // 5. Create a Transformer from the uCalc.String to use transformer-specific methods. uCalc::Transformer t2(s2); cout << t2.Text() << endl; }