aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/expression.h
blob: e7c5b730695cf3dfa86e8fa29b3630609508db70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0


#ifndef EXPRESSION_H
#define EXPRESSION_H

#include "libsamplemacros.h"

#include <memory>
#include <string>

class LIBSAMPLE_API Expression
{
public:
    LIBMINIMAL_DEFAULT_COPY_MOVE(Expression)

    enum Operation {
        None, Add, Sub, LessThan, GreaterThan
    };

    explicit Expression(int number) noexcept;
    ~Expression() = default;

    Expression operator>(const Expression &other);
    Expression operator<(const Expression &other);
    Expression operator+(const Expression &other);
    Expression operator-(const Expression &other);

    std::string toString() const;
private:
    int m_value = 0;
    Operation m_operation = None;
    std::shared_ptr<Expression> m_operand1;
    std::shared_ptr<Expression> m_operand2;

    Expression() noexcept;
};

#endif // EXPRESSION_H