diff options
Diffstat (limited to 'sources/shiboken6/tests/libsample/typesystypedef.h')
-rw-r--r-- | sources/shiboken6/tests/libsample/typesystypedef.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/typesystypedef.h b/sources/shiboken6/tests/libsample/typesystypedef.h new file mode 100644 index 000000000..be42fbefe --- /dev/null +++ b/sources/shiboken6/tests/libsample/typesystypedef.h @@ -0,0 +1,32 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef TYPESYSTYPEDEF_H +#define TYPESYSTYPEDEF_H + +#include "libsamplemacros.h" + +enum class LengthUnit { Millimeter, Inch }; + +template <class T, LengthUnit Unit> +class ValueWithUnit +{ + public: + explicit ValueWithUnit(T value = {}) : m_value(value) {} + + T value() const { return m_value; } + void setValue(const T &value) { m_value = value; } + +private: + T m_value; +}; + +class LIBSAMPLE_API ValueWithUnitUser +{ +public: + ValueWithUnitUser(); + + static ValueWithUnit<double, LengthUnit::Millimeter> doubleInchToMillimeter(ValueWithUnit<double, LengthUnit::Inch>); +}; + +#endif // TYPESYSTYPEDEF_H |