kiten/lib
#include <dictfile.h>
Public Member Functions | |
DictFile (const QString &dictionaryTypeName) | |
virtual | ~DictFile () |
virtual EntryList * | doSearch (const DictQuery &query)=0 |
virtual QString | getFile () const |
virtual QString | getName () const |
virtual const QMap< QString, QString > & | getSearchableAttributes () const |
virtual QString | getType () const |
virtual QStringList | listDictDisplayOptions (QStringList) const =0 |
virtual bool | loadDictionary (const QString &file, const QString &name)=0 |
virtual bool | loadNewDictionary (const QString &file, const QString &name) |
virtual void | loadSettings (KConfigSkeleton *) |
virtual DictionaryPreferenceDialog * | preferencesWidget (KConfigSkeleton *config, QWidget *parent=NULL) |
virtual bool | validDictionaryFile (const QString &filename)=0 |
virtual bool | validQuery (const DictQuery &query)=0 |
Protected Attributes | |
QString | m_dictionaryFile |
QString | m_dictionaryName |
QString | m_dictionaryType |
QMap< QString, QString > | m_searchableAttributes |
Detailed Description
Abstract base class, used internally by the library for handling different types of dictionaries This is a virtual class that enforces the interface between the DictionaryManager class and the DictionaryManager.handler files.
IMPLEMENT in combination with an Entry subclass (if needed) to add a new dictionary format. Also see the addDictionary method in the DictionaryManager class.
This documentation is mostly for those who are adding a new type of dictionary to kiten. This class is not exported outside of the library.
Definition at line 47 of file dictfile.h.
Constructor & Destructor Documentation
|
inline |
Use this constructor for your subclasses.
Dictionary subclasses MUST specify their type at creation.
Definition at line 59 of file dictfile.h.
|
inlinevirtual |
Destructor.
Definition at line 63 of file dictfile.h.
Member Function Documentation
This actually conducts the search on the given query.
This is usually most of the work
- Parameters
-
query the DictQuery that specifies what results to return
Implemented in DictFileEdict, and DictFileKanjidic.
|
inlinevirtual |
Returns the file that this is working with, usually used in the preferences display.
Definition at line 140 of file dictfile.h.
|
inlinevirtual |
Returns the name of the dictionary.
Definition at line 132 of file dictfile.h.
Fetch a list of searchable attributes and their codes.
Definition at line 144 of file dictfile.h.
|
inlinevirtual |
Returns the type of files this dictFile object deals with.
Definition at line 136 of file dictfile.h.
|
pure virtual |
Return a list of the fields that can be displayed, note the following should probably always be retured: –NewLine–, Word/Kanji, Meaning, Reading.
This function is passed a list originally containing those four items. This function is used to enumerate possible types the user chooses to have displayed in the preferences dialog box. This will often be a very similer list to getSearchableAttributes(), but due to optional forms of spelling and other situations, it may not be exactly the same. Note: The "Dictionary" option will be appended to your list at the end.
Implemented in DictFileEdict, and DictFileKanjidic.
Load a dictionary as at system startup.
- Parameters
-
file the file to open, in a format suitable for use with QFile::setFileName() name the name of the file to open, used in various user-interface aspects. It may be related to the file parameter, but perhaps not.
Implemented in DictFileEdict, and DictFileKanjidic.
|
inlinevirtual |
Load a new dictionary.
This is called with the assumption that this dictionary has not been opened previously, in case you need to build an index or other activity. If you do not re-implement this method, it simply calls loadDictionary().
- Parameters
-
file the file to open, in a format suitable for use with QFile::setFileName() name the name of the file to open, used in various user-interface aspects. It may be related to the file parameter, but perhaps not.
Definition at line 100 of file dictfile.h.
|
inlinevirtual |
Load information from the KConfigSkeleton that you've setup in the above preferences widget.
Reimplemented in DictFileEdict, and DictFileKanjidic.
Definition at line 127 of file dictfile.h.
|
inlinevirtual |
If you want your own dialog to pick preferences for your dict, then override this.
Leaving it blank will leave your dictionary type without a preferences dialog.
- Parameters
-
config the KConfigSkeleton object that is currently in use parent the parent widget for your preferences dialog
Reimplemented in DictFileEdict.
Definition at line 121 of file dictfile.h.
|
pure virtual |
This method allows the user to test if a dictionary is the proper type for this format.
This process is allowed to take some time, but nonetheless you should find checking the format of a few hundred entries sufficient for this.
- Parameters
-
filename the name of the file, suitable for using with QFile::setFileName()
Implemented in DictFileEdict, and DictFileKanjidic.
|
pure virtual |
Is this query relevant to this dictionary type? Usually this will return true, unless the query specifies extended attributes that the dictionary does not provide.
- Parameters
-
query the query to examine for relevence to this dictionary type
Implemented in DictFileEdict, and DictFileKanjidic.
Member Data Documentation
|
protected |
This is mostly a placeholder, but your class will get asked what file it is using, so either be sure to put something here, or override getFile() and respond with something that will be sensical in a dictionary selection dialog box.
Definition at line 160 of file dictfile.h.
|
protected |
Name is the 'primary key' of the list of dictionaries.
You will want to place this into your Entry objects to identify where they came from (fairly important)
Definition at line 152 of file dictfile.h.
|
protected |
This MUST BE SET IN THE CONSTRUCTOR.
The dictionary class occasionally uses this value and it's important for it to be set at anytime after the constructor is called. It also must be unique to the dictionary type. If relevant, specify dictionary versions here.
Definition at line 168 of file dictfile.h.
This allows the programming user to see a list of possible search types (probably through a drop down menu).
You may also find it useful in your dictFile implementation to translate from extended attribute keys into the simpler one or two letter code keys. These should take the format of: (Kanji Grade => G), (Strokes => S), (Heisig Number => H) for a simple example appropriate to kanji.
Definition at line 178 of file dictfile.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.