File indexing completed on 2024-04-21 03:42:00

0001 /*
0002     This file is part of Kiten, a KDE Japanese Reference Tool
0003     SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com>
0004     SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com>
0005     SPDX-FileCopyrightText: 2011 Daniel E. Moctezuma <democtezuma@gmail.com
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef KITEN_ENTRYEDICT_H
0011 #define KITEN_ENTRYEDICT_H
0012 
0013 #include "entry.h"
0014 
0015 #include "kiten_export.h"
0016 
0017 #include <QList>
0018 #include <QSet>
0019 
0020 #ifndef KITEN_EDICTFORMATTING
0021 #define KITEN_EDICTFORMATTING
0022 
0023 namespace EdictFormatting
0024 {
0025 extern QStringList Nouns;
0026 extern QStringList Verbs;
0027 extern QStringList Adjectives;
0028 extern QStringList Adverbs;
0029 extern QStringList IchidanVerbs;
0030 extern QStringList GodanVerbs;
0031 extern QStringList FukisokuVerbs;
0032 extern QStringList Expressions;
0033 extern QStringList Prefix;
0034 extern QStringList Suffix;
0035 extern QString Particle;
0036 
0037 extern QSet<QString> PartsOfSpeech;
0038 extern QSet<QString> MiscMarkings;
0039 extern QSet<QString> FieldOfApplication;
0040 }
0041 
0042 #endif
0043 
0044 class KITEN_EXPORT EntryEdict : public Entry
0045 {
0046     friend class DictFileEdict;
0047 
0048 public:
0049     //     EntryEdict( const EntryEdict &x ) : Entry( x ) {} //No special members to copy in this one
0050     EntryEdict(const QString &dict);
0051     EntryEdict(const QString &dict, const QString &entry);
0052 
0053     Entry *clone() const override;
0054     /**
0055      * Simple accessor.
0056      */
0057     QString getTypes() const;
0058     /**
0059      * Simple accessor.
0060      */
0061     QStringList getTypesList() const;
0062 
0063     bool isAdjective() const;
0064     bool isAdverb() const;
0065     bool isCommon() const;
0066     bool isExpression() const;
0067     bool isFukisokuVerb() const;
0068     bool isGodanVerb() const;
0069     bool isIchidanVerb() const;
0070     bool isNoun() const;
0071     bool isParticle() const;
0072     bool isPrefix() const;
0073     bool isSuffix() const;
0074     bool isVerb() const;
0075 
0076     bool matchesWordType(const DictQuery &query) const;
0077 
0078     QString dumpEntry() const override;
0079     QString getDictionaryType() const override;
0080     QString HTMLWord() const override;
0081     bool loadEntry(const QString &entryLine) override;
0082     QString toHTML() const override;
0083 
0084 protected:
0085     virtual QString kanjiLinkify(const QString &inString) const;
0086 
0087 private:
0088     /**
0089      * Types that match this entry (i.e. n, adj, adv).
0090      */
0091     QStringList m_types;
0092 
0093     // Field of Application goes into the hash
0094     QList<QString> m_miscMarkings;
0095 };
0096 
0097 #endif