[Runtime] Fixes #733

[Runtime] Fixes #733

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.Diagnostics

#translate IsValidArea (<nArea>) => (<nArea> > 0 .and. <nArea> <= MaxWorkareas)

/// Class that contains the list of open Workareas. Each thread will have its own list.
ABSTRACT CLASS XSharp.RDD.Workareas
    // Not static because every thread can have its own Workareas structure
    #region Constants
    [DebuggerBrowsable(DebuggerBrowsableState.Never)];
    PUBLIC CONST MaxWorkareas := 4096 AS DWORD
    #endregion
    // This is a table across threads that has all the RDDs and Workareas
    STATIC PROTECTED _AllRDDs   AS Dictionary<IRdd, Workareas>

    STATIC CONSTRUCTOR()
        _AllRDDs  := Dictionary<IRdd, Workareas>{}
    RETURN
    /// <exclude />

    STATIC METHOD _Add(oRDD AS IRdd, oWA AS Workareas) AS VOID
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                // this can happen when a RDD was created in a backgroundthread
                // and is moved to the main thread for example
                _AllRDDs[oRDD] := oWA
            ELSE
                _AllRDDs.Add(oRDD, oWA)
            ENDIF
        END LOCK
        RETURN

    STATIC METHOD _Remove(oRDD AS IRdd) AS LOGIC
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                _AllRDDs:Remove(oRDD)
                RETURN TRUE
            ENDIF
        END LOCK
        RETURN FALSE

    STATIC METHOD _FindRDD (oRDD AS IRdd, oWa OUT Workareas) AS LOGIC
        oWa  := NULL
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                oWa  := _AllRDDs[oRDD]
                RETURN TRUE
            ENDIF
        END LOCK
        RETURN FALSE

    STATIC METHOD _CloseArea(oRDD AS IRdd) AS LOGIC
        LOCAL oWa  AS Workareas
        IF Workareas._FindRDD(oRDD, OUT oWa)
            RETURN oWa:CloseArea(oRDD:Area)
        ENDIF
        RETURN FALSE

        #region Fields
        PRIVATE Aliases            AS Dictionary<STRING, DWORD>	// 1 based area numbers !
        PRIVATE RDDs	           AS Dictionary<DWORD, IRdd>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)];
        PRIVATE iCurrentWorkarea    AS DWORD
        PRIVATE WorkareaStack       AS Stack<DWORD>
        // xbase++ has a cargo slot per Workarea
        [DebuggerBrowsable(DebuggerBrowsableState.Never)];
        PRIVATE cargo    := Dictionary<DWORD, OBJECT>{} AS Dictionary<DWORD, OBJECT>      // 1 based area number and value

        INTERNAL METHOD PushCurrentWorkarea(dwNew AS DWORD) AS VOID
            WorkareaStack:Push(iCurrentWorkarea)
            iCurrentWorkarea := dwNew

        INTERNAL METHOD PopCurrentWorkarea() AS DWORD
            IF WorkareaStack:Count > 0
                iCurrentWorkarea := WorkareaStack:Pop()
                RETURN iCurrentWorkarea
            ENDIF
            RETURN 0

    #endregion
    /// <exclude />
    CONSTRUCTOR()
        Aliases 			:= Dictionary<STRING, DWORD>{ (INT) MaxWorkareas, StringComparer.OrdinalIgnoreCase}
        RDDs				:= Dictionary<DWORD, IRdd>{}
        iCurrentWorkarea	:= 1
        WorkareaStack       := Stack<DWORD>{}

    ///Close All RDDs referenced by this Workarea list
    /// <returns>TRUE when all areas were closed succesfully. When one or more areas failed to close then FALSE is returned.</returns>
    PUBLIC METHOD CloseAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        // Please note that this returns TRUE when no areas are open, unlike DbCloseArea()
        // which returns FALSE when the area involved is not open
        BEGIN LOCK RDDs
            RuntimeState.LastRddError := NULL
            FOREACH VAR element IN Aliases
                VAR nArea := element:Value
                IF RDDs:ContainsKey(nArea) .AND. RDDs[nArea] != NULL
                    VAR oRdd := RDDs[nArea]
                    TRY
                        IF ! oRdd:Close()
                            lResult := FALSE
                        ENDIF
                    CATCH e AS Exception
                        lResult := FALSE
                        RuntimeState.LastRddError  := e
                    END TRY
                ENDIF
            NEXT
            RDDs:Clear()
            Aliases:Clear()
            cargo:Clear()
            iCurrentWorkarea := 1
        END LOCK
        RETURN lResult

    ///Commit changes in all workares in this Workarea list
    /// <returns>TRUE when all areas were committed succesfully. When one or more areas failed to commit then FALSE is returned.</returns>
    PUBLIC METHOD CommitAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        BEGIN LOCK RDDs
            RuntimeState.LastRddError  := NULL
            FOREACH VAR pair IN RDDs
                IF pair:Value != NULL
                    VAR oRdd := pair:Value
                    TRY
                        lResult := lResult .AND. oRdd:Flush()
                    CATCH e AS Exception
                        lResult := FALSE
                        RuntimeState.LastRddError  := e
                    END TRY
                ENDIF
            NEXT
        END LOCK
        RETURN lResult

    ///Close area with 1 based Workarea number
    /// <param name="nArea">1 based Area number for which to find the alias</param>
    /// <returns>TRUE when the area was closed succesfully.</returns>
    PUBLIC METHOD CloseArea( nArea AS DWORD) AS LOGIC
        LOCAL lResult := FALSE AS LOGIC
        IF IsValidArea(nArea)
            BEGIN LOCK RDDs
                //RuntimeState.LastRddError  := NULL
                IF RDDs:ContainsKey(nArea)
                    VAR oRdd := RDDs[ nArea]
                    IF oRdd != NULL_OBJECT
                        TRY
                            lResult := oRdd:Close()
                            Aliases:Remove(oRdd:Alias)
                            Workareas._Remove(oRdd)
                        CATCH e AS Exception
                            lResult			:= FALSE
                            RuntimeState.LastRddError 	:= e
                        END TRY
                    ENDIF
                    RDDs:Remove(nArea)
                ELSE
                    lResult        := FALSE
                ENDIF

                SELF:SetCargo(nArea, NULL)
            END LOCK
        ENDIF
        RETURN lResult

    /// Close the area where this RDD object is used.
    /// <param name="oRDD">Object of te RDD that needs to be closed.</param>
    /// <returns>TRUE when the area was closed.</returns>
    /// <remarks>This will close the area, even when the method is called from another thread.</remarks>
    PUBLIC METHOD CloseArea(oRDD AS IRdd) AS LOGIC
        // This can be called from any thread and will close the RDD
        // in the right Workarea even if that area is from another thread
        RETURN Workareas._CloseArea(oRDD)

    ///  Return 1 based Workarea Number for Alias or 0 when no found
    /// <param name="sAlias">Alias of area to look for. Case INsensitive </param>
    /// <returns>Area number of an the table with the given alias.</returns>
    PUBLIC METHOD FindAlias(sAlias AS STRING) AS DWORD
        BEGIN LOCK RDDs
            IF !String.IsNullOrEmpty(sAlias)
                IF Aliases != NULL .AND. Aliases:ContainsKey(sAlias)
                    RETURN Aliases[sAlias]
                ENDIF
            ENDIF
        END LOCK
        RETURN 0

    /// Return 1 based empty Workarea
    /// <param name="fromStart">Do we start to search from the start (TRUE) or the end (FALSE)</param>
    /// <returns>Area number of an area where no table is open.</returns>
    PUBLIC METHOD FindEmptyArea(fromStart AS LOGIC) AS DWORD
        LOCAL i AS DWORD
        BEGIN LOCK RDDs
            IF fromStart
                FOR i := 1 TO MaxWorkareas
                    IF ! RDDs:ContainsKey(i)
                        RETURN i
                    ENDIF
                NEXT
            ELSE
                FOR i := MaxWorkareas DOWNTO 1
                    IF ! RDDs:ContainsKey(i)
                        RETURN i
                    ENDIF
                NEXT
            ENDIF
        END LOCK
        RETURN 0

    /// Get Alias for 1 based Workarea Number
    /// <param name="nArea">1 based Area number for which to find the alias</param>
    /// <returns>Alias or an empty string when there is no table open in the area</returns>
    PUBLIC METHOD GetAlias( nArea AS DWORD) AS STRING
        IF ISVALIDAREA(nArea)
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea) .AND. RDDs[nArea] != NULL
                    RETURN RDDs[nArea]:Alias
                ENDIF
            END LOCK
        ENDIF
        RETURN String.Empty

    ///Get RDD object for 1 based Workarea Number
    PUBLIC METHOD GetRDD( nArea AS DWORD) AS IRdd
        IF IsValidArea(nArea)
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea)
                    RETURN RDDs[ nArea]
                ENDIF
            END LOCK
        ENDIF
        RETURN NULL

    ///Set RDD object and ALias for 1 based Workarea Number
    PUBLIC METHOD SetArea( nArea AS DWORD, oRDD AS IRdd) AS LOGIC
        // sAlias and oRdd may be empty (when clearing the RDD)
        IF IsValidArea(nArea)
            oRDD:Area := nArea
            VAR sAlias := oRDD:Alias
            IF ! String.IsNullOrEmpty(sAlias)
                sAlias := sAlias:ToUpperInvariant()
            ENDIF
            IF Aliases:ContainsKey(sAlias) .AND. Aliases[sAlias] != nArea
                RETURN FALSE
            ENDIF
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea) .AND. RDDs [nArea] != NULL
                    Workareas._Remove(RDDs [nArea])
                ENDIF
                RDDs[ nArea] 	:= oRDD
                IF ! Aliases:ContainsKey(sAlias)
                    Aliases:Add(sAlias, nArea)
                ENDIF
                SELF:SetCargo(nArea, NULL)
                Workareas._Add(oRDD, SELF)
            END LOCK
            RETURN TRUE
        ENDIF
        RETURN FALSE

    ///Unlock All RDDs referenced by this Workarea list
    PUBLIC METHOD UnLockAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        BEGIN LOCK RDDs
            RuntimeState.LastRddError := NULL
            FOREACH VAR pair IN RDDs
                IF pair:Value  != NULL
                    TRY
                            VAR oRdd := pair:Value
                        lResult := lResult .AND. oRdd:UnLock(0)
                    CATCH e AS Exception
                        RuntimeState.LastRddError := e
                    END TRY
                ENDIF
            NEXT
        END LOCK
        RETURN lResult

    ///Get 1 based Current Workarea Number
    PUBLIC PROPERTY CurrentWorkareaNO AS DWORD GET iCurrentWorkarea SET iCurrentWorkarea := VALUE

    ///Get Current Workarea Object
    PUBLIC PROPERTY CurrentWorkarea AS IRdd
        GET
            LOCAL  nArea AS DWORD
            nArea := iCurrentWorkarea
            IF IsValidArea(nArea)
                BEGIN LOCK RDDs
                    IF RDDs:ContainsKey(nArea)
                        RETURN RDDs[ nArea]
                    ENDIF
                END LOCK
            ENDIF
            RETURN NULL
        END GET
    END PROPERTY

    PUBLIC METHOD GetCargo(nArea AS DWORD) AS OBJECT
        IF IsValidArea(nArea)
            IF SELF:cargo:ContainsKey(nArea)
                RETURN SELF:cargo[nArea]
            ENDIF
        ENDIF
        RETURN NULL

    PUBLIC METHOD SetCargo(nArea AS DWORD, newCargo AS OBJECT) AS VOID
        IF IsValidArea(nArea)
            IF newCargo == NULL
                    IF SELF:cargo:ContainsKey(nArea)
                        SELF:cargo:Remove(nArea)
                ENDIF
            ELSE
                SELF:cargo[nArea] := newCargo
            ENDIF
        ENDIF
        RETURN

END CLASS

//
// Copyright (c) XSharp B.V.  All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.Diagnostics

#translate IsValidArea (<nArea>) => (<nArea> > 0 .and. <nArea> <= MaxWorkareas)

/// Class that contains the list of open Workareas. Each thread will have its own list.
ABSTRACT CLASS XSharp.RDD.Workareas
    // Not static because every thread can have its own Workareas structure
    #region Constants
    [DebuggerBrowsable(DebuggerBrowsableState.Never)];
    PUBLIC CONST MaxWorkareas := 4096 AS DWORD
    #endregion
    // This is a table across threads that has all the RDDs and Workareas
    STATIC PROTECTED _AllRDDs   AS Dictionary<IRdd, Workareas>

    STATIC CONSTRUCTOR()
        _AllRDDs  := Dictionary<IRdd, Workareas>{}
    RETURN
    /// <exclude />

    STATIC METHOD _Add(oRDD AS IRdd, oWA AS Workareas) AS VOID
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                // this can happen when a RDD was created in a backgroundthread
                // and is moved to the main thread for example
                _AllRDDs[oRDD] := oWA
            ELSE
                _AllRDDs.Add(oRDD, oWA)
            ENDIF
        END LOCK
        RETURN

    STATIC METHOD _Remove(oRDD AS IRdd) AS LOGIC
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                _AllRDDs:Remove(oRDD)
                RETURN TRUE
            ENDIF
        END LOCK
        RETURN FALSE

    STATIC METHOD _FindRDD (oRDD AS IRdd, oWa OUT Workareas) AS LOGIC
        oWa  := NULL
        BEGIN LOCK _AllRDDs
            IF _AllRDDs:ContainsKey(oRDD)
                oWa  := _AllRDDs[oRDD]
                RETURN TRUE
            ENDIF
        END LOCK
        RETURN FALSE

    STATIC METHOD _CloseArea(oRDD AS IRdd) AS LOGIC
        LOCAL oWa  AS Workareas
        IF Workareas._FindRDD(oRDD, OUT oWa)
            RETURN oWa:CloseArea(oRDD:Area)
        ENDIF
        RETURN FALSE

        #region Fields
        PRIVATE Aliases            AS Dictionary<STRING, DWORD>	// 1 based area numbers !
        PRIVATE RDDs	           AS Dictionary<DWORD, IRdd>
        [DebuggerBrowsable(DebuggerBrowsableState.Never)];
        PRIVATE iCurrentWorkarea    AS DWORD
        PRIVATE WorkareaStack       AS Stack<DWORD>
        // xbase++ has a cargo slot per Workarea
        [DebuggerBrowsable(DebuggerBrowsableState.Never)];
        PRIVATE cargo    := Dictionary<DWORD, OBJECT>{} AS Dictionary<DWORD, OBJECT>      // 1 based area number and value

        INTERNAL METHOD PushCurrentWorkarea(dwNew AS DWORD) AS VOID
            WorkareaStack:Push(iCurrentWorkarea)
            iCurrentWorkarea := dwNew

        INTERNAL METHOD PopCurrentWorkarea() AS DWORD
            IF WorkareaStack:Count > 0
                iCurrentWorkarea := WorkareaStack:Pop()
                RETURN iCurrentWorkarea
            ENDIF
            RETURN 0

    #endregion
    /// <exclude />
    CONSTRUCTOR()
        Aliases 			:= Dictionary<STRING, DWORD>{ (INT) MaxWorkareas, StringComparer.OrdinalIgnoreCase}
        RDDs				:= Dictionary<DWORD, IRdd>{}
        iCurrentWorkarea	:= 1
        WorkareaStack       := Stack<DWORD>{}

    ///Close All RDDs referenced by this Workarea list
    /// <returns>TRUE when all areas were closed succesfully. When one or more areas failed to close then FALSE is returned.</returns>
    PUBLIC METHOD CloseAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        // Please note that this returns TRUE when no areas are open, unlike DbCloseArea()
        // which returns FALSE when the area involved is not open
        BEGIN LOCK RDDs
            RuntimeState.LastRddError := NULL
            FOREACH VAR element IN Aliases
                VAR nArea := element:Value
                IF RDDs:ContainsKey(nArea) .AND. RDDs[nArea] != NULL
                    VAR oRdd := RDDs[nArea]
                    TRY
                        IF ! oRdd:Close()
                            lResult := FALSE
                        ENDIF
                    CATCH e AS Exception
                        lResult := FALSE
                        RuntimeState.LastRddError  := e
                    END TRY
                ENDIF
            NEXT
            RDDs:Clear()
            Aliases:Clear()
            cargo:Clear()
            iCurrentWorkarea := 1
        END LOCK
        RETURN lResult

    ///Commit changes in all workares in this Workarea list
    /// <returns>TRUE when all areas were committed succesfully. When one or more areas failed to commit then FALSE is returned.</returns>
    PUBLIC METHOD CommitAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        BEGIN LOCK RDDs
            RuntimeState.LastRddError  := NULL
            FOREACH VAR pair IN RDDs
                IF pair:Value != NULL
                    VAR oRdd := pair:Value
                    TRY
                        lResult := lResult .AND. oRdd:Flush()
                    CATCH e AS Exception
                        lResult := FALSE
                        RuntimeState.LastRddError  := e
                    END TRY
                ENDIF
            NEXT
        END LOCK
        RETURN lResult

    ///Close area with 1 based Workarea number
    /// <param name="nArea">1 based Area number for which to find the alias</param>
    /// <returns>TRUE when the area was closed succesfully.</returns>
    PUBLIC METHOD CloseArea( nArea AS DWORD) AS LOGIC
        LOCAL lResult := FALSE AS LOGIC
        IF IsValidArea(nArea)
            BEGIN LOCK RDDs
                //RuntimeState.LastRddError  := NULL
                IF RDDs:ContainsKey(nArea)
                    VAR oRdd := RDDs[ nArea]
                    IF oRdd != NULL_OBJECT
                        TRY
                            lResult := oRdd:Close()
                            Aliases:Remove(oRdd:Alias)
                            Workareas._Remove(oRdd)
                        CATCH e AS Exception
                            lResult			:= FALSE
                            RuntimeState.LastRddError 	:= e
                        END TRY
                    ENDIF
                    RDDs:Remove(nArea)
                ELSE
                    lResult        := FALSE
                ENDIF

                SELF:SetCargo(nArea, NULL)
            END LOCK
        ENDIF
        RETURN lResult

    /// Close the area where this RDD object is used.
    /// <param name="oRDD">Object of te RDD that needs to be closed.</param>
    /// <returns>TRUE when the area was closed.</returns>
    /// <remarks>This will close the area, even when the method is called from another thread.</remarks>
    PUBLIC METHOD CloseArea(oRDD AS IRdd) AS LOGIC
        // This can be called from any thread and will close the RDD
        // in the right Workarea even if that area is from another thread
        RETURN Workareas._CloseArea(oRDD)

    ///  Return 1 based Workarea Number for Alias or 0 when no found
    /// <param name="sAlias">Alias of area to look for. Case INsensitive </param>
    /// <returns>Area number of an the table with the given alias.</returns>
    PUBLIC METHOD FindAlias(sAlias AS STRING) AS DWORD
        BEGIN LOCK RDDs
            IF !String.IsNullOrEmpty(sAlias)
                IF Aliases != NULL .AND. Aliases:ContainsKey(sAlias)
                    RETURN Aliases[sAlias]
                ENDIF
            ENDIF
        END LOCK
        RETURN 0

    /// Return 1 based empty Workarea
    /// <param name="fromStart">Do we start to search from the start (TRUE) or the end (FALSE)</param>
    /// <returns>Area number of an area where no table is open.</returns>
    PUBLIC METHOD FindEmptyArea(fromStart AS LOGIC) AS DWORD
        LOCAL i AS DWORD
        BEGIN LOCK RDDs
            IF fromStart
                FOR i := 1 TO MaxWorkareas
                    IF ! RDDs:ContainsKey(i)
                        RETURN i
                    ENDIF
                NEXT
            ELSE
                FOR i := MaxWorkareas DOWNTO 1
                    IF ! RDDs:ContainsKey(i)
                        RETURN i
                    ENDIF
                NEXT
            ENDIF
        END LOCK
        RETURN 0

    /// Get Alias for 1 based Workarea Number
    /// <param name="nArea">1 based Area number for which to find the alias</param>
    /// <returns>Alias or an empty string when there is no table open in the area</returns>
    PUBLIC METHOD GetAlias( nArea AS DWORD) AS STRING
        IF ISVALIDAREA(nArea)
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea) .AND. RDDs[nArea] != NULL
                    RETURN RDDs[nArea]:Alias
                ENDIF
            END LOCK
        ENDIF
        RETURN NULL

    ///Get RDD object for 1 based Workarea Number
    PUBLIC METHOD GetRDD( nArea AS DWORD) AS IRdd
        IF IsValidArea(nArea)
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea)
                    RETURN RDDs[ nArea]
                ENDIF
            END LOCK
        ENDIF
        RETURN NULL

    ///Set RDD object and ALias for 1 based Workarea Number
    PUBLIC METHOD SetArea( nArea AS DWORD, oRDD AS IRdd) AS LOGIC
        // sAlias and oRdd may be empty (when clearing the RDD)
        IF IsValidArea(nArea)
            oRDD:Area := nArea
            VAR sAlias := oRDD:Alias
            IF ! String.IsNullOrEmpty(sAlias)
                sAlias := sAlias:ToUpperInvariant()
            ENDIF
            IF Aliases:ContainsKey(sAlias) .AND. Aliases[sAlias] != nArea
                RETURN FALSE
            ENDIF
            BEGIN LOCK RDDs
                IF RDDs:ContainsKey(nArea) .AND. RDDs [nArea] != NULL
                    Workareas._Remove(RDDs [nArea])
                ENDIF
                RDDs[ nArea] 	:= oRDD
                IF ! Aliases:ContainsKey(sAlias)
                    Aliases:Add(sAlias, nArea)
                ENDIF
                SELF:SetCargo(nArea, NULL)
                Workareas._Add(oRDD, SELF)
            END LOCK
            RETURN TRUE
        ENDIF
        RETURN FALSE

    ///Unlock All RDDs referenced by this Workarea list
    PUBLIC METHOD UnLockAll() AS LOGIC
        LOCAL lResult := TRUE AS LOGIC
        BEGIN LOCK RDDs
            RuntimeState.LastRddError := NULL
            FOREACH VAR pair IN RDDs
                IF pair:Value  != NULL
                    TRY
                            VAR oRdd := pair:Value
                        lResult := lResult .AND. oRdd:UnLock(0)
                    CATCH e AS Exception
                        RuntimeState.LastRddError := e
                    END TRY
                ENDIF
            NEXT
        END LOCK
        RETURN lResult

    ///Get 1 based Current Workarea Number
    PUBLIC PROPERTY CurrentWorkareaNO AS DWORD GET iCurrentWorkarea SET iCurrentWorkarea := VALUE

    ///Get Current Workarea Object
    PUBLIC PROPERTY CurrentWorkarea AS IRdd
        GET
            LOCAL  nArea AS DWORD
            nArea := iCurrentWorkarea
            IF IsValidArea(nArea)
                BEGIN LOCK RDDs
                    IF RDDs:ContainsKey(nArea)
                        RETURN RDDs[ nArea]
                    ENDIF
                END LOCK
            ENDIF
            RETURN NULL
        END GET
    END PROPERTY

    PUBLIC METHOD GetCargo(nArea AS DWORD) AS OBJECT
        IF IsValidArea(nArea)
            IF SELF:cargo:ContainsKey(nArea)
                RETURN SELF:cargo[nArea]
            ENDIF
        ENDIF
        RETURN NULL

    PUBLIC METHOD SetCargo(nArea AS DWORD, newCargo AS OBJECT) AS VOID
        IF IsValidArea(nArea)
            IF newCargo == NULL
                    IF SELF:cargo:ContainsKey(nArea)
                        SELF:cargo:Remove(nArea)
                ENDIF
            ELSE
                SELF:cargo[nArea] := newCargo
            ENDIF
        ENDIF
        RETURN

END CLASS


removed some cruft

removed some cruft

-- Copyright (c) 2006 Portland State University.
-- This is an example program for the Omega programming language;
-- for more information, see:
--   http://www.cs.pdx.edu/~sheard/Omega/index.html
-- Research and development on Omega is supported by a grant
-- from the National Science Foundation.

-- Ordering property.
prop LE :: Nat ~> Nat ~> *0 where
  Base_LE:: LE Z a
  Step_LE:: LE a b -> LE (S a) (S b)

-- Equality property.
prop EQNat:: Nat ~> Nat ~> *0 where
  Base_EQ :: EQNat Z Z
  Step_EQ :: EQNat x y -> EQNat(S x) (S y)

-- Inequality property.
prop NE :: Nat ~> Nat ~> *0 where
  Left_NE :: NE (S x) Z
  Right_NE :: NE Z (S x)
  Step_NE :: NE x y -> NE (S x) (S y)

-- Transitivity of ordering.
trans_LE :: LE a b -> LE b c -> LE a c
trans_LE Base_LE Base_LE = Base_LE
trans_LE Base_LE (Step_LE z) = Base_LE
trans_LE (Step_LE x) (Step_LE y) = Step_LE(trans_LE x y)

-- Transitivity of equality.
trans_EQ :: EQNat a b -> EQNat b c -> EQNat a c
trans_EQ Base_EQ Base_EQ = Base_EQ
trans_EQ (Step_EQ x) (Step_EQ y) = Step_EQ (trans_EQ x y)

-- Commutativity of equality.
comm_EQ :: EQNat a b -> EQNat b a
comm_EQ Base_EQ = Base_EQ
comm_EQ (Step_EQ x) = Step_EQ (comm_EQ x)

magnitude :: Nat' x -> LE Z x
magnitude n = Base_LE

-- If a=b then a<=b.
eqToLe :: EQNat a b -> LE a b
eqToLe Base_EQ = Base_LE
eqToLe (Step_EQ x) = Step_LE (eqToLe x)

-- If a<=b and b<=a, then a=b.
leToEq :: LE a b -> LE b a -> EQNat a b
leToEq Base_LE Base_LE = Base_EQ
-- leEq2 Base_LE (Step_LE z) = unreachable
-- leEq2 (Step_LE z) Base_LE = unreachable
leToEq (Step_LE x) (Step_LE y) = Step_EQ (leToEq x y)

{-
-- Tests for ordering between two naturals..
compareN :: Nat' a -> Nat' b -> (LE a b + LE b a)
compareN Z _ = L Base_LE
compareN (S x) Z = R Base_LE
compareN (S x) (S y) = mapP Step_LE Step_LE (compareN x y)
-}

-- Tests for equality or inequality between two naturals.
eqOrNe :: Nat' x -> Nat' y -> (EQNat x y + NE x y)
eqOrNe Z Z = L Base_EQ
eqOrNe Z (S x) = R (Right_NE)
eqOrNe (S x) Z = R (Left_NE)
eqOrNe (S x) (S y) = case (eqOrNe x y) of
  (L eq) -> L (Step_EQ eq)
  (R eq) -> R (Step_NE eq)

-- Type functions on Nat.

plus :: Nat ~> Nat ~> Nat
{plus Z y} = y
{plus (S x) y} = S {plus x y}

--comm_plus :: Nat' {plus x y} -> Nat' {plus y x}
--comm_plus Z = Z
--comm_plus (S x) = S (comm_plus x)

times :: (Nat ~> Nat ~> Nat)
{times (S x) y} = {plus y {times x y}}
{times Z y} = Z
--Again, the original example included the following line, but the current
--inductiveness checker chokes on it -- this time with better reason.
--{times x #2} = {plus x x}

data LT:: Nat ~> Nat ~> *0  where
  BLT:: LT Z (S a)
  SLT:: LT a b -> LT (S a) (S b)

data LT' :: Nat ~> Nat ~> *0  where
  BLT':: LT' a (S a)
  SLT':: LT' a b -> LT' a (S b)

h:: Nat' m -> LT' Z (S m)
h Z = BLT'
h (S m) = SLT'(h m)

k:: Nat' b -> LT' a b -> LT' (S a) (S b)
k Z BLT' = unreachable
k Z (SLT' p) = unreachable
k (S m) BLT' = BLT'
k (S m) (SLT' p) = SLT'(k m p)

m:: Nat' b -> LT a b -> LT a (S b)
m Z BLT = unreachable
m Z (SLT p) = unreachable
m (S n) BLT = BLT
m (S n) (SLT p) = SLT(m n p)

f:: Nat' (S m) -> LT n (S m) -> LT' n (S m)
f Z     BLT = unreachable
f Z (SLT p) = unreachable
f (S Z) BLT = h Z
f (S (S n)) (SLT p) = k (S n) (f (S n) p)

g:: Nat' (S m) -> LT' n (S m) -> LT n (S m)
g Z BLT' = unreachable
g Z (SLT' p) = unreachable
g (S Z) BLT' = BLT
g (S (S n)) (SLT' p) = m (S n) (g (S n) p)

-- Copyright (c) 2006 Portland State University.
-- This is an example program for the Omega programming language;
-- for more information, see:
--   http://www.cs.pdx.edu/~sheard/Omega/index.html
-- Research and development on Omega is supported by a grant
-- from the National Science Foundation.

-- import "Library.prg" (mapP)

{-
kind Nat = Z | S Nat

data Nat' x
  = Z where x=Z
  | exist m . S (Nat' m) where x=S m
-}

-- Ordering property.
prop LE :: Nat ~> Nat ~> *0 where
  Base_LE:: LE Z a
  Step_LE:: LE a b -> LE (S a) (S b)

-- Equality property.
prop EQNat:: Nat ~> Nat ~> *0 where
  Base_EQ :: EQNat Z Z
  Step_EQ :: EQNat x y -> EQNat(S x) (S y)

-- Inequality property.
prop NE :: Nat ~> Nat ~> *0 where
  Left_NE :: NE (S x) Z
  Right_NE :: NE Z (S x)
  Step_NE :: NE x y -> NE (S x) (S y)

-- Transitivity of ordering.
trans_LE :: LE a b -> LE b c -> LE a c
trans_LE Base_LE Base_LE = Base_LE
trans_LE Base_LE (Step_LE z) = Base_LE
trans_LE (Step_LE x) (Step_LE y) = Step_LE(trans_LE x y)

-- Transitivity of equality.
trans_EQ :: EQNat a b -> EQNat b c -> EQNat a c
trans_EQ Base_EQ Base_EQ = Base_EQ
trans_EQ (Step_EQ x) (Step_EQ y) = Step_EQ (trans_EQ x y)

-- Commutativity of equality.
comm_EQ :: EQNat a b -> EQNat b a
comm_EQ Base_EQ = Base_EQ
comm_EQ (Step_EQ x) = Step_EQ (comm_EQ x)

magnitude :: Nat' x -> LE Z x
magnitude n = Base_LE

-- If a=b then a<=b.
eqToLe :: EQNat a b -> LE a b
eqToLe Base_EQ = Base_LE
eqToLe (Step_EQ x) = Step_LE (eqToLe x)

-- If a<=b and b<=a, then a=b.
leToEq :: LE a b -> LE b a -> EQNat a b
leToEq Base_LE Base_LE = Base_EQ
-- leEq2 Base_LE (Step_LE z) = unreachable
-- leEq2 (Step_LE z) Base_LE = unreachable
leToEq (Step_LE x) (Step_LE y) = Step_EQ (leToEq x y)

{-
-- Tests for ordering between two naturals..
compareN :: Nat' a -> Nat' b -> (LE a b + LE b a)
compareN Z _ = L Base_LE
compareN (S x) Z = R Base_LE
compareN (S x) (S y) = mapP Step_LE Step_LE (compareN x y)
-}

-- Tests for equality or inequality between two naturals.
eqOrNe :: Nat' x -> Nat' y -> (EQNat x y + NE x y)
eqOrNe Z Z = L Base_EQ
eqOrNe Z (S x) = R (Right_NE)
eqOrNe (S x) Z = R (Left_NE)
eqOrNe (S x) (S y) = case (eqOrNe x y) of
  (L eq) -> L (Step_EQ eq)
  (R eq) -> R (Step_NE eq)

-- Type functions on Nat.

plus :: Nat ~> Nat ~> Nat
{plus Z y} = y
{plus (S x) y} = S {plus x y}

--comm_plus :: Nat' {plus x y} -> Nat' {plus y x}
--comm_plus Z = Z
--comm_plus (S x) = S (comm_plus x)

times :: (Nat ~> Nat ~> Nat)
{times (S x) y} = {plus y {times x y}}
{times Z y} = Z
--Again, the original example included the following line, but the current
--inductiveness checker chokes on it -- this time with better reason.
--{times x #2} = {plus x x}

data LT:: Nat ~> Nat ~> *0  where
  BLT:: LT Z (S a)
  SLT:: LT a b -> LT (S a) (S b)

data LT' :: Nat ~> Nat ~> *0  where
  BLT':: LT' a (S a)
  SLT':: LT' a b -> LT' a (S b)

h:: Nat' m -> LT' Z (S m)
h Z = BLT'
h (S m) = SLT'(h m)

k:: Nat' b -> LT' a b -> LT' (S a) (S b)
k Z BLT' = unreachable
k Z (SLT' p) = unreachable
k (S m) BLT' = BLT'
k (S m) (SLT' p) = SLT'(k m p)

m:: Nat' b -> LT a b -> LT a (S b)
m Z BLT = unreachable
m Z (SLT p) = unreachable
m (S n) BLT = BLT
m (S n) (SLT p) = SLT(m n p)

f:: Nat' (S m) -> LT n (S m) -> LT' n (S m)
f Z     BLT = unreachable
f Z (SLT p) = unreachable
f (S Z) BLT = h Z
f (S (S n)) (SLT p) = k (S n) (f (S n) p)

g:: Nat' (S m) -> LT' n (S m) -> LT n (S m)
g Z BLT' = unreachable
g Z (SLT' p) = unreachable
g (S Z) BLT' = BLT
g (S (S n)) (SLT' p) = m (S n) (g (S n) p)


source/QtTest: updated

source/QtTest: updated

Modified:
source/QtTest/QTestEventList.prg

/*

  Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4

  Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

/*
  DO NOT EDIT THIS FILE - the content was created using a source code generator
*/

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
#endif

CLASS QTestEventList

   DATA pointer
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD addDelay
   METHOD addKeyClick1
   METHOD addKeyClick2
   METHOD addKeyClick
   METHOD addKeyClicks
   METHOD addKeyPress1
   METHOD addKeyPress2
   METHOD addKeyPress
   METHOD addKeyRelease1
   METHOD addKeyRelease2
   METHOD addKeyRelease
   METHOD addMouseClick
   METHOD addMouseDClick
   METHOD addMouseMove
   METHOD addMousePress
   METHOD addMouseRelease
   METHOD clear
   METHOD simulate

   METHOD newFrom
   METHOD newFromObject
   METHOD newFromPointer
   METHOD selfDestruction
   METHOD setSelfDestruction

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject() CLASS QTestEventList
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <QtTest/QTestEventList>

#include "qt4xhb_common.h"
#include "qt4xhb_macros.h"
#include "qt4xhb_utils.h"

/*
QTestEventList()
*/
void QTestEventList_new1()
{
  QTestEventList * obj = new QTestEventList();
  Qt4xHb::returnNewObject( obj, true );
}

/*
QTestEventList( const QTestEventList & other )
*/
void QTestEventList_new2()
{
  QTestEventList * obj = new QTestEventList( *PQTESTEVENTLIST(1) );
  Qt4xHb::returnNewObject( obj, true );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEW )
{
  if( ISNUMPAR(0) )
  {
    QTestEventList_new1();
  }
  else if( ISNUMPAR(1) && ISQTESTEVENTLIST(1) )
  {
    QTestEventList_new2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

HB_FUNC_STATIC( QTESTEVENTLIST_DELETE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addDelay( int msecs )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDDELAY )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) && ISNUM(1) )
    {
#endif
      obj->addDelay( PINT(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClick( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClick( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYCLICK1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYCLICK2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addKeyClicks( const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICKS )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISCHAR(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClicks( PQSTRING(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyPress( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyPress( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYPRESS1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYPRESS2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addKeyRelease( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyRelease( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyRelease( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyRelease( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYRELEASE1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYRELEASE2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addMouseClick( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSECLICK )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseClick( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseDClick( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEDCLICK )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseDClick( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseMove( QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEMOVE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(0,2) && (ISQPOINT(1)||ISNIL(1)) && ISOPTNUM(2) )
    {
#endif
      obj->addMouseMove( ISNIL(1)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(1), OPINT(2,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMousePress( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEPRESS )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMousePress( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseRelease( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSERELEASE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseRelease( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void clear()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_CLEAR )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(0) )
    {
#endif
      obj->clear();
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void simulate( QWidget * w )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_SIMULATE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) && ISQWIDGET(1) )
    {
#endif
      obj->simulate( PQWIDGET(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROM )
{
  PHB_ITEM self = hb_stackSelfItem();

  if( hb_pcount() == 1 && ISOBJECT(1) )
  {
    PHB_ITEM ptr = hb_itemPutPtr( NULL, (void *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) ) );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
    PHB_ITEM des = hb_itemPutL( NULL, false );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else if( hb_pcount() == 1 && ISPOINTER(1) )
  {
    PHB_ITEM ptr = hb_itemPutPtr( NULL, (void *) hb_itemGetPtr( hb_param(1, HB_IT_POINTER ) ) );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
    PHB_ITEM des = hb_itemPutL( NULL, false );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }

  hb_itemReturn( self );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROMOBJECT )
{
  HB_FUNC_EXEC( QTESTEVENTLIST_NEWFROM );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROMPOINTER )
{
  HB_FUNC_EXEC( QTESTEVENTLIST_NEWFROM );
}

HB_FUNC_STATIC( QTESTEVENTLIST_SELFDESTRUCTION )
{
  hb_retl( (bool) hb_itemGetL( hb_objSendMsg( hb_stackSelfItem(), "SELF_DESTRUCTION", 0 ) ) );
}

HB_FUNC_STATIC( QTESTEVENTLIST_SETSELFDESTRUCTION )
{
  PHB_ITEM self = hb_stackSelfItem();

  if( hb_pcount() == 1 && ISLOG(1) )
  {
    PHB_ITEM des = hb_itemPutL( NULL, hb_parl(1) );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }

  hb_itemReturn( self );
}

#pragma ENDDUMP

/*

  Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4

  Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>

*/

/*
  DO NOT EDIT THIS FILE - the content was created using a source code generator
*/

#include "hbclass.ch"

#ifndef QT4XHB_NO_REQUESTS
#endif

CLASS QTestEventList

   DATA pointer
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD addDelay
   METHOD addKeyClick1
   METHOD addKeyClick2
   METHOD addKeyClick
   METHOD addKeyClicks
   METHOD addKeyPress1
   METHOD addKeyPress2
   METHOD addKeyPress
   METHOD addKeyRelease1
   METHOD addKeyRelease2
   METHOD addKeyRelease
   METHOD addMouseClick
   METHOD addMouseDClick
   METHOD addMouseMove
   METHOD addMousePress
   METHOD addMouseRelease
   METHOD clear
   METHOD simulate

   METHOD newFrom
   METHOD newFromObject
   METHOD newFromPointer
   METHOD selfDestruction
   METHOD setSelfDestruction

   DESTRUCTOR destroyObject

END CLASS

PROCEDURE destroyObject() CLASS QTestEventList
   IF ::self_destruction
      ::delete()
   ENDIF
RETURN

#pragma BEGINDUMP

#include <QtTest/QTestEventList>

#include "qt4xhb_common.h"
#include "qt4xhb_macros.h"
#include "qt4xhb_utils.h"

/*
QTestEventList ()
*/
void QTestEventList_new1()
{
  QTestEventList * obj = new QTestEventList();
  Qt4xHb::returnNewObject( obj, true );
}

/*
QTestEventList ( const QTestEventList & other )
*/
void QTestEventList_new2()
{
  QTestEventList * obj = new QTestEventList( *PQTESTEVENTLIST(1) );
  Qt4xHb::returnNewObject( obj, true );
}

/*
[1]QTestEventList ()
[2]QTestEventList ( const QTestEventList & other )
*/

HB_FUNC_STATIC( QTESTEVENTLIST_NEW )
{
  if( ISNUMPAR(0) )
  {
    QTestEventList_new1();
  }
  else if( ISNUMPAR(1) && ISQTESTEVENTLIST(1) )
  {
    QTestEventList_new2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

HB_FUNC_STATIC( QTESTEVENTLIST_DELETE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addDelay( int msecs )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDDELAY )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) && ISNUM(1) )
    {
#endif
      obj->addDelay( PINT(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClick( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClick( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
[1]void addKeyClick ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
[2]void addKeyClick ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYCLICK1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYCLICK2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addKeyClicks( const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICKS )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISCHAR(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyClicks( PQSTRING(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyPress( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyPress( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
[1]void addKeyPress ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
[2]void addKeyPress ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYPRESS1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYPRESS2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addKeyRelease ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE1 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyRelease( (Qt::Key) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyRelease ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE2 )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,3) && ISNUM(1) && ISOPTNUM(2) && ISOPTNUM(3) )
    {
#endif
      obj->addKeyRelease( PCHAR(1), ISNIL(2)? (Qt::KeyboardModifiers) Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), OPINT(3,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
[1]void addKeyRelease ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
[2]void addKeyRelease ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/

HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE )
{
  if( ISBETWEEN(1,3) && ISNUM(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYRELEASE1 );
  }
  else if( ISBETWEEN(1,3) && ISCHAR(1) && (ISNUM(2)||ISNIL(2)) && (ISNUM(3)||ISNIL(3)) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_ADDKEYRELEASE2 );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void addMouseClick( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSECLICK )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseClick( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseDClick( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEDCLICK )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseDClick( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseMove( QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEMOVE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(0,2) && (ISQPOINT(1)||ISNIL(1)) && ISOPTNUM(2) )
    {
#endif
      obj->addMouseMove( ISNIL(1)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(1), OPINT(2,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMousePress( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEPRESS )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMousePress( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseRelease( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSERELEASE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISBETWEEN(1,4) && ISNUM(1) && ISOPTNUM(2) && (ISQPOINT(3)||ISNIL(3)) && ISOPTNUM(4) )
    {
#endif
      obj->addMouseRelease( (Qt::MouseButton) hb_parni(1), ISNIL(2)? (Qt::KeyboardModifiers) 0 : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? QPoint() : *(QPoint *) Qt4xHb::itemGetPtr(3), OPINT(4,-1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void clear()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_CLEAR )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(0) )
    {
#endif
      obj->clear();
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

/*
void simulate( QWidget * w )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_SIMULATE )
{
  QTestEventList * obj = (QTestEventList *) Qt4xHb::itemGetPtrStackSelfItem();

  if( obj )
  {
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    if( ISNUMPAR(1) && ISQWIDGET(1) )
    {
#endif
      obj->simulate( PQWIDGET(1) );
#ifndef QT4XHB_DONT_CHECK_PARAMETERS
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
#endif
  }

  hb_itemReturn( hb_stackSelfItem() );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROM )
{
  PHB_ITEM self = hb_stackSelfItem();

  if( hb_pcount() == 1 && ISOBJECT(1) )
  {
    PHB_ITEM ptr = hb_itemPutPtr( NULL, (void *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) ) );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
    PHB_ITEM des = hb_itemPutL( NULL, false );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else if( hb_pcount() == 1 && ISPOINTER(1) )
  {
    PHB_ITEM ptr = hb_itemPutPtr( NULL, (void *) hb_itemGetPtr( hb_param(1, HB_IT_POINTER ) ) );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
    PHB_ITEM des = hb_itemPutL( NULL, false );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }

  hb_itemReturn( self );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROMOBJECT )
{
  HB_FUNC_EXEC( QTESTEVENTLIST_NEWFROM );
}

HB_FUNC_STATIC( QTESTEVENTLIST_NEWFROMPOINTER )
{
  HB_FUNC_EXEC( QTESTEVENTLIST_NEWFROM );
}

HB_FUNC_STATIC( QTESTEVENTLIST_SELFDESTRUCTION )
{
  hb_retl( (bool) hb_itemGetL( hb_objSendMsg( hb_stackSelfItem(), "SELF_DESTRUCTION", 0 ) ) );
}

HB_FUNC_STATIC( QTESTEVENTLIST_SETSELFDESTRUCTION )
{
  PHB_ITEM self = hb_stackSelfItem();

  if( hb_pcount() == 1 && ISLOG(1) )
  {
    PHB_ITEM des = hb_itemPutL( NULL, hb_parl(1) );
    hb_objSendMsg( self, "_self_destruction", 1, des );
    hb_itemRelease( des );
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }

  hb_itemReturn( self );
}

#pragma ENDDUMP