• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • sonnet
filter_p.h
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 /*
3  *
4  * Copyright (C) 2004 Zack Rusin <zack@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 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  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef SONNET_FILTER_P_H
23 #define SONNET_FILTER_P_H
24 
25 #include <QtCore/QTextBoundaryFinder>
26 #include <QtCore/QString>
27 #include <kdecore_export.h>
28 
29 namespace Sonnet
30 {
31  class Settings;
32 
40  struct KDECORE_EXPORT Word
41  {
42  Word() : start( 0 ), end( true )
43  {}
44 
45  Word( const QString& w, int st, bool e = false )
46  : word( w ), start( st ), end( e )
47  {}
48  Word( const Word& other )
49  : word( other.word ), start( other.start ),
50  end( other.end )
51  {}
52 
53  QString word;
54  int start;
55  bool end;
56  };
57 
65  class KDECORE_EXPORT Filter
66  {
67  public:
68  static Filter *defaultFilter();
69  public:
70  Filter();
71  virtual ~Filter();
72 
73  static Word end();
74 
78  void setSettings(Settings*);
79 
83  Settings *settings() const;
84 
85  bool atEnd() const;
86 
87  void setBuffer( const QString& buffer );
88  QString buffer() const;
89 
90  void restart();
91 
92  virtual Word nextWord() const;
93  virtual Word wordAtPosition( unsigned int pos ) const;
94 
95  virtual void setCurrentPosition( int );
96  virtual int currentPosition() const;
97  virtual void replace( const Word& w, const QString& newWord );
98 
102  virtual QString context() const;
103  protected:
104  bool trySkipLinks() const;
105  bool ignore( const QString& word ) const;
106  bool shouldBeSkipped( bool wordWasUppercase, bool wordWasRunTogether,
107  const QString& foundWord ) const;
108 
109  protected:
110  QString m_buffer;
111  mutable QTextBoundaryFinder m_finder;
112 
113  private:
114  class Private;
115  Private* const d;
116  };
117 
118 }
119 
120 #endif // SONNET_FILTER_P_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Jul 12 2013 08:50:14 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.10.5 API Reference

Skip menu "kdelibs-4.10.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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