#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto FruitsXML = R"( )"; uc.DefineVariable("x"); auto t = uc.NewTransformer(); auto FruitsTag = t.FromTo("", "List of fruits"); auto Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}"); uc.Eval("x = 1"); Fruit.Maximum(10); t.Filter(FruitsXML); cout << "Maximum = " << Fruit.Maximum() << endl; cout << "Matches count: " << t.Matches().Count() << endl; // 1 for FruitsTag occurrence cout << "" << endl; cout << t.Matches() << endl; cout << "" << endl; cout << "===============" << endl; uc.Eval("x = 1"); Fruit.Maximum(20); t.Filter(FruitsXML); cout << "Maximum = " << Fruit.Maximum() << endl; cout << "Matches count: " << t.Matches().Count() << endl; // 1 for FruitsTag plus 12 fruits cout << "" << endl; cout << t.Matches() << endl; cout << "" << endl; cout << "===============" << endl; uc.Eval("x = 1"); Fruit.GlobalMaximum(10); // Notice "List of fruits" will not show t.Filter(FruitsXML); cout << "MaximumAND = " << Fruit.GlobalMaximum() << endl; cout << "Matches count: " << t.Matches().Count() << endl; // Even FruitsTage won't be counted cout << "" << endl; cout << t.Matches() << endl; cout << "===============" << endl; uc.Eval("x = 1"); Fruit.GlobalMaximum(20); t.Filter(FruitsXML); cout << "MaximumAND = " << Fruit.GlobalMaximum() << endl; cout << "Matches count: " << t.Matches().Count() << endl; cout << "" << endl; cout << t.Matches() << endl; }