mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-24 19:02:51 +00:00
140 lines
4.3 KiB
Text
140 lines
4.3 KiB
Text
![]() |
//
|
||
|
// Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
|
||
|
// Earlier copyrights 1998 - 2007 Jim Bublitz also apply
|
||
|
|
||
|
// Generated by twine
|
||
|
|
||
|
// This file is part of PyKDE4.
|
||
|
|
||
|
// PyKDE4 is free software; you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU Lesser General Public License as
|
||
|
// published by the Free Software Foundation; either version 2.1 of
|
||
|
// the License, or (at your option) any later version.
|
||
|
|
||
|
// PyKDE4 is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
|
||
|
|
||
|
%ModuleHeaderCode
|
||
|
//ctscc
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
class KMacroExpanderBase
|
||
|
{
|
||
|
%TypeHeaderCode
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
//force
|
||
|
KMacroExpanderBase (const KMacroExpanderBase& other);
|
||
|
|
||
|
//end
|
||
|
public:
|
||
|
explicit KMacroExpanderBase (QChar c = QLatin1Char('%'));
|
||
|
void expandMacros (QString& str);
|
||
|
bool expandMacrosShellQuote (QString& str, int& pos /Out/);
|
||
|
//ig bool expandMacrosShellQuote (QString& str);
|
||
|
void setEscapeChar (QChar c);
|
||
|
QChar escapeChar () const;
|
||
|
|
||
|
protected:
|
||
|
virtual int expandPlainMacro (const QString& str, int pos, QStringList& ret);
|
||
|
virtual int expandEscapedMacro (const QString& str, int pos, QStringList& ret);
|
||
|
|
||
|
public:
|
||
|
~KMacroExpanderBase ();
|
||
|
};
|
||
|
// KMacroExpanderBase
|
||
|
|
||
|
%ModuleHeaderCode
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
|
||
|
class KWordMacroExpander : KMacroExpanderBase
|
||
|
{
|
||
|
%TypeHeaderCode
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
|
||
|
public:
|
||
|
explicit KWordMacroExpander (QChar c = QLatin1Char('%'));
|
||
|
|
||
|
protected:
|
||
|
virtual int expandPlainMacro (const QString& str, int pos, QStringList& ret);
|
||
|
virtual int expandEscapedMacro (const QString& str, int pos, QStringList& ret);
|
||
|
virtual bool expandMacro (const QString& str, QStringList& ret)=0;
|
||
|
private:
|
||
|
//force
|
||
|
KWordMacroExpander (const KWordMacroExpander& other);
|
||
|
|
||
|
//end
|
||
|
};
|
||
|
// KWordMacroExpander
|
||
|
|
||
|
%ModuleHeaderCode
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
|
||
|
class KCharMacroExpander : KMacroExpanderBase
|
||
|
{
|
||
|
%TypeHeaderCode
|
||
|
#include <kmacroexpander.h>
|
||
|
%End
|
||
|
|
||
|
|
||
|
public:
|
||
|
explicit KCharMacroExpander (QChar c = QLatin1Char('%'));
|
||
|
|
||
|
private:
|
||
|
//force
|
||
|
KCharMacroExpander (const KCharMacroExpander& other);
|
||
|
|
||
|
//end
|
||
|
protected:
|
||
|
virtual int expandPlainMacro (const QString& str, int pos, QStringList& ret);
|
||
|
virtual int expandEscapedMacro (const QString& str, int pos, QStringList& ret);
|
||
|
virtual bool expandMacro (QChar chr, QStringList& ret)=0;
|
||
|
|
||
|
|
||
|
// Subclasses of KMacroExpanderBase
|
||
|
|
||
|
%ConvertToSubClassCode
|
||
|
// CTSCC for subclasses of 'KMacroExpanderBase'
|
||
|
sipType = NULL;
|
||
|
|
||
|
if (dynamic_cast<KCharMacroExpander*>(sipCpp))
|
||
|
sipType = sipType_KCharMacroExpander;
|
||
|
else if (dynamic_cast<KWordMacroExpander*>(sipCpp))
|
||
|
sipType = sipType_KWordMacroExpander;
|
||
|
%End
|
||
|
|
||
|
};
|
||
|
// KCharMacroExpander
|
||
|
|
||
|
namespace KMacroExpander
|
||
|
{
|
||
|
QString expandMacros (const QString& str, const QHash<QChar,QString>& map, QChar c = '%');
|
||
|
QString expandMacrosShellQuote (const QString& str, const QHash<QChar,QString>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacros (const QString& str, const QHash<QString,QString>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacrosShellQuote (const QString& str, const QHash<QString,QString>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacros (const QString& str, const QHash<QChar,QStringList>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacros (const QString& str, const QHash<QString,QStringList>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacrosShellQuote (const QString& str, const QHash<QChar,QStringList>& map, QChar c = QLatin1Char('%'));
|
||
|
QString expandMacrosShellQuote (const QString& str, const QHash<QString,QStringList>& map, QChar c = QLatin1Char('%'));
|
||
|
};
|
||
|
// KMacroExpander
|
||
|
|
||
|
|
||
|
|
||
|
|