| 1 | // Copyright (C) 2025 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 METASTRINGS_H |
| 5 | #define METASTRINGS_H |
| 6 | |
| 7 | #include <QString> |
| 8 | #include <QHash> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class MetaStrings |
| 13 | { |
| 14 | public: |
| 15 | struct MagicComment |
| 16 | { |
| 17 | QString context; |
| 18 | QString comment; |
| 19 | }; |
| 20 | |
| 21 | bool parse(QString &string); |
| 22 | |
| 23 | void clear(); |
| 24 | |
| 25 | bool hasData() const; |
| 26 | |
| 27 | std::optional<MagicComment> magicComment() const { return m_magicComment; } |
| 28 | QString extracomment() const { return m_extracomment; } |
| 29 | QString msgid() const { return m_msgid; } |
| 30 | QString sourcetext() const { return m_sourcetext; } |
| 31 | QString label() const { return m_label; } |
| 32 | QHash<QString, QString> extra() const { return m_extra; } |
| 33 | QString popError() { return std::move(m_error); } |
| 34 | |
| 35 | private: |
| 36 | std::optional<MagicComment> m_magicComment; // TRANSLATOR |
| 37 | QString m_extracomment; //: |
| 38 | QString m_msgid; //= |
| 39 | QString m_sourcetext; //% |
| 40 | QString m_label; //@ |
| 41 | QHash<QString, QString> m_extra; //~ |
| 42 | QString m_error; |
| 43 | }; |
| 44 | |
| 45 | QT_END_NAMESPACE |
| 46 | |
| 47 | #endif // METASTRINGS_H |
| 48 |
