Public feed #603286

QBuffer

public cpp v1 · immutable
Raw Edit
·published 2007-07-04 18:00 UTC
rendered paste body
#include <QtCore>#include <QtNetwork>#include <QBuffer>#include <QTextStream>#include "HttpTest.h"HttpTest::HttpTest(QObject *parent)    : QObject(parent){  }void HttpTest::ExecuteConnection(){	http = new QHttp(this);	connect(http, SIGNAL(stateChanged(int)),             this, SLOT(updateHttpStatus(int)));	connect(http, SIGNAL(done(bool)),             this, SLOT(httpDone(bool)));	buffer = new QBuffer;	buffer->open(QIODevice::ReadWrite);	http->setHost("www.ptlug.org");	http->get("http://www.ptlug.org", buffer);}void HttpTest::updateHttpStatus(int status){	qDebug("Status: %d", status);	if(status == 0)	{		QTextStream out(buffer);			while(!out.atEnd())		{			QString line = out.readLine();			qDebug("Data: %s", line);		}	}}void HttpTest::httpDone(bool error){	qDebug("Done!");}