aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/complex.h
blob: 168fe5c449f22df66a1b6ebb044be680624abfa9 (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
// 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 COMPLEX_H
#define COMPLEX_H

#include "libsamplemacros.h"

class LIBSAMPLE_API Complex
{
public:
    LIBMINIMAL_DEFAULT_COPY_MOVE(Complex)

    explicit Complex(double real = 0.0, double imag = 0.0) noexcept;
    ~Complex() = default;

    inline double real() const { return m_real; }
    inline void setReal(double real) { m_real = real; }
    inline double imag() const { return m_imag; }
    inline void setImaginary(double imag) { m_imag = imag; }

    Complex operator+(const Complex &other);

    void show() const;

private:
    double m_real;
    double m_imag;
};

#endif // COMPLEX_H