| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef QMLPROPERTYARGUMENTS_H |
| 5 | #define QMLPROPERTYARGUMENTS_H |
| 6 | |
| 7 | #include <QtCore/qstring.h> |
| 8 | #include <optional> |
| 9 | #include <type_traits> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class Location; |
| 14 | |
| 15 | struct QmlPropertyArguments |
| 16 | { |
| 17 | enum class ParsingOptions { |
| 18 | None = 0x0, |
| 19 | RequireQualifiedPath = 0x1, |
| 20 | IgnoreType = 0x2 |
| 21 | }; |
| 22 | |
| 23 | QString m_type {}; |
| 24 | QString m_module {}; |
| 25 | QString m_qmltype {}; |
| 26 | QString m_name {}; |
| 27 | bool m_isList { false }; |
| 28 | |
| 29 | static std::optional<QmlPropertyArguments> |
| 30 | parse(const QString &arg, const Location &loc, |
| 31 | ParsingOptions opts = ParsingOptions::None); |
| 32 | |
| 33 | friend ParsingOptions operator&(ParsingOptions lhs, ParsingOptions rhs) |
| 34 | { |
| 35 | return static_cast<ParsingOptions>( |
| 36 | static_cast<std::underlying_type<ParsingOptions>::type>(lhs) & |
| 37 | static_cast<std::underlying_type<ParsingOptions>::type>(rhs) |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | friend ParsingOptions operator|(ParsingOptions lhs, ParsingOptions rhs) |
| 42 | { |
| 43 | return static_cast<ParsingOptions>( |
| 44 | static_cast<std::underlying_type<ParsingOptions>::type>(lhs) | |
| 45 | static_cast<std::underlying_type<ParsingOptions>::type>(rhs) |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | }; |
| 50 | |
| 51 | QT_END_NAMESPACE |
| 52 | |
| 53 | #endif // QMLPROPERTYARGUMENTS_H |
| 54 |
