From d027bfc0518d02b0f7b0bb4e0d75113a2011820a Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 2 Mar 2011 01:43:30 +0000 Subject: [PATCH] 2011-03-01 17:38 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtnetwork/hbqt_init.cpp * contrib/hbqt/qtnetwork/hbqtnetwork.hbx * contrib/hbqt/qtnetwork/qth/filelist.hbm ! Adjusted: to take use of new classes intead of NULL pointers. + contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth + contrib/hbqt/qtnetwork/qth/QUrlInfo.qth + Added: two pending classes. --- harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp | 8 +- .../contrib/hbqt/qtnetwork/hbqtnetwork.hbx | 6 ++ .../hbqt/qtnetwork/qth/QNetworkProxy.qth | 79 ++++++++++++++++ .../contrib/hbqt/qtnetwork/qth/QUrlInfo.qth | 89 +++++++++++++++++++ .../contrib/hbqt/qtnetwork/qth/filelist.hbm | 2 + 5 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth create mode 100644 harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth diff --git a/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp b/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp index d66b29fea6..8ded023aa9 100644 --- a/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp @@ -71,10 +71,8 @@ HB_EXTERN_BEGIN extern void * hbqt_gcAllocate_QObject( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QHttpResponseHeader( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QNetworkRequest( void * pObj, bool bNew ); -#if 0 // Classes not initiated yet! extern void * hbqt_gcAllocate_QNetworkProxy( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QUrlInfo( void * pObj, bool bNew ); -#endif HB_EXTERN_END /*----------------------------------------------------------------------*/ @@ -95,7 +93,7 @@ static void hbqt_SlotsExecQNetworkProxyPointer( PHB_ITEM * codeBlock, void ** ar hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_objectGC( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); + hb_vmPush( hbqt_create_objectGC( hbqt_gcAllocate_QNetworkProxy( new QNetworkProxy( ( *reinterpret_cast< QNetworkProxy( * ) >( arguments[ 1 ] ) ) ), true ), "hb_QNetworkProxy" ) ); hb_vmPush( hbqt_create_objectGC( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 2 ] ) ), false ), ( const char * ) pList.at( 1 ).data() ) ); hb_vmSend( 2 ); } @@ -116,11 +114,7 @@ static void hbqt_SlotsExecQUrlInfo( PHB_ITEM * codeBlock, void ** arguments, QSt hb_vmPushEvalSym(); hb_vmPush( codeBlock ); -#if 0 hb_vmPush( hbqt_create_objectGC( hbqt_gcAllocate_QUrlInfo( new QUrlInfo( ( *reinterpret_cast< QUrlInfo( * ) >( arguments[ 1 ] ) ) ), true ), "hb_QUrlInfo" ) ); -#else - hb_vmPushNil(); -#endif hb_vmSend( 1 ); } diff --git a/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx b/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx index 0855772c93..5438c9c35f 100644 --- a/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx +++ b/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx @@ -32,7 +32,9 @@ DYNAMIC HB_QHTTP DYNAMIC HB_QHTTPHEADER DYNAMIC HB_QHTTPREQUESTHEADER DYNAMIC HB_QHTTPRESPONSEHEADER +DYNAMIC HB_QNETWORKPROXY DYNAMIC HB_QNETWORKREQUEST +DYNAMIC HB_QURLINFO DYNAMIC QFTP DYNAMIC QFTPFROMPOINTER DYNAMIC QHTTP @@ -43,8 +45,12 @@ DYNAMIC QHTTPREQUESTHEADER DYNAMIC QHTTPREQUESTHEADERFROMPOINTER DYNAMIC QHTTPRESPONSEHEADER DYNAMIC QHTTPRESPONSEHEADERFROMPOINTER +DYNAMIC QNETWORKPROXY +DYNAMIC QNETWORKPROXYFROMPOINTER DYNAMIC QNETWORKREQUEST DYNAMIC QNETWORKREQUESTFROMPOINTER +DYNAMIC QURLINFO +DYNAMIC QURLINFOFROMPOINTER DYNAMIC __HBQTNETWORK #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBQTNETWORK__REQUEST ) diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth new file mode 100644 index 0000000000..6ecbd6b309 --- /dev/null +++ b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth @@ -0,0 +1,79 @@ +/* + * $Id$ + */ + +/* + * Harbour Qt wrapper generator control file + * + * Copyright 2009-2011 Pritpal Bedi + * www - http://www.harbour-project.org + * + * See COPYING for licensing terms. + */ + +; Header File to Generate Sources +; + + +QObject = no +Inherit = +New = + + + +#include + + +/* + * QNetworkProxy () + * QNetworkProxy ( ProxyType type, const QString & hostName = QString(), quint16 port = 0, const QString & user = QString(), const QString & password = QString() ) + * QNetworkProxy ( const QNetworkProxy & other ) + * ~QNetworkProxy () + */ +HB_FUNC( QT_QNETWORKPROXY ) +{ + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + __HB_RETPTRGC__( new QNetworkProxy( *hbqt_par_QNetworkProxy( 1 ) ) ); + } + else if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) + { + __HB_RETPTRGC__( new QNetworkProxy( ( QNetworkProxy::ProxyType ) hb_parni( 1 ), ( HB_ISCHAR( 2 ) ? hbqt_par_QString( 2 ) : QString() ), ( quint16 ) ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 0 ), ( HB_ISCHAR( 4 ) ? hbqt_par_QString( 4 ) : QString() ), ( HB_ISCHAR( 5 ) ? hbqt_par_QString( 5 ) : QString() ) ) ); + } + else + { + __HB_RETPTRGC__( new QNetworkProxy() ); + } +} + + + +flags Capabilities +enum Capability { TunnelingCapability, ListeningCapability, UdpTunnelingCapability, CachingCapability, HostNameLookupCapability } +enum ProxyType { NoProxy, DefaultProxy, Socks5Proxy, HttpProxy, HttpCachingProxy, FtpCachingProxy } + + + +Capabilities capabilities () const +QString hostName () const +bool isCachingProxy () const +bool isTransparentProxy () const +QString password () const +quint16 port () const +void setCapabilities ( Capabilities capabilities ) +void setHostName ( const QString & hostName ) +void setPassword ( const QString & password ) +void setPort ( quint16 port ) +void setType ( QNetworkProxy::ProxyType type ) +void setUser ( const QString & user ) +QNetworkProxy::ProxyType type () const +QString user () const +QNetworkProxy applicationProxy () +void setApplicationProxy ( const QNetworkProxy & networkProxy ) + + + + + + + diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth b/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth new file mode 100644 index 0000000000..bb72314d3c --- /dev/null +++ b/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth @@ -0,0 +1,89 @@ +/* + * $Id$ + */ + +/* + * Harbour Qt wrapper generator control file + * + * Copyright 2009-2011 Pritpal Bedi + * www - http://www.harbour-project.org + * + * See COPYING for licensing terms. + */ + +; Header File to Generate Sources +; + + +QObject = no +Inherit = +New = + + + +#include + + +/* + * QUrlInfo () + * QUrlInfo ( const QUrlInfo & ui ) + * QUrlInfo ( const QString & name, int permissions, const QString & owner, const QString & group, qint64 size, const QDateTime & lastModified, const QDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable ) + * QUrlInfo ( const QUrl & url, int permissions, const QString & owner, const QString & group, qint64 size, const QDateTime & lastModified, const QDateTime & lastRead, bool isDir, bool isFile, bool isSymLink, bool isWritable, bool isReadable, bool isExecutable ) + * virtual ~QUrlInfo () + * + */ +HB_FUNC( QT_QURLINFO ) +{ + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + __HB_RETPTRGC__( new QUrlInfo( *hbqt_par_QUrlInfo( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QUrlInfo() ); + } +} + + + +enum PermissionSpec { ReadOwner, WriteOwner, ExeOwner, ReadGroup, ..., ExeOther } + + + +QString group () const +bool isDir () const +bool isExecutable () const +bool isFile () const +bool isReadable () const +bool isSymLink () const +bool isValid () const +bool isWritable () const +QDateTime lastModified () const +QDateTime lastRead () const +QString name () const +QString owner () const +int permissions () const +virtual void setDir ( bool b ) +virtual void setFile ( bool b ) +virtual void setGroup ( const QString & s ) +virtual void setLastModified ( const QDateTime & dt ) +void setLastRead ( const QDateTime & dt ) +virtual void setName ( const QString & name ) +virtual void setOwner ( const QString & s ) +virtual void setPermissions ( int p ) +virtual void setReadable ( bool b ) +virtual void setSize ( qint64 size ) +virtual void setSymLink ( bool b ) +virtual void setWritable ( bool b ) +qint64 size () const + +bool equal ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy ) +bool greaterThan ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy ) +bool lessThan ( const QUrlInfo & i1, const QUrlInfo & i2, int sortBy ) + + + + + + + diff --git a/harbour/contrib/hbqt/qtnetwork/qth/filelist.hbm b/harbour/contrib/hbqt/qtnetwork/qth/filelist.hbm index e7906e622a..2dc1c2866c 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/filelist.hbm +++ b/harbour/contrib/hbqt/qtnetwork/qth/filelist.hbm @@ -12,3 +12,5 @@ QHttpHeader.qth QHttpRequestHeader.qth QHttpResponseHeader.qth QNetworkRequest.qth +QNetworkProxy.qth +QUrlInfo.qth