File atom.cpp of Package IVS_kalkulacka

/**
 * @file atom.cpp
 *
 * @brief subor obsahujuci konstruktor pre triedu atomu pre vyhodnocovanie matematickych vyrazov
 * @author xlelke01 xhefka01 xbence01 xfisla00
 */

/*
This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "atom.h"

/**
 * Konstruktor atomu pre vyhodnocovanie matematickych vyrazov
 *
 * @param isOp Urcuje ci je atom operand alebo operator
 * @param opType Typ operatora
 * @param value Hodnota operandu
 */
Atom::Atom(bool isOp, Operand opType, int value, QObject *parent) :
    QObject(parent)
{
    this->isOp = isOp;
    this->opType = opType;
    this->value = value;
    switch (opType)
    {
    case NUM:
        priority = 0;
        break;
    case ADD:
        priority = PADD;
        break;
    case SUB:
        priority = PSUB;
        break;
    case MUL:
        priority = PMUL;
        break;
    case DIV:
        priority = PDIV;
        break;
    case MOD:
        priority = PMOD;
        break;
    case POW:
        priority = PPOW;
        break;
    case FACT:
        priority = PFACT;
        break;
    }
}
openSUSE Build Service is sponsored by