2010-10-15 10:01 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/utils/hbqtgen.prg
    + Changed HB_<class> class instantiation function STATIC.
    + Added <class>FromPointer() function to create class from a raw class pointer.
      (this should be eliminated ASAP)
    + Added <class>From() function to create class from another class.
      It's now simply calling :from() in base class, which is wrong
      and should be fixed for two reasons:
         - raw pointer is allowed (all such calls should be changed to <class>FromPointer())
         - no object type checking is made.

    ; NOTE: Please update HBIDE and HBXBP to use these rules:
              HB_<class>:from( ptr ) => <class>FromPointer( ptr )
              HB_<class>:from( obj ) => <class>From( obj )
This commit is contained in:
Viktor Szakats
2010-10-15 08:06:45 +00:00
parent eec302f8b2
commit 6eadf651ac
2 changed files with 22 additions and 1 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-10-15 10:01 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/utils/hbqtgen.prg
+ Changed HB_<class> class instantiation function STATIC.
+ Added <class>FromPointer() function to create class from a raw class pointer.
(this should be eliminated ASAP)
+ Added <class>From() function to create class from another class.
It's now simply calling :from() in base class, which is wrong
and should be fixed for two reasons:
- raw pointer is allowed (all such calls should be changed to <class>FromPointer())
- no object type checking is made.
; NOTE: Please update HBIDE and HBXBP to use these rules:
HB_<class>:from( ptr ) => <class>FromPointer( ptr )
HB_<class>:from( obj ) => <class>From( obj )
2010-10-15 09:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtcore/hbqt_pointer.cpp
* contrib/hbqt/qtcore/hbqtcore.hbx

View File

@@ -1056,10 +1056,16 @@ METHOD HbQtSource:buildClass()
aadd( txt_, "FUNCTION " + ::cWidget + "( ... )" )
aadd( txt_, " RETURN HB_" + ::cWidget + "():new( ... )" )
aadd( txt_, "" )
aadd( txt_, "FUNCTION " + ::cWidget + "From( ... )" )
aadd( txt_, " RETURN HB_" + ::cWidget + "():from( ... )" )
aadd( txt_, "" )
aadd( txt_, "FUNCTION " + ::cWidget + "FromPointer( ... )" )
aadd( txt_, " RETURN HB_" + ::cWidget + "():fromPointer( ... )" )
aadd( txt_, "" )
aadd( txt_, "" )
n := ascan( ::cls_, {|e_| left( lower( e_[ 1 ] ), 7 ) == "inherit" .and. !empty( e_[ 2 ] ) } )
s := "CREATE CLASS " + ::cWidget + " INHERIT HbQtObjectHandler" + iif( n > 0, ", " + strtran( ::cls_[ n, 2 ], "Q", "HB_Q" ), "" ) + " FUNCTION HB_" + ::cWidget
s := "CREATE CLASS " + ::cWidget + " INHERIT HbQtObjectHandler" + iif( n > 0, ", " + strtran( ::cls_[ n, 2 ], "Q", "HB_Q" ), "" ) + " STATIC FUNCTION HB_" + ::cWidget
aadd( txt_, s )
aadd( txt_, " " )