kutils Library API Documentation

kreplace.h

00001 /*
00002     Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
00003     Copyright (C) 2002, David Faure <david@mandrakesoft.com>
00004     This file is part of the KDE project
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2, as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KREPLACE_H
00022 #define KREPLACE_H
00023 
00024 #include "kfind.h"
00025 
00026 class KReplaceNextDialog;
00027 
00095 class KUTILS_EXPORT KReplace :
00096     public KFind
00097 {
00098     Q_OBJECT
00099 
00100 public:
00101 
00106     KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent = 0);
00113     KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent, QWidget* replaceDialog);
00114 
00115     virtual ~KReplace();
00116 
00123     int numReplacements() const { return m_replacements; }
00124 
00130     virtual void resetCounts();
00131 
00137     Result replace();
00138 
00146     KDialogBase* replaceNextDialog( bool create = false );
00147 
00153     void closeReplaceNextDialog();
00154 
00172     static int replace( QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength );
00173     static int replace( QString &text, const QRegExp &pattern, const QString &replacement, int index, long options, int *replacedLength );
00174 
00189     virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
00190 
00195     virtual void displayFinalDialog() const;
00196 
00197 signals:
00198 
00213     void replace(const QString &text, int replacementIndex, int replacedLength, int matchedLength);
00214 
00215 protected slots:
00216 
00217     void slotSkip();
00218     void slotReplace();
00219     void slotReplaceAll();
00220 
00221 private:
00222     KReplaceNextDialog* dialog();
00223     void doReplace();
00224     static int replace( QString &text, const QString &replacement, int index, long options, int length );
00225 
00226     QString m_replacement;
00227     unsigned m_replacements;
00228 
00229     // Binary compatible extensibility.
00230     class KReplacePrivate;
00231     KReplacePrivate *d;
00232 };
00233 #endif
KDE Logo
This file is part of the documentation for kutils Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Jan 23 19:34:25 2006 by doxygen 1.4.3 written by Dimitri van Heesch, © 1997-2003