File indexing completed on 2024-05-12 16:16:00
0001 /* 0002 SPDX-FileCopyrightText: 2019-2023 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "textgrammarcheck_export.h" 0010 #include <QColor> 0011 #include <QDebug> 0012 #include <QJsonObject> 0013 #include <QString> 0014 namespace TextGrammarCheck 0015 { 0016 class TEXTGRAMMARCHECK_EXPORT GrammarError 0017 { 0018 public: 0019 GrammarError(); 0020 virtual ~GrammarError(); 0021 Q_REQUIRED_RESULT QColor color() const; 0022 void setColor(const QColor &color); 0023 0024 Q_REQUIRED_RESULT QString error() const; 0025 void setError(const QString &error); 0026 0027 Q_REQUIRED_RESULT int blockId() const; 0028 void setBlockId(int blockId); 0029 0030 Q_REQUIRED_RESULT int start() const; 0031 void setStart(int start); 0032 0033 Q_REQUIRED_RESULT int length() const; 0034 void setLength(int length); 0035 0036 Q_REQUIRED_RESULT QStringList suggestions() const; 0037 void setSuggestions(const QStringList &suggestions); 0038 0039 Q_REQUIRED_RESULT bool isValid() const; 0040 0041 virtual void parse(const QJsonObject &obj, int blockindex); 0042 0043 Q_REQUIRED_RESULT bool operator==(const GrammarError &other) const; 0044 0045 Q_REQUIRED_RESULT QString option() const; 0046 void setOption(const QString &option); 0047 0048 Q_REQUIRED_RESULT QString rule() const; 0049 void setRule(const QString &rule); 0050 0051 Q_REQUIRED_RESULT QString url() const; 0052 void setUrl(const QString &url); 0053 0054 protected: 0055 QStringList mSuggestions; 0056 QString mError; 0057 QString mOption; 0058 QString mRule; 0059 QString mUrl; 0060 QColor mColor; 0061 int mBlockId = -1; 0062 int mStart = -1; 0063 int mLength = -1; 0064 }; 0065 } 0066 Q_DECLARE_METATYPE(TextGrammarCheck::GrammarError) 0067 Q_DECLARE_TYPEINFO(TextGrammarCheck::GrammarError, Q_MOVABLE_TYPE); 0068 TEXTGRAMMARCHECK_EXPORT QDebug operator<<(QDebug d, const TextGrammarCheck::GrammarError &t);