C++Guns – RoboBlog

22.12.2012

Qt && Unicode

Filed under: Allgemein — Tags: , — Thomas @ 14:12

Dieses kleine Programm wandelt Text wie ".and." "&&" u.s.w. in Unicode Zeichen um.
Irgendwann kommt noch eine automatische Umformung zur konjunktive Normalform KNF

KNF1


    // input
    QString text = ui->lineEdit->text();

    // replace easy to write operator with unicode symbol
    // and
    text = text.replace("&&", QChar(8743));
    text = text.replace(".and.", QChar(8743), Qt::CaseInsensitive);
    // or
    text = text.replace("||", QChar(8744));
    text = text.replace(".or.", QChar(8744), Qt::CaseInsensitive);
    // negation
    text = text.replace("!", QChar(172));
    text = text.replace(".not.", QChar(172), Qt::CaseInsensitive);

    // output
    ui->lineEdit_out->setText(text);

Liste_der_Unicodeblöcke
Unicodeblock_Lateinisch-1,_Ergänzung
Unicodeblock_Mathematische_Operatoren

todo:
History der eingegebenen Formeln mit Ergebnis der Umrechnung. Wenn man eine Formel in der History anklickt, soll sie wieder im Eingabeformular erscheinen.

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress