// -*- c++ -*-

/*
 *  Copyright (C) 2003, Richard J. Moore <rich@kde.org>
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

#ifndef KJSEMBED_TEXTSTREAM_IMP_H
#define KJSEMBED_TEXTSTREAM_IMP_H

#include <qobject.h>

class QTextStream;

namespace KJSEmbed {
namespace Bindings {

/**
 * QObject Binding for QTextStream.
 */
class TextStream : public QObject
{
    Q_OBJECT
    Q_PROPERTY( bool writable READ isReadable )
    Q_PROPERTY( bool readable READ isWritable )
    Q_PROPERTY( QString current READ current )

public:
    TextStream( QObject *parent, const char *name, QTextStream *ts );
    virtual ~TextStream();

public slots:
    bool isReadable() const;
    bool isWritable() const;

    QString current() const;
    void print( const QString &msg );
    void println( const QString &msg );
    QString readLine();

private:
    QTextStream *ts;
    QString line;
    bool autodel;
};

} // namespace Bindings
} // namespace KJSEmbed

#endif // KJSEMBED_TEXTSTREAM_IMP_H
