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

KDECore

filter_p.h

Go to the documentation of this file.
00001 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
00002 /*
00003  *
00004  * Copyright (C)  2004  Zack Rusin <zack@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301  USA
00020  */
00021 
00022 #ifndef SONNET_FILTER_P_H
00023 #define SONNET_FILTER_P_H
00024 
00025 #include <QtCore/QTextBoundaryFinder>
00026 #include <QtCore/QString>
00027 #include <kdecore_export.h>
00028 
00029 namespace Sonnet
00030 {
00031     class Settings;
00032 
00040     struct KDECORE_EXPORT Word
00041     {
00042         Word() : start( 0 ), end( true )
00043             {}
00044 
00045         Word( const QString& w, int st, bool e = false )
00046             : word( w ), start( st ), end( e )
00047             {}
00048         Word( const Word& other )
00049             : word( other.word ), start( other.start ),
00050               end( other.end )
00051             {}
00052 
00053         QString word;
00054         int    start;
00055         bool    end;
00056     };
00057 
00065     class KDECORE_EXPORT Filter
00066     {
00067     public:
00068         static Filter *defaultFilter();
00069     public:
00070         Filter();
00071         virtual ~Filter();
00072 
00073         static Word end();
00074 
00078         void setSettings(Settings*);
00079 
00083         Settings *settings() const;
00084 
00085         bool atEnd() const;
00086 
00087         void setBuffer( const QString& buffer );
00088         QString buffer() const;
00089 
00090         void restart();
00091 
00092         virtual Word nextWord() const;
00093         virtual Word wordAtPosition( unsigned int pos ) const;
00094 
00095         virtual void setCurrentPosition( int );
00096         virtual int currentPosition() const;
00097         virtual void replace( const Word& w, const QString& newWord );
00098 
00102         virtual QString context() const;
00103     protected:
00104         bool trySkipLinks() const;
00105         bool ignore( const QString& word ) const;
00106         bool shouldBeSkipped( bool wordWasUppercase, bool wordWasRunTogether,
00107                               const QString& foundWord ) const;
00108 
00109     protected:
00110         QString m_buffer;
00111         mutable QTextBoundaryFinder m_finder;
00112 
00113     private:
00114         class Private;
00115         Private* const d;
00116     };
00117 
00118 }
00119 
00120 #endif // SONNET_FILTER_P_H

KDECore

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal