kdecore Library API Documentation

kstringhandler.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1999 Ian Zepp (icszepp@islc.net)
00003    Copyright (C) 2000 Rik Hemsley (rikkus) <rik@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 #ifndef KSTRINGHANDLER_H
00020 #define KSTRINGHANDLER_H
00021 
00022 #include <stdlib.h>        // for atoi()
00023 #include <qstring.h>
00024 #include <qstringlist.h>
00025 #include <qregexp.h>            // for the word ranges
00026 
00027 
00066 class KStringHandler
00067 {
00068 public:
00076     static QString        word( const QString &text , uint pos );
00077 
00090     static QString        word( const QString &text , const char *range );
00091 
00101     static QString        insword( const QString &text , const QString &word , uint pos );
00102 
00112     static QString        setword( const QString &text , const QString &word , uint pos );
00113 
00126     static QString        remrange( const QString &text , const char *range );
00127 
00128 
00135     static QString        remword( const QString &text , uint pos );
00136 
00143     static QString        remword( const QString &text , const QString &word );
00144 
00150     static QString        capwords( const QString &text );
00151 
00157     static QStringList    capwords( const QStringList &list );
00158 
00164     static QString        reverse( const QString &text );
00165 
00171     static QStringList    reverse( const QStringList &list );
00172 
00181     static QString        ljust( const QString &text , uint width );
00182 
00191     static QString        rjust( const QString &text , uint width );
00192 
00201     static QString        center( const QString &text , uint width );
00202 
00209     static QString        lsqueeze( const QString & str, uint maxlen = 40 );
00210 
00217     static QString        csqueeze( const QString & str, uint maxlen = 40 );
00218 
00225     static QString        rsqueeze( const QString & str, uint maxlen = 40 );
00226 
00235     static bool matchFileName( const QString& filename, const QString& pattern );
00236 
00253     static QStringList perlSplit
00254       (const QString & sep, const QString & s, uint max = 0);
00255 
00272     static QStringList perlSplit
00273       (const QChar & sep, const QString & s, uint max = 0);
00274 
00291     static QStringList perlSplit
00292       (const QRegExp & sep, const QString & s, uint max = 0);
00293 
00302     static QString tagURLs( const QString& text );
00303 
00304 #ifdef KDE_NO_COMPAT
00305 private:
00306 #endif
00307 
00310     static bool matchFilename( const QString& filename, const QString& pattern )
00311     {
00312         return matchFileName (filename, pattern);
00313     };
00314 
00315 };
00316 #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:20:42 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001