File indexing completed on 2024-12-22 04:28:07
0001 /* 0002 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QHash> 0010 #include <QSet> 0011 #include <QString> 0012 0013 #include "autocorrectionutils.h" 0014 0015 #include "textautocorrectioncore_export.h" 0016 namespace TextAutoCorrectionCore 0017 { 0018 class TEXTAUTOCORRECTIONCORE_EXPORT ImportAbstractAutocorrection 0019 { 0020 Q_GADGET 0021 public: 0022 enum LoadAttribute { 0023 All = 0, 0024 SuperScript, 0025 }; 0026 Q_ENUM(LoadAttribute) 0027 0028 ImportAbstractAutocorrection(); 0029 virtual ~ImportAbstractAutocorrection(); 0030 0031 virtual bool import(const QString &fileName, QString &errorMessage, ImportAbstractAutocorrection::LoadAttribute loadAttribute = All) = 0; 0032 0033 [[nodiscard]] QSet<QString> upperCaseExceptions() const; 0034 [[nodiscard]] QSet<QString> twoUpperLetterExceptions() const; 0035 [[nodiscard]] QHash<QString, QString> autocorrectEntries() const; 0036 [[nodiscard]] QHash<QString, QString> superScriptEntries() const; 0037 0038 [[nodiscard]] AutoCorrectionUtils::TypographicQuotes typographicSingleQuotes() const; 0039 [[nodiscard]] AutoCorrectionUtils::TypographicQuotes typographicDoubleQuotes() const; 0040 0041 [[nodiscard]] int maxFindStringLenght() const; 0042 0043 [[nodiscard]] int minFindStringLenght() const; 0044 0045 protected: 0046 int mMaxFindStringLength = 0; 0047 int mMinFindStringLength = 0; 0048 QSet<QString> mUpperCaseExceptions; 0049 QSet<QString> mTwoUpperLetterExceptions; 0050 QHash<QString, QString> mAutocorrectEntries; 0051 QHash<QString, QString> mSuperScriptEntries; 0052 AutoCorrectionUtils::TypographicQuotes mTypographicSingleQuotes; 0053 AutoCorrectionUtils::TypographicQuotes mTypographicDoubleQuotes; 0054 }; 0055 }