diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 435f4c79fd..e7395347cd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-05 08:24 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qth/QList.qth + + Uncommented few methods. + * contrib/hbqt/qth/QUrl.qth + ! Changed: the constructor. + + * contrib/hbqt/doc/en/class_qlist.txt + * contrib/hbqt/qtcore/QList.cpp + * contrib/hbqt/qtcore/QUrl.cpp + * contrib/hbqt/qtcore/TQList.prg + * Auto generated + 2010-07-05 00:20 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/generator/hbqtgen.prg + Implemented: QList support for Q* data types as return value. diff --git a/harbour/contrib/hbqt/doc/en/class_qlist.txt b/harbour/contrib/hbqt/doc/en/class_qlist.txt index 15b8b0fc78..ef29733bc3 100644 --- a/harbour/contrib/hbqt/doc/en/class_qlist.txt +++ b/harbour/contrib/hbqt/doc/en/class_qlist.txt @@ -29,14 +29,23 @@ An instance of the object of type QList $METHODS$ :append( xValue ) -> NIL + :at( nI ) -> pT + :back() -> pT + :back_1() -> pT :clear() -> NIL :count( xValue ) -> nInt :count_1() -> nInt :empty() -> lBool :endsWith( xValue ) -> lBool + :first() -> pT + :first_1() -> pT + :front() -> pT + :front_1() -> pT :indexOf( xValue, nFrom ) -> nInt :insert( nI, xValue ) -> NIL :isEmpty() -> lBool + :last() -> pT + :last_1() -> pT :lastIndexOf( xValue, nFrom ) -> nInt :length() -> nInt :move( nFrom, nTo ) -> NIL @@ -54,6 +63,11 @@ :size() -> nInt :startsWith( xValue ) -> lBool :swap( nI, nJ ) -> NIL + :takeAt( nI ) -> pT + :takeFirst() -> pT + :takeLast() -> pT + :value( nI ) -> pT + :value_1( nI, xDefaultValue ) -> pT $DESCRIPTION$ diff --git a/harbour/contrib/hbqt/qtcore/QList.cpp b/harbour/contrib/hbqt/qtcore/QList.cpp index 03bd940eb9..141d69947b 100644 --- a/harbour/contrib/hbqt/qtcore/QList.cpp +++ b/harbour/contrib/hbqt/qtcore/QList.cpp @@ -66,20 +66,18 @@ /*----------------------------------------------------------------------*/ /* - * Constructed[ 26/55 [ 47.27% ] ] + * Constructed[ 40/55 [ 72.73% ] ] * * *** Unconvered Prototypes *** * ----------------------------- * * void append ( const QList & value ) + * QList mid ( int pos, int length = -1 ) const * QSet toSet () const * QVector toVector () const * * *** Commented out protos which construct fine but do not compile *** * - * // const T & at ( int i ) const - * // T & back () - * // const T & back () const * //iterator begin () * //const_iterator begin () const * //const_iterator constBegin () const @@ -89,20 +87,8 @@ * //const_iterator end () const * //iterator erase ( iterator pos ) * //iterator erase ( iterator begin, iterator end ) - * // T & first () - * // const T & first () const - * // T & front () - * // const T & front () const * //iterator insert ( iterator before, const T & value ) - * // T & last () - * // const T & last () const - * // QList mid ( int pos, int length = -1 ) const - * // T takeAt ( int i ) - * // T takeFirst () - * // T takeLast () * //std::list toStdList () const - * // T value ( int i ) const - * // T value ( int i, const T & defaultValue ) const */ #include @@ -192,6 +178,48 @@ HB_FUNC( QT_QLIST_APPEND ) } } +/* + * const T & at ( int i ) const + */ +HB_FUNC( QT_QLIST_AT ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->at( hb_parni( 2 ) ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_AT FP=hb_retptr( ( p )->at( hb_parni( 2 ) ) ); p is NULL" ) ); + } +} + +/* + * T & back () + */ +HB_FUNC( QT_QLIST_BACK ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->back() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_BACK FP=hb_retptr( ( p )->back() ); p is NULL" ) ); + } +} + +/* + * const T & back () const + */ +HB_FUNC( QT_QLIST_BACK_1 ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->back() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_BACK_1 FP=hb_retptr( ( p )->back() ); p is NULL" ) ); + } +} + /* * void clear () */ @@ -262,6 +290,62 @@ HB_FUNC( QT_QLIST_ENDSWITH ) } } +/* + * T & first () + */ +HB_FUNC( QT_QLIST_FIRST ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->first() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_FIRST FP=hb_retptr( ( p )->first() ); p is NULL" ) ); + } +} + +/* + * const T & first () const + */ +HB_FUNC( QT_QLIST_FIRST_1 ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->first() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_FIRST_1 FP=hb_retptr( ( p )->first() ); p is NULL" ) ); + } +} + +/* + * T & front () + */ +HB_FUNC( QT_QLIST_FRONT ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->front() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_FRONT FP=hb_retptr( ( p )->front() ); p is NULL" ) ); + } +} + +/* + * const T & front () const + */ +HB_FUNC( QT_QLIST_FRONT_1 ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->front() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_FRONT_1 FP=hb_retptr( ( p )->front() ); p is NULL" ) ); + } +} + /* * int indexOf ( const T & value, int from = 0 ) const */ @@ -304,6 +388,34 @@ HB_FUNC( QT_QLIST_ISEMPTY ) } } +/* + * T & last () + */ +HB_FUNC( QT_QLIST_LAST ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->last() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_LAST FP=hb_retptr( ( p )->last() ); p is NULL" ) ); + } +} + +/* + * const T & last () const + */ +HB_FUNC( QT_QLIST_LAST_1 ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->last() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_LAST_1 FP=hb_retptr( ( p )->last() ); p is NULL" ) ); + } +} + /* * int lastIndexOf ( const T & value, int from = -1 ) const */ @@ -542,6 +654,76 @@ HB_FUNC( QT_QLIST_SWAP ) } } +/* + * T takeAt ( int i ) + */ +HB_FUNC( QT_QLIST_TAKEAT ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->takeAt( hb_parni( 2 ) ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_TAKEAT FP=hb_retptr( ( p )->takeAt( hb_parni( 2 ) ) ); p is NULL" ) ); + } +} + +/* + * T takeFirst () + */ +HB_FUNC( QT_QLIST_TAKEFIRST ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->takeFirst() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_TAKEFIRST FP=hb_retptr( ( p )->takeFirst() ); p is NULL" ) ); + } +} + +/* + * T takeLast () + */ +HB_FUNC( QT_QLIST_TAKELAST ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->takeLast() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_TAKELAST FP=hb_retptr( ( p )->takeLast() ); p is NULL" ) ); + } +} + +/* + * T value ( int i ) const + */ +HB_FUNC( QT_QLIST_VALUE ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->value( hb_parni( 2 ) ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_VALUE FP=hb_retptr( ( p )->value( hb_parni( 2 ) ) ); p is NULL" ) ); + } +} + +/* + * T value ( int i, const T & defaultValue ) const + */ +HB_FUNC( QT_QLIST_VALUE_1 ) +{ + QList< void *> * p = hbqt_par_QList( 1 ); + if( p ) + hb_retptr( ( p )->value( hb_parni( 2 ), hb_param( 3, HB_IT_ANY ) ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QLIST_VALUE_1 FP=hb_retptr( ( p )->value( hb_parni( 2 ), hb_param( 3, HB_IT_ANY ) ) ); p is NULL" ) ); + } +} + /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/qtcore/QUrl.cpp b/harbour/contrib/hbqt/qtcore/QUrl.cpp index 5fc1719ff4..26ae2a3966 100644 --- a/harbour/contrib/hbqt/qtcore/QUrl.cpp +++ b/harbour/contrib/hbqt/qtcore/QUrl.cpp @@ -164,7 +164,18 @@ HB_FUNC( QT_QURL ) { QUrl * pObj = NULL; - pObj = new QUrl( hbqt_par_QString( 1 ) ) ; + if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + pObj = new QUrl( hbqt_par_QString( 1 ) ) ; + } + else if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + pObj = new QUrl( *hbqt_par_QUrl( 1 ) ) ; + } + else + { + pObj = new QUrl() ; + } hb_retptrGC( hbqt_gcAllocate_QUrl( ( void * ) pObj, true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/TQList.prg b/harbour/contrib/hbqt/qtcore/TQList.prg index f27b069176..5b081f5df4 100644 --- a/harbour/contrib/hbqt/qtcore/TQList.prg +++ b/harbour/contrib/hbqt/qtcore/TQList.prg @@ -68,14 +68,23 @@ CREATE CLASS QList INHERIT HbQtObjectHandler METHOD new( ... ) METHOD append( xValue ) + METHOD at( nI ) + METHOD back() + METHOD back_1() METHOD clear() METHOD count( xValue ) METHOD count_1() METHOD empty() METHOD endsWith( xValue ) + METHOD first() + METHOD first_1() + METHOD front() + METHOD front_1() METHOD indexOf( xValue, nFrom ) METHOD insert( nI, xValue ) METHOD isEmpty() + METHOD last() + METHOD last_1() METHOD lastIndexOf( xValue, nFrom ) METHOD length() METHOD move( nFrom, nTo ) @@ -93,6 +102,11 @@ CREATE CLASS QList INHERIT HbQtObjectHandler METHOD size() METHOD startsWith( xValue ) METHOD swap( nI, nJ ) + METHOD takeAt( nI ) + METHOD takeFirst() + METHOD takeLast() + METHOD value( nI ) + METHOD value_1( nI, xDefaultValue ) ENDCLASS @@ -110,6 +124,18 @@ METHOD QList:append( xValue ) RETURN Qt_QList_append( ::pPtr, xValue ) +METHOD QList:at( nI ) + RETURN Qt_QList_at( ::pPtr, nI ) + + +METHOD QList:back() + RETURN Qt_QList_back( ::pPtr ) + + +METHOD QList:back_1() + RETURN Qt_QList_back_1( ::pPtr ) + + METHOD QList:clear() RETURN Qt_QList_clear( ::pPtr ) @@ -130,6 +156,22 @@ METHOD QList:endsWith( xValue ) RETURN Qt_QList_endsWith( ::pPtr, xValue ) +METHOD QList:first() + RETURN Qt_QList_first( ::pPtr ) + + +METHOD QList:first_1() + RETURN Qt_QList_first_1( ::pPtr ) + + +METHOD QList:front() + RETURN Qt_QList_front( ::pPtr ) + + +METHOD QList:front_1() + RETURN Qt_QList_front_1( ::pPtr ) + + METHOD QList:indexOf( xValue, nFrom ) RETURN Qt_QList_indexOf( ::pPtr, xValue, nFrom ) @@ -142,6 +184,14 @@ METHOD QList:isEmpty() RETURN Qt_QList_isEmpty( ::pPtr ) +METHOD QList:last() + RETURN Qt_QList_last( ::pPtr ) + + +METHOD QList:last_1() + RETURN Qt_QList_last_1( ::pPtr ) + + METHOD QList:lastIndexOf( xValue, nFrom ) RETURN Qt_QList_lastIndexOf( ::pPtr, xValue, nFrom ) @@ -209,3 +259,23 @@ METHOD QList:startsWith( xValue ) METHOD QList:swap( nI, nJ ) RETURN Qt_QList_swap( ::pPtr, nI, nJ ) + +METHOD QList:takeAt( nI ) + RETURN Qt_QList_takeAt( ::pPtr, nI ) + + +METHOD QList:takeFirst() + RETURN Qt_QList_takeFirst( ::pPtr ) + + +METHOD QList:takeLast() + RETURN Qt_QList_takeLast( ::pPtr ) + + +METHOD QList:value( nI ) + RETURN Qt_QList_value( ::pPtr, nI ) + + +METHOD QList:value_1( nI, xDefaultValue ) + RETURN Qt_QList_value_1( ::pPtr, nI, xDefaultValue ) + diff --git a/harbour/contrib/hbqt/qth/QList.qth b/harbour/contrib/hbqt/qth/QList.qth index 90f11c2ff2..bb0345d9e1 100644 --- a/harbour/contrib/hbqt/qth/QList.qth +++ b/harbour/contrib/hbqt/qth/QList.qth @@ -84,9 +84,9 @@ HB_FUNC( QT_QLIST ) void append ( const T & value ) void append ( const QList & value ) -// const T & at ( int i ) const -// T & back () -// const T & back () const +const T & at ( int i ) const +T & back () +const T & back () const //iterator begin () //const_iterator begin () const void clear () @@ -101,19 +101,19 @@ bool empty () const bool endsWith ( const T & value ) const //iterator erase ( iterator pos ) //iterator erase ( iterator begin, iterator end ) -// T & first () -// const T & first () const -// T & front () -// const T & front () const +T & first () +const T & first () const +T & front () +const T & front () const int indexOf ( const T & value, int from = 0 ) const void insert ( int i, const T & value ) //iterator insert ( iterator before, const T & value ) bool isEmpty () const -// T & last () -// const T & last () const +T & last () +const T & last () const int lastIndexOf ( const T & value, int from = -1 ) const int length () const -// QList mid ( int pos, int length = -1 ) const +QList mid ( int pos, int length = -1 ) const void move ( int from, int to ) void pop_back () void pop_front () @@ -129,14 +129,14 @@ void replace ( int i, const T & value ) int size () const bool startsWith ( const T & value ) const void swap ( int i, int j ) -// T takeAt ( int i ) -// T takeFirst () -// T takeLast () +T takeAt ( int i ) +T takeFirst () +T takeLast () QSet toSet () const //std::list toStdList () const QVector toVector () const -// T value ( int i ) const -// T value ( int i, const T & defaultValue ) const +T value ( int i ) const +T value ( int i, const T & defaultValue ) const diff --git a/harbour/contrib/hbqt/qth/QUrl.qth b/harbour/contrib/hbqt/qth/QUrl.qth index ea85dd5ba6..cc979ca6fb 100644 --- a/harbour/contrib/hbqt/qth/QUrl.qth +++ b/harbour/contrib/hbqt/qth/QUrl.qth @@ -74,7 +74,18 @@ New = pParent */ HB_FUNC( QT_QURL ) { - hb_retptr( new QUrl( hbqt_par_QString( 1 ) ) ); + if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + hb_retptr( new QUrl( hbqt_par_QString( 1 ) ) ); + } + else if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + hb_retptr( new QUrl( *hbqt_par_QUrl( 1 ) ) ); + } + else + { + hb_retptr( new QUrl() ); + } } /* * void setQueryDelimiters ( char valueDelimiter, char pairDelimiter )