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 "kdemacros.h"
00028 
00070 class KStringHandler
00071 {
00072 public:
00080     static QString        word( const QString &text , uint pos );
00081 
00094     static QString        word( const QString &text , const char *range );
00095 
00105     static QString        insword( const QString &text , const QString &word , uint pos );
00106 
00116     static QString        setword( const QString &text , const QString &word , uint pos );
00117 
00130     static QString        remrange( const QString &text , const char *range );
00131 
00132 
00139     static QString        remword( const QString &text , uint pos );
00140 
00147     static QString        remword( const QString &text , const QString &word );
00148 
00154     static QString        capwords( const QString &text );
00155 
00161     static QStringList    capwords( const QStringList &list );
00162 
00168     static QString        reverse( const QString &text );
00169 
00175     static QStringList    reverse( const QStringList &list );
00176 
00185     static QString        ljust( const QString &text , uint width );
00186 
00195     static QString        rjust( const QString &text , uint width );
00196 
00205     static QString        center( const QString &text , uint width );
00206 
00213     static QString        lsqueeze( const QString & str, uint maxlen = 40 );
00214 
00225     static QString lEmSqueeze( const QString & name,
00226                                const QFontMetrics& fontMetrics,
00227                                uint maxlen = 30 );
00228 
00238     static QString lPixelSqueeze( const QString & name,
00239                                   const QFontMetrics& fontMetrics,
00240                                   uint maxPixels );
00241 
00248     static QString        csqueeze( const QString & str, uint maxlen = 40 );
00249 
00260     static QString cEmSqueeze( const QString & name,
00261                                const QFontMetrics& fontMetrics,
00262                                uint maxlen = 30 );
00263 
00273     static QString cPixelSqueeze( const QString & name,
00274                                   const QFontMetrics& fontMetrics,
00275                                   uint maxPixels );
00276 
00283     static QString        rsqueeze( const QString & str, uint maxlen = 40 );
00284 
00295     static QString rEmSqueeze( const QString & name,
00296                                const QFontMetrics& fontMetrics,
00297                                uint maxlen = 30 );
00298 
00308     static QString rPixelSqueeze( const QString & name,
00309                                   const QFontMetrics& fontMetrics,
00310                                   uint maxPixels );
00311 
00320     static bool matchFileName( const QString& filename, const QString& pattern );
00321     // KDE4: move to KShell
00322 
00340     static QStringList perlSplit
00341       (const QString & sep, const QString & s, uint max = 0);
00342 
00360     static QStringList perlSplit
00361       (const QChar & sep, const QString & s, uint max = 0);
00362 
00380     static QStringList perlSplit
00381       (const QRegExp & sep, const QString & s, uint max = 0);
00382 
00391     static QString tagURLs( const QString& text );
00392 
00406     static QString obscure( const QString &str );
00407 
00415     static bool isUtf8( const char *str );
00416 
00425     static QString from8Bit( const char *str );
00426 
00427 #ifdef KDE_NO_COMPAT
00428 private:
00429 #endif
00430 
00433     static KDE_DEPRECATED bool matchFilename( const QString& filename, const QString& pattern )
00434     {
00435         return matchFileName (filename, pattern);
00436     };
00437 
00438 };
00439 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 30 05:15:55 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003