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 
00096 class KReplace :
00097     public KFind
00098 {
00099     Q_OBJECT
00100 
00101 public:
00102 
00104     KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent = 0);
00105     virtual ~KReplace();
00106 
00113     int numReplacements() const { return m_replacements; }
00114 
00120     virtual void resetCounts();
00121 
00127     Result replace();
00128 
00136     KDialogBase* replaceNextDialog( bool create = false );
00137 
00143     void closeReplaceNextDialog();
00144 
00162     static int replace( QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength );
00163     static int replace( QString &text, const QRegExp &pattern, const QString &replacement, int index, long options, int *replacedLength );
00164 
00179     virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
00180 
00185     virtual void displayFinalDialog() const;
00186 
00187 signals:
00188 
00203     void replace(const QString &text, int replacementIndex, int replacedLength, int matchedLength);
00204 
00205 protected slots:
00206 
00207     void slotSkip();
00208     void slotReplace();
00209     void slotReplaceAll();
00210 
00211 private:
00212     KReplaceNextDialog* dialog();
00213     void doReplace();
00214     static int replace( QString &text, const QString &replacement, int index, int length );
00215 
00216     QString m_replacement;
00217     unsigned m_replacements;
00218 
00219     // Binary compatible extensibility.
00220     class KReplacePrivate;
00221     KReplacePrivate *d;
00222 };
00223 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:55 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001