Files
harbour-core/harbour/contrib/hbqt/qth/QHttp.qth
2010-06-14 19:01:41 +00:00

153 lines
5.3 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* QT Source Generator for Harbour
*
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
;
; Header File to Generate QT Wrapper Sources
;
; Header File to Generate Sources
;
<CLASS>
Inherit = QObject
New = pParent
</CLASS>
<CODE>
#include <QtNetwork/QHttp>
/*
* QHttp ( QObject * parent = 0 )
* QHttp ( const QString & hostName, quint16 port = 80, QObject * parent = 0 )
* QHttp ( const QString & hostName, ConnectionMode mode, quint16 port = 0, QObject * parent = 0 )
* virtual ~QHttp ()
*/
HB_FUNC( QT_QHTTP )
{
hb_retptr( new QHttp( hbqt_par_QObject( 1 ) ) );
}
/*
* qint64 read ( char * data, qint64 maxlen )
*/
HB_FUNC( QT_QHTTP_READ )
{
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) + 1 );
qint64 iRead;
iRead = hbqt_par_QHttp( 1 )->read( iData, hb_parnint( 3 ) );
hb_retnint( iRead );
if( ! hb_storclen_buffer( iData, iRead, 2 ) )
hb_xfree( iData );
}
</CODE>
<ENUMS>
enum ConnectionMode { ConnectionModeHttp, ConnectionModeHttps }
enum Error { NoError, HostNotFound, ConnectionRefused, UnexpectedClose, ..., UnknownError }
enum State { Unconnected, HostLookup, Connecting, Sending, ..., Closing }
</ENUMS>
<PROTOS>
qint64 bytesAvailable () const
void clearPendingRequests ()
int close ()
QIODevice * currentDestinationDevice () const
int currentId () const
QHttpRequestHeader currentRequest () const
QIODevice * currentSourceDevice () const
Error error () const
QString errorString () const
int get ( const QString & path, QIODevice * to = 0 )
bool hasPendingRequests () const
int head ( const QString & path )
QHttpResponseHeader lastResponse () const
int post ( const QString & path, QIODevice * data, QIODevice * to = 0 )
int post ( const QString & path, const QByteArray & data, QIODevice * to = 0 )
#
# NEVER UNCOMMENT IT
// qint64 read ( char * data, qint64 maxlen )
#
#
QByteArray readAll ()
int request ( const QHttpRequestHeader & header, QIODevice * data = 0, QIODevice * to = 0 )
int request ( const QHttpRequestHeader & header, const QByteArray & data, QIODevice * to = 0 )
int setHost ( const QString & hostName, quint16 port = 80 )
int setHost ( const QString & hostName, ConnectionMode mode, quint16 port = 0 )
int setProxy ( const QString & host, int port, const QString & username = QString(), const QString & password = QString() )
// int setProxy ( const QNetworkProxy & proxy )
// int setSocket ( QTcpSocket * socket )
int setUser ( const QString & userName, const QString & password = QString() )
State state () const
</PROTOS>
<SLOTS>
void abort ()
//void ignoreSslErrors ()
</SLOTS>
<SIGNALS>
void authenticationRequired ( const QString & hostname, quint16 port, QAuthenticator * authenticator )
void dataReadProgress ( int done, int total )
void dataSendProgress ( int done, int total )
void done ( bool error )
// void proxyAuthenticationRequired ( const QNetworkProxy & proxy, QAuthenticator * authenticator )
void readyRead ( const QHttpResponseHeader & resp )
void requestFinished ( int id, bool error )
void requestStarted ( int id )
void responseHeaderReceived ( const QHttpResponseHeader & resp )
void sslErrors ( const QList<QSslError> & errors )
void stateChanged ( int state )
</SIGNALS>