• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

kmacroexpander.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE libraries
00003 
00004     Copyright (c) 2002-2003 Oswald Buddenhagen <ossi@kde.org>
00005     Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KMACROEXPANDER_H
00023 #define KMACROEXPANDER_H
00024 
00025 #include <kdecore_export.h>
00026 #include <QtCore/QChar>
00027 
00028 class QString;
00029 class QStringList;
00030 template <typename KT, typename VT> class QHash;
00031 class KMacroExpanderBasePrivate;
00032 
00041 class KDECORE_EXPORT KMacroExpanderBase {
00042 
00043 public:
00048     explicit KMacroExpanderBase( QChar c = QLatin1Char('%') );
00049 
00053     virtual ~KMacroExpanderBase();
00054 
00060     void expandMacros( QString &str );
00061 
00062     // TODO: This documentation is relevant for end-users. Where to put it?
00110     bool expandMacrosShellQuote( QString &str, int &pos );
00111 
00116     bool expandMacrosShellQuote( QString &str );
00117 
00122     void setEscapeChar( QChar c );
00123 
00128     QChar escapeChar() const;
00129 
00130 protected:
00144     virtual int expandPlainMacro( const QString &str, int pos, QStringList &ret );
00145 
00161     virtual int expandEscapedMacro( const QString &str, int pos, QStringList &ret );
00162 
00163 private:
00164     KMacroExpanderBasePrivate * const d;
00165 };
00166 
00217 class KDECORE_EXPORT KWordMacroExpander : public KMacroExpanderBase {
00218 
00219 public:
00224     explicit KWordMacroExpander( QChar c = QLatin1Char('%') ) : KMacroExpanderBase( c ) {}
00225 
00226 protected:
00227     virtual int expandPlainMacro( const QString &str, int pos, QStringList &ret );
00228     virtual int expandEscapedMacro( const QString &str, int pos, QStringList &ret );
00229 
00237     virtual bool expandMacro( const QString &str, QStringList &ret ) = 0;
00238 };
00239 
00251 class KDECORE_EXPORT KCharMacroExpander : public KMacroExpanderBase {
00252 
00253 public:
00258     explicit KCharMacroExpander( QChar c = QLatin1Char('%') ) : KMacroExpanderBase( c ) {}
00259 
00260 protected:
00261     virtual int expandPlainMacro( const QString &str, int pos, QStringList &ret );
00262     virtual int expandEscapedMacro( const QString &str, int pos, QStringList &ret );
00263 
00271     virtual bool expandMacro( QChar chr, QStringList &ret ) = 0;
00272 };
00273 
00278 namespace KMacroExpander {
00299     KDECORE_EXPORT QString expandMacros( const QString &str, const QHash<QChar,QString> &map, QChar c = '%' );
00300 
00324     KDECORE_EXPORT QString expandMacrosShellQuote( const QString &str, const QHash<QChar,QString> &map,
00325                                                    QChar c = QLatin1Char('%') );
00326 
00350     KDECORE_EXPORT QString expandMacros( const QString &str, const QHash<QString,QString> &map,
00351                                          QChar c = QLatin1Char('%') );
00352 
00380     KDECORE_EXPORT QString expandMacrosShellQuote( const QString &str, const QHash<QString,QString> &map,
00381                                                    QChar c = QLatin1Char('%') );
00382 
00387     KDECORE_EXPORT QString expandMacros( const QString &str, const QHash<QChar,QStringList> &map,
00388                                          QChar c = QLatin1Char('%') );
00389     KDECORE_EXPORT QString expandMacros( const QString &str, const QHash<QString,QStringList> &map,
00390                                          QChar c = QLatin1Char('%') );
00391 
00398     KDECORE_EXPORT QString expandMacrosShellQuote( const QString &str, const QHash<QChar,QStringList> &map,
00399                                                    QChar c = QLatin1Char('%') );
00400     KDECORE_EXPORT QString expandMacrosShellQuote( const QString &str, const QHash<QString,QStringList> &map, 
00401                                                    QChar c = QLatin1Char('%') );
00402 }
00403 
00404 #endif /* KMACROEXPANDER_H */

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal