kiten/lib
Entry Class Reference
The Entry class is a generic base class for each particular entry in a given dictionary. More...
#include <Entry.h>

Public Member Functions | |
| virtual | ~Entry () |
| virtual Entry * | clone () const =0 |
| virtual QString | dumpEntry () const =0 |
| virtual bool | extendedItemCheck (const QString &key, const QString &value) const |
| const QString & | getDictName () const |
| const QHash< QString, QString > & | getExtendedInfo () const |
| QString | getExtendedInfoItem (const QString &x) const |
| QString | getMeanings () const |
| QStringList | getMeaningsList () const |
| QString | getReadings () const |
| QStringList | getReadingsList () const |
| QString | getWord () const |
| virtual bool | loadEntry (const QString &)=0 |
| virtual bool | matchesQuery (const DictQuery &) const |
| virtual bool | sort (const Entry &that, const QStringList &dictionaryList, const QStringList &fieldList) const |
| virtual bool | sortByField (const Entry &that, const QString &field) const |
| virtual QString | toHTML () const |
| virtual QString | toKVTML () const |
| virtual QString | toString () const |
Protected Member Functions | |
| Entry (const QString &sourceDictionary, const QString &word, const QStringList &readings, const QStringList &meanings) | |
| Entry (const QString &sourceDictionary) | |
| Entry (const Entry &) | |
| virtual QString | HTMLMeanings () const |
| virtual QString | HTMLReadings () const |
| virtual QString | HTMLWord () const |
| void | init () |
| bool | isKanji (const QChar &) const |
| bool | listMatch (const QStringList &, const QStringList &, DictQuery::MatchType) const |
| virtual QString | makeLink (const QString &) const |
Protected Attributes | |
| QHash< QString, QString > | ExtendedInfo |
| QStringList | Meanings |
| QString | outputListDelimiter |
| QStringList | Readings |
| QString | sourceDict |
| QString | Word |
Detailed Description
The Entry class is a generic base class for each particular entry in a given dictionary.
It's used as the basic class to ferry information back to the user application. It also handles some of the display aspects
Definition at line 38 of file Entry.h.
Constructor & Destructor Documentation
| Entry::Entry | ( | const Entry & | src | ) | [protected] |
| Entry::Entry | ( | const QString & | sourceDictionary | ) | [protected] |
Constructor that includes the dictionary source.
This does not need to be overridded by subclasses, but you might find it to be convenient as the superclass constructor to call from your constructors.
- Parameters:
-
sourceDictionary the dictionary name (not fileName) that this entry originated with
| Entry::Entry | ( | const QString & | sourceDictionary, | |
| const QString & | word, | |||
| const QStringList & | readings, | |||
| const QStringList & | meanings | |||
| ) | [protected] |
A constructor that includes the basic information, nicely separated.
- Parameters:
-
sourceDictionary the dictionary name (not fileName) that this entry originated with word the word entry of this dictionary entry (normally kanji/kana) readings a list of possible pronunciations for this result (kana) meanings a list of possible meanings for this word
Member Function Documentation
| virtual Entry* Entry::clone | ( | ) | const [pure virtual] |
A clone method, this should just implement "return new EntrySubClass(*this)".
Implemented in entryDeinflect, EntryEDICT, and EntryKanjidic.
| virtual QString Entry::dumpEntry | ( | ) | const [pure virtual] |
Return a QString of an entry, as if it were dumped back into it's source file.
Implemented in entryDeinflect, EntryEDICT, and EntryKanjidic.
Simple accessor.
- Parameters:
-
key the key for the extended item that is being verified value the value it is supposed to have
- Returns:
- true if the key has that value, false if it is different or does not exist
Reimplemented in EntryKanjidic.
| const QString & Entry::getDictName | ( | ) | const |
| QString Entry::getMeanings | ( | ) | const |
| QStringList Entry::getMeaningsList | ( | ) | const |
| QStringList Entry::getReadingsList | ( | ) | const |
| QString Entry::getWord | ( | ) | const |
| QString Entry::HTMLMeanings | ( | ) | const [inline, protected, virtual] |
| QString Entry::HTMLReadings | ( | ) | const [inline, protected, virtual] |
Return and HTML version of a reading list.
Reimplemented in EntryKanjidic.
| QString Entry::HTMLWord | ( | ) | const [inline, protected, virtual] |
Return and HTML version of a word.
Reimplemented in EntryEDICT, and EntryKanjidic.
| void Entry::init | ( | ) | [protected] |
| bool Entry::isKanji | ( | const QChar & | character | ) | const [protected] |
| bool Entry::listMatch | ( | const QStringList & | list, | |
| const QStringList & | test, | |||
| DictQuery::MatchType | type | |||
| ) | const [protected] |
| virtual bool Entry::loadEntry | ( | const QString & | ) | [pure virtual] |
An entry should be able to parse an in-file representation of an entry as a QString and put it back.
The latter will be useful for writing to dictionaries on disk at some point.
Implemented in entryDeinflect, EntryEDICT, and EntryKanjidic.
| bool Entry::matchesQuery | ( | const DictQuery & | query | ) | const [virtual] |
Fairly important method, this tests if this particular entry matches a query.
The EDICT and Kanjidic doSearch methods do an approximate match, load an Entry, and then check more carefully by calling this method. This works nicely for handling searchWithinResults cleanly
Reimplemented in entryDeinflect.
| bool Entry::sort | ( | const Entry & | that, | |
| const QStringList & | dictionaryList, | |||
| const QStringList & | fieldList | |||
| ) | const [virtual] |
An overrideable sorting function, similer to operator< in most contexts The default version will sort by dictionary, then by fields.
- Parameters:
-
that the second item we are comparing (this) with dictionaryList the list of dictionaries (in order) to sort If this list is empty, the entries will not be sorted in order fieldList the list of fields to sort in, uses special codes of Reading, Meaning, Word/Kanji for those elements, all others by their extended attribute keys.
Overrideable sorting mechanism for sorting by individual fields.
The sort routine checks if the given field is equal, before calling this virtual function So if this is called, you can assume that this->extendedItem(field) != that.extendedItem(field)
- Parameters:
-
that the second item we are comparing (this) with field the specific extended item field that is being compared
| QString Entry::toHTML | ( | ) | const [virtual] |
An entry should be able to generate a representation of itself in (valid) HTML.
Main switching function for displaying to the user.
Reimplemented in entryDeinflect, EntryEDICT, and EntryKanjidic.
| QString Entry::toKVTML | ( | ) | const [inline, virtual] |
| QString Entry::toString | ( | ) | const [virtual] |
Member Data Documentation
QHash<QString,QString> Entry::ExtendedInfo [protected] |
QStringList Entry::Meanings [protected] |
QString Entry::outputListDelimiter [protected] |
QStringList Entry::Readings [protected] |
QString Entry::sourceDict [protected] |
QString Entry::Word [protected] |
The documentation for this class was generated from the following files:
KDE 4.5 API Reference