• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kiten/lib

Public Member Functions | Protected Attributes | List of all members
DictFile Class Referenceabstract

#include <dictfile.h>

Inheritance diagram for DictFile:
Inheritance graph
[legend]

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

DictFile::DictFile ( const QString &  dictionaryTypeName)
inline

Use this constructor for your subclasses.

Dictionary subclasses MUST specify their type at creation.

Definition at line 59 of file dictfile.h.

virtual DictFile::~DictFile ( )
inlinevirtual

Destructor.

Definition at line 63 of file dictfile.h.

Member Function Documentation

virtual EntryList* DictFile::doSearch ( const DictQuery &  query)
pure virtual

This actually conducts the search on the given query.

This is usually most of the work

Parameters
querythe DictQuery that specifies what results to return

Implemented in DictFileEdict, and DictFileKanjidic.

virtual QString DictFile::getFile ( ) const
inlinevirtual

Returns the file that this is working with, usually used in the preferences display.

Definition at line 140 of file dictfile.h.

virtual QString DictFile::getName ( ) const
inlinevirtual

Returns the name of the dictionary.

Definition at line 132 of file dictfile.h.

virtual const QMap<QString,QString>& DictFile::getSearchableAttributes ( ) const
inlinevirtual

Fetch a list of searchable attributes and their codes.

Definition at line 144 of file dictfile.h.

virtual QString DictFile::getType ( ) const
inlinevirtual

Returns the type of files this dictFile object deals with.

Definition at line 136 of file dictfile.h.

virtual QStringList DictFile::listDictDisplayOptions ( QStringList  ) const
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.

virtual bool DictFile::loadDictionary ( const QString &  file,
const QString &  name 
)
pure virtual

Load a dictionary as at system startup.

Parameters
filethe file to open, in a format suitable for use with QFile::setFileName()
namethe 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.

virtual bool DictFile::loadNewDictionary ( const QString &  file,
const QString &  name 
)
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
filethe file to open, in a format suitable for use with QFile::setFileName()
namethe 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.

virtual void DictFile::loadSettings ( KConfigSkeleton *  )
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.

virtual DictionaryPreferenceDialog* DictFile::preferencesWidget ( KConfigSkeleton *  config,
QWidget *  parent = NULL 
)
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
configthe KConfigSkeleton object that is currently in use
parentthe parent widget for your preferences dialog

Reimplemented in DictFileEdict.

Definition at line 121 of file dictfile.h.

virtual bool DictFile::validDictionaryFile ( const QString &  filename)
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
filenamethe name of the file, suitable for using with QFile::setFileName()

Implemented in DictFileEdict, and DictFileKanjidic.

virtual bool DictFile::validQuery ( const DictQuery &  query)
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
querythe query to examine for relevence to this dictionary type

Implemented in DictFileEdict, and DictFileKanjidic.

Member Data Documentation

QString DictFile::m_dictionaryFile
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.

QString DictFile::m_dictionaryName
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.

QString DictFile::m_dictionaryType
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.

QMap<QString,QString> DictFile::m_searchableAttributes
protected

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:
  • dictfile.h
This file is part of the KDE documentation.
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.

kiten/lib

Skip menu "kiten/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal