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

kiten/lib

  • sources
  • kde-4.14
  • kdeedu
  • kiten
  • lib
dictquery.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * This file is part of Kiten, a KDE Japanese Reference Tool *
3  * Copyright (C) 2006 Joseph Kerian <jkerian@gmail.com> *
4  * Copyright (C) 2011 Daniel E. Moctezuma <democtezuma@gmail.com> *
5  * *
6  * This library is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Library General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Library General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Library General Public License *
17  * along with this library; see the file COPYING.LIB. If not, write to *
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
19  * Boston, MA 02110-1301, USA. *
20  *****************************************************************************/
21 
22 #ifndef KITEN_DICTQUERY_H
23 #define KITEN_DICTQUERY_H
24 
25 #include <QHash>
26 #include <QHashIterator>
27 #include <QString>
28 #include <QStringList>
29 
30 class QChar;
31 
32 #include "libkitenexport.h"
33 
89 class KITEN_EXPORT DictQuery
90 {
91 public:
96  static const QString mainDelimiter;
101  static const QString propertySeperator;
107  DictQuery();
113  DictQuery( const QString& str );
119  DictQuery( const DictQuery& orig );
123  ~DictQuery();
124 
128  bool isEmpty() const;
132  void clear();
136  DictQuery &operator=( const DictQuery &old );
140  DictQuery *clone() const;
146  const QString toString() const;
151  operator QString() const;
152 
156  const QList<QString> listPropertyKeys() const;
160  const QString operator[]( const QString &key ) const;
164  QString operator[]( const QString &key );
168  QString getProperty( const QString &key ) const;
173  bool hasProperty( const QString &key ) const;
184  bool setProperty( const QString& key, const QString& value );
190  bool removeProperty( const QString &key );
194  QString takeProperty( const QString &key );
195 
201  QStringList getDictionaries() const;
206  void setDictionaries( const QStringList &newDictionaries );
207 
211  QString getMeaning() const;
215  bool setMeaning( const QString &newMeaning );
219  QString getPronunciation() const;
223  bool setPronunciation( const QString &newPronunciation );
228  QString getWord() const;
233  bool setWord( const QString &newWord );
234 
240  KITEN_EXPORT friend bool operator==( const DictQuery &a, const DictQuery &b );
244  KITEN_EXPORT friend bool operator!=( const DictQuery &other, const DictQuery &query );
249  KITEN_EXPORT friend bool operator<( const DictQuery &a, const DictQuery &b );
253  KITEN_EXPORT friend bool operator<=( const DictQuery &a, const DictQuery &b );
259  DictQuery &operator+=( const DictQuery &old );
263  DictQuery &operator=( const QString &old );
267  DictQuery &operator+=( const QString &old );
271  KITEN_EXPORT friend DictQuery operator+( const DictQuery &a, const DictQuery &b );
272 #ifndef QT_NO_CAST_ASCII
273 
277  DictQuery &operator=( const char* );
278 #endif
279 
280  //Specify the type of matching
285  enum MatchType
286  {
287  Exact,
288  Beginning,
289  Ending,
290  Anywhere
291  };
295  MatchType getMatchType() const;
299  void setMatchType( MatchType newType );
300 
305  enum MatchWordType
306  {
307  Any,
308  Verb,
309  Noun,
310  Adjective,
311  Adverb,
312  Prefix,
313  Suffix,
314  Expression
315  };
319  MatchWordType getMatchWordType() const;
323  void setMatchWordType( MatchWordType newType );
324 
325  enum FilterType
326  {
327  NoFilter,
328  Rare,
329  CommonUncommon
330  };
334  FilterType getFilterType() const;
339  void setFilterType( FilterType newType );
340 
345  enum StringTypeEnum
346  {
347  Kanji,
348  Kana,
349  Latin,
350  Mixed,
351  ParseError
352  };
360  static StringTypeEnum stringTypeCheck( const QString &in );
366  static StringTypeEnum charTypeCheck( const QChar &ch );
367 
368 private:
369  class Private;
370  Private* const d;
371 };
372 
373 //Currently... KDE doesn't seem to want to use exceptions
374 #ifdef LIBKITEN_USING_EXCEPTIONS
375 class InvalidQueryException
376 {
377  public:
378  InvalidQueryException( QString x ) { m_val = x; }
379  InvalidQueryException( QString m = "Invalid Query String", QString x ) { m_val = x; m_msg = m; }
380  QString value() { return m_val; }
381  QString message() { return m_msg; }
382 
383  protected:
384  QString m_val;
385  QString m_msg;
386 };
387 #endif
388 
389 #endif
operator+
DictQuery operator+(const DictQuery &a, const DictQuery &b)
Definition: dictquery.cpp:191
DictQuery::Any
Definition: dictquery.h:307
operator==
bool operator==(const DictQuery &a, const DictQuery &b)
Definition: dictquery.cpp:198
libkitenexport.h
DictQuery::Kana
Definition: dictquery.h:348
QChar
KITEN_EXPORT
#define KITEN_EXPORT
Definition: libkitenexport.h:35
DictQuery::MatchType
MatchType
This enum is used to define the type of matching this query is supposed to do.
Definition: dictquery.h:285
DictQuery::Rare
Definition: dictquery.h:328
DictQuery::Adverb
Definition: dictquery.h:311
DictQuery::MatchWordType
MatchWordType
This enum is used to define the type of matching this query is supposed to do.
Definition: dictquery.h:305
DictQuery::Adjective
Definition: dictquery.h:310
DictQuery::Mixed
Definition: dictquery.h:350
operator<
bool operator<(const DictQuery &a, const DictQuery &b)
Definition: dictquery.cpp:220
DictQuery::Ending
Definition: dictquery.h:289
DictQuery::StringTypeEnum
StringTypeEnum
This enum is used as the return type for the two utility functions, stringTypeCheck and charTypeCheck...
Definition: dictquery.h:345
QString
QList< QString >
QStringList
DictQuery::Latin
Definition: dictquery.h:349
DictQuery::FilterType
FilterType
Definition: dictquery.h:325
DictQuery::Kanji
Definition: dictquery.h:347
DictQuery::mainDelimiter
static const QString mainDelimiter
This is the main delimiter that the DictQuery uses when parsing strings.
Definition: dictquery.h:96
DictQuery
A class to allow users of libkiten to properly setup a database query.
Definition: dictquery.h:89
DictQuery::Beginning
Definition: dictquery.h:288
DictQuery::Prefix
Definition: dictquery.h:312
operator!=
bool operator!=(const DictQuery &a, const DictQuery &b)
Definition: dictquery.cpp:215
DictQuery::propertySeperator
static const QString propertySeperator
This is the delimiter that DictQuery uses when parsing property strings of the form strokes:4...
Definition: dictquery.h:101
DictQuery::Noun
Definition: dictquery.h:309
DictQuery::Exact
Definition: dictquery.h:287
DictQuery::NoFilter
Definition: dictquery.h:327
DictQuery::Suffix
Definition: dictquery.h:313
DictQuery::Verb
Definition: dictquery.h:308
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