#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto FruitsXML = R"( )"; uCalc::Transformer t; auto fruitsTagRule = t.FromTo("", "List of fruits"); auto fruitRule = t.FromTo("CommonName={@string:name}", "- {name}"); cout << "--- Using Maximum (Rule-Level) ---" << endl; fruitRule.Maximum(3); // Rule fails if more than 3 fruits are found. t.Filter(FruitsXML); cout << "Match count when fruit rule fails: " << t.Matches().Count() << endl; // The 'fruitsTagRule' still matches. cout << t.Matches().Text() << endl; cout << "" << endl; cout << "--- Using GlobalMaximum (Transformer-Level) ---" << endl; fruitRule.Maximum(-1); // Reset local maximum fruitRule.GlobalMaximum(3); // Transformer fails if more than 3 fruits are found. t.Filter(FruitsXML); cout << "Match count when global rule fails: " << t.Matches().Count() << endl; // All matches are invalidated. cout << t.Matches().Text() << endl; }