On Fri, 18 Dec 2009, Pritpal Bedi wrote:
Hi,
> >> Method QPixmap:new(...)
> >> LOCAL aP := hb_aParams()
> >>
> >> aeval( aP, {|x| x := hbqt_ptr( x ) } )
> >> Qt_QPixmap(...) /* How this can be achieved with above syntax */
> >>
> >> RETURN Self
[...]
proc main()
p1( "a", "b", "c", 10, 20, 30, .t. )
return
proc p1( ... )
local v
p2( "Original parameters:", ... )
for each v in { ... }
switch valtype( v )
case "N"; v += 1000 ; exit
case "C"; v = upper( v ) ; exit
case "L"; v := !v ; exit
endswitch
hb_pvalue( v:__enumIndex(), v )
next
p2( "Modified parameters:", ... )
return
proc p2( msg, ... )
? msg, ...
return
> Because if I implement it QT_QPIXMAP() I have to
> touch around 100 .qth headers which is not viable at this point.
> So I am introducing in generator:
>
> METHOD QSomePlainObject:new( ... )
> LOCAL p
> LOCAL aP := hb_aParams()
> LOCAL nParams := len( aP )
>
> IF nParams > 0
> FOR EACH p IN aP
> p := hbqt_ptr( p )
> NEXT
> ENDIF
>
> DO CASE
> CASE nParams == 6
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ], aP[ 2 ], aP[ 3 ], aP[ 4 ], aP[
> 5 ], aP[ 6 ] )
> CASE nParams == 5
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ], aP[ 2 ], aP[ 3 ], aP[ 4 ], aP[
> 5 ] )
> CASE nParams == 4
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ], aP[ 2 ], aP[ 3 ], aP[ 4 ] )
> CASE nParams == 3
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ], aP[ 2 ], aP[ 3 ] )
> CASE nParams == 2
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ], aP[ 2 ] )
> CASE nParams == 1
> ::pPtr := Qt_QSomePlainObject( aP[ 1 ] )
> OTHERWISE
> ::pPtr := Qt_QSomePlainObject()
> ENDCASE
>
> return self
>
> I am aware of its limitation but I could not find a better way.
> Because it is a one-time code, so it carris no overhead.
> If anybody has better solution please forward.
proc main()
p1( "a", "b", "c", 10, 20, 30, .t. )
return
proc p1( ... )
local v
p2( "Original parameters:", ... )
for each v in { ... }
switch valtype( v )
case "N"; v += 1000 ; exit
case "C"; v = upper( v ) ; exit
case "L"; v := !v ; exit
endswitch
hb_pvalue( v:__enumIndex(), v )
next
p2( "Modified parameters:", ... )
return
proc p2( msg, ... )
? msg, ...
return
best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour