Sha256: 8cfe51458ac8b4ee91e4ecb9b0c907148bc857ab89e3001577c1d8c860cb4757

Contents?: true

Size: 827 Bytes

Versions: 1

Compression:

Stored size: 827 Bytes

Contents

#ifndef SUNSCRAPER_H
#define SUNSCRAPER_H

#include <QObject>
#include <QString>
#include <QMutex>
#include <QByteArray>
#include <QEventLoop>

class QWebPage;

class Sunscraper : public QObject
{
    Q_OBJECT

public:
    Sunscraper();

    void loadHtml(QString html);
    void loadUrl(QString url);

    void wait(unsigned timeout);

    QByteArray fetch();
    const char *fetchAsCString();

private slots:
    void finished(unsigned queryId, QString html);
    void timeout();

signals:
    void requestLoadHtml(unsigned queryId, QString html);
    void requestLoadUrl(unsigned queryId, QString html);
    void requestFinalize(unsigned queryId);

private:
    static unsigned _nextQueryId;
    static QMutex _staticMutex;

    unsigned _queryId;
    QEventLoop _eventLoop;
    QByteArray _html;
};

#endif // SUNSCRAPER_H

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sunscraper-1.0.0 ext/sunscraper.h