Results 1 to 2 of 2

Thread: Custom expression evaluation in Qt

  1. #1
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default Custom expression evaluation in Qt

    I have to evaluate a simple expression introduced by the user into the search box, with following elements:

    1. Basic logical operators: AND and OR (with optional parenthesis)
    2. Basic arithmetic operators > , < , =
    3. My own variables (fields)


    This is for a custom "search query language", the input will be a high level query, output will be an SQL query.

    Does Qt has something that would help me , like a Qt Class parsing an expression in a custom format? If not , what libraries would you recommend me to use for this task?

    TIA
    Nulik

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Custom expression evaluation in Qt

    You should google for "expression tree" - lots of code out there. As far as Qt is concerned, possibly QRegularExpression and the QStateMachine framework would help you in building the parser.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Evaluation of one QtScript from within another
    By pancake in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2010, 11:44
  2. QtScript evaluation question
    By QPlace in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2009, 03:46
  3. Graphic evaluation
    By jd in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2008, 14:46
  4. QWinWidget and evaluation version
    By KoenTanghe in forum Installation and Deployment
    Replies: 4
    Last Post: 20th November 2007, 09:41
  5. QT 4.2.3 evaluation
    By steg90 in forum Qt-based Software
    Replies: 5
    Last Post: 30th May 2007, 14:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.