aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libother/number.cpp
blob: fbf50dc4a8f4a6d2f12e70ac76d721aef64ce503 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "number.h"

#include <sstream>

Str Number::toStr() const
{
    std::ostringstream in;
    in << m_value;
    return in.str().c_str();
}

Point operator*(const Point &p, const Number &n)
{
    return {p.x() * n.value(), p.y() * n.value()};
}

Complex Number::toComplex() const
{
    return Complex(m_value);
}

Number Number::fromComplex(Complex cpx)
{
    return Number(cpx.real());
}