diff options
Diffstat (limited to 'sources/shiboken6/tests/libother/number.cpp')
-rw-r--r-- | sources/shiboken6/tests/libother/number.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libother/number.cpp b/sources/shiboken6/tests/libother/number.cpp new file mode 100644 index 000000000..fbf50dc4a --- /dev/null +++ b/sources/shiboken6/tests/libother/number.cpp @@ -0,0 +1,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()); +} |