1 /*
2     This file is part of Kiten, a KDE Japanese Reference Tool
3     SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com>
4     SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com>
5     SPDX-FileCopyrightText: 2011 Daniel E. Moctezuma <democtezuma@gmail.com
6 
7     SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KITEN_ENTRYEDICT_H
11 #define KITEN_ENTRYEDICT_H
12 
13 #include "entry.h"
14 
15 #include "kiten_export.h"
16 
17 #include <QHash>
18 #include <QList>
19 #include <QSet>
20 
21 #ifndef KITEN_EDICTFORMATTING
22 #define KITEN_EDICTFORMATTING
23 
24 namespace EdictFormatting
25 {
26   extern QStringList Nouns;
27   extern QStringList Verbs;
28   extern QStringList Adjectives;
29   extern QStringList Adverbs;
30   extern QStringList IchidanVerbs;
31   extern QStringList GodanVerbs;
32   extern QStringList FukisokuVerbs;
33   extern QStringList Expressions;
34   extern QStringList Prefix;
35   extern QStringList Suffix;
36   extern QString     Particle;
37 
38   extern QSet<QString> PartsOfSpeech;
39   extern QSet<QString> MiscMarkings;
40   extern QSet<QString> FieldOfApplication;
41 }
42 
43 #endif
44 
45 class KITEN_EXPORT EntryEdict : public Entry
46 {
47   friend class DictFileEdict;
48 
49   public:
50 //     EntryEdict( const EntryEdict &x ) : Entry( x ) {} //No special members to copy in this one
51                     EntryEdict( const QString &dict );
52                     EntryEdict( const QString &dict, const QString &entry );
53 
54     Entry          *clone() const override;
55     /**
56      * Simple accessor.
57      */
58     QString         getTypes() const;
59     /**
60      * Simple accessor.
61      */
62     QStringList     getTypesList() const;
63 
64     bool            isAdjective() const;
65     bool            isAdverb() const;
66     bool            isCommon() const;
67     bool            isExpression() const;
68     bool            isFukisokuVerb() const;
69     bool            isGodanVerb() const;
70     bool            isIchidanVerb() const;
71     bool            isNoun() const;
72     bool            isParticle() const;
73     bool            isPrefix() const;
74     bool            isSuffix() const;
75     bool            isVerb() const;
76 
77     bool            matchesWordType( const DictQuery &query ) const;
78 
79     QString dumpEntry() const override;
80     QString getDictionaryType() const override;
81     QString HTMLWord() const override;
82     bool    loadEntry( const QString &entryLine ) override;
83     QString toHTML() const override;
84 
85   protected:
86     virtual QString kanjiLinkify( const QString &inString ) const;
87 
88   private:
89     /**
90      * Types that match this entry (i.e. n, adj, adv).
91      */
92     QStringList    m_types;
93 
94     //Field of Application goes into the hash
95     QList<QString> m_miscMarkings;
96 };
97 
98 #endif
99