Trying to implement input filtering. I want to make the user enter in the form of a string some logical expression of the type (x > 100 && x < 120) || x ==42 (x > 100 && x < 120) || x ==42 . In the code, x will be replaced with a specific constant. Actually the question is how to calculate it? In principle, QScriptEngine::evaluate() does an excellent job with this task, but to pull a whole Qt Script into a project for the sake of one line of code is very cool, in my opinion.
In short, is it possible to somehow do without Qt Script, and not to write your own parser from scratch?
char s[] = "int foo(int x) { return (x > 100 && x < 120) || x == 42; }". We transfer this case as a string in the interpreter API and get the result :) The technology is slightly different in both cases (the API is slightly different), but the principle and the result are the same. But the possibilities are much greater. - PinkTux