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 #include <qfontmetrics.h>
00027 #include "kdelibs_export.h"
00028 
00070 class KDECORE_EXPORT KStringHandler
00071 {
00072 public:
00081     static QString        word( const QString &text , uint pos ) KDE_DEPRECATED;
00082 
00095     static QString        word( const QString &text , const char *range );
00096 
00106     static QString        insword( const QString &text , const QString &word , uint pos );
00107 
00117     static QString        setword( const QString &text , const QString &word , uint pos );
00118 
00131     static QString        remrange( const QString &text , const char *range );
00132 
00133 
00140     static QString        remword( const QString &text , uint pos );
00141 
00148     static QString        remword( const QString &text , const QString &word );
00149 
00155     static QString        capwords( const QString &text );
00156 
00162     static QStringList    capwords( const QStringList &list );
00163 
00169     static QString        reverse( const QString &text );
00170 
00176     static QStringList    reverse( const QStringList &list );
00177 
00187     static QString        ljust( const QString &text , uint width ) KDE_DEPRECATED;
00188 
00198     static QString        rjust( const QString &text , uint width ) KDE_DEPRECATED;
00199 
00208     static QString        center( const QString &text , uint width );
00209 
00216     static QString        lsqueeze( const QString & str, uint maxlen = 40 );
00217 
00228     static QString lEmSqueeze( const QString & name,
00229                                const QFontMetrics& fontMetrics,
00230                                uint maxlen = 30 );
00231 
00241     static QString lPixelSqueeze( const QString & name,
00242                                   const QFontMetrics& fontMetrics,
00243                                   uint maxPixels );
00244 
00251     static QString        csqueeze( const QString & str, uint maxlen = 40 );
00252 
00263     static QString cEmSqueeze( const QString & name,
00264                                const QFontMetrics& fontMetrics,
00265                                uint maxlen = 30 );
00266 
00276     static QString cPixelSqueeze( const QString & name,
00277                                   const QFontMetrics& fontMetrics,
00278                                   uint maxPixels );
00279 
00286     static QString        rsqueeze( const QString & str, uint maxlen = 40 );
00287 
00298     static QString rEmSqueeze( const QString & name,
00299                                const QFontMetrics& fontMetrics,
00300                                uint maxlen = 30 );
00301 
00311     static QString rPixelSqueeze( const QString & name,
00312                                   const QFontMetrics& fontMetrics,
00313                                   uint maxPixels );
00314 
00323     static bool matchFileName( const QString& filename, const QString& pattern );
00324     // KDE4: move to KShell
00325 
00343     static QStringList perlSplit
00344       (const QString & sep, const QString & s, uint max = 0);
00345 
00363     static QStringList perlSplit
00364       (const QChar & sep, const QString & s, uint max = 0);
00365 
00383     static QStringList perlSplit
00384       (const QRegExp & sep, const QString & s, uint max = 0);
00385 
00394     static QString tagURLs( const QString& text );
00395 
00409     static QString obscure( const QString &str );
00410 
00418     static bool isUtf8( const char *str );
00419 
00428     static QString from8Bit( const char *str );
00429 
00430 #ifdef KDE_NO_COMPAT
00431 private:
00432 #endif
00433 
00436     static KDE_DEPRECATED bool matchFilename( const QString& filename, const QString& pattern )
00437     {
00438         return matchFileName (filename, pattern);
00439     };
00440 
00441 };
00442 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Feb 8 08:00:50 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003