//
//     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

private:
                            KMacroExpanderBase (const KMacroExpanderBase &other);

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);

};   // 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:
                            KWordMacroExpander (const KWordMacroExpander &other);

};   // KWordMacroExpander

%ModuleHeaderCode
#include <kmacroexpander.h>
%End


class KCharMacroExpander : KMacroExpanderBase
{
%TypeHeaderCode
#include <kmacroexpander.h>
%End


public:
    explicit                KCharMacroExpander (QChar c = QLatin1Char('%'));

private:
                            KCharMacroExpander (const KCharMacroExpander &other);

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;

public:

//  Subclasses of KMacroExpanderBase

%ConvertToSubClassCode

    sipClass = NULL;

    if (dynamic_cast<KCharMacroExpander*>(sipCpp))
        sipClass = sipClass_KCharMacroExpander;
    else if (dynamic_cast<KWordMacroExpander*>(sipCpp))
        sipClass = sipClass_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




