QtPurchasing: data for code generation updated

Modified:
codegen/QtPurchasing/QInAppStore.prg

%%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

CLASS QInAppStore INHERIT QObject

   METHOD new
   METHOD delete

   METHOD restorePurchases
   METHOD registerProduct
   METHOD registeredProduct
   METHOD setPlatformProperty

   METHOD onProductRegistered
   METHOD onProductUnknown
   METHOD onTransactionReady

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

$prototype=explicit QInAppStore(QObject *parent = Q_NULLPTR)
$constructor=|new|QObject *=Q_NULLPTR

$prototype=~QInAppStore()
$deleteMethod

$prototype=Q_INVOKABLE void restorePurchases()
$method=|void|restorePurchases|

$prototype=Q_INVOKABLE void registerProduct(QInAppProduct::ProductType productType, const QString &identifier)
$method=|void|registerProduct|QInAppProduct::ProductType,const QString &

$prototype=Q_INVOKABLE QInAppProduct *registeredProduct(const QString &identifier) const
$method=|QInAppProduct *|registeredProduct|const QString &

$prototype=Q_INVOKABLE void setPlatformProperty(const QString &propertyName, const QString &value)
$method=|void|setPlatformProperty|const QString &,const QString &

$prototype=void registerPendingProducts() (private) (slot)

$prototype=void registerProduct(QInAppProduct *) (private) (slot)

$prototype=void setupBackend() (private)

$beginSignals
$signalMethod=|productRegistered(QInAppProduct*)
$signalMethod=|productUnknown(QInAppProduct::ProductType,QString)
$signalMethod=|transactionReady(QInAppTransaction*)
$endSignals

#pragma ENDDUMP

%%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2018 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$header

#include "hbclass.ch"

CLASS QInAppStore INHERIT QObject

   METHOD new
   METHOD delete

   METHOD restorePurchases
   METHOD registerProduct
   METHOD registeredProduct
   METHOD setPlatformProperty

   METHOD onProductRegistered
   METHOD onProductUnknown
   METHOD onTransactionReady

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

$prototype=explicit QInAppStore(QObject *parent = Q_NULLPTR)
$constructor=|new|QObject *=Q_NULLPTR

$prototype=~QInAppStore()
$deleteMethod

$prototype=Q_INVOKABLE void restorePurchases()
$method=|void|restorePurchases|

$prototype=Q_INVOKABLE void registerProduct(QInAppProduct::ProductType productType, const QString &identifier)
$method=|void|registerProduct|QInAppProduct::ProductType,const QString &

$prototype=Q_INVOKABLE QInAppProduct *registeredProduct(const QString &identifier) const
$method=|QInAppProduct *|registeredProduct|const QString &

$prototype=Q_INVOKABLE void setPlatformProperty(const QString &propertyName, const QString &value)
$method=|void|setPlatformProperty|const QString &,const QString &

$prototype=void registerPendingProducts() (private) (slot)

$prototype=void registerProduct(QInAppProduct *) (private) (slot)

$prototype=void setupBackend() (private)

$connectSignalFunction

$signalMethod=|productRegistered(QInAppProduct*)
$signalMethod=|productUnknown(QInAppProduct::ProductType,QString)
$signalMethod=|transactionReady(QInAppTransaction*)

#pragma ENDDUMP


[Model] BuiltIn functions has definition for IIF() and IF() now

USING System.Text
USING XSharpModel
FUNCTION XSharpBuiltInFunctions(location as string) as STRING
    local sb as StringBuilder
    local asm as System.Reflection.Assembly
    asm := System.Reflection.Assembly.GetAssembly(typeof(XAssembly))
    sb := StringBuilder{1024}
    sb:AppendLine("//")
    sb:AppendLine("// Comments: This file contains the prototypes of the pseudo functions that are built into the compiler")
    sb:AppendLine("// Location: "+location)
    sb:AppendLine("// Version :  "+ asm:GetName():ToString())
    sb:AppendLine("")
    var sLine1 := "/// Inline Conditional Expression"
    var sLine2 := e"/// <param name=\"cond\">The condition. This should evaluate to TRUE or FALSE.</param>"
    var sLine3 := e"/// <param name=\"trueExpr\">The expression to return when the condition evaluates to TRUE.</param>"
    var sLine4 := e"/// <param name=\"falseExpr\">The expression to return when the condition evaluates to FALSE.</param>"
    var sLine5 := "FUNCTION {0}(cond AS LOGIC, trueExpr as USUAL, falseExpr as USUAL) AS USUAL"
    sb:AppendLine(sLine1)
    sb:AppendLine(sLine2)
    sb:AppendLine(sLine3)
    sb:AppendLine(sLine4)
    sb:AppendLine(String.Format(sLine5, "IIF"))
    sb:AppendLine("")
    sb:AppendLine(sLine1)
    sb:AppendLine(sLine2)
    sb:AppendLine(sLine3)
    sb:AppendLine(sLine4)
    sb:AppendLine(String.Format(sLine5, "IF"))
    sb:AppendLine("")
    sb:AppendLine("/// Return the name of an identifier as a string")
    sb:AppendLine(e"/// <param name=\"expr\">An Identifier. This could be the name of a variable or type.</param>")
    sb:AppendLine("FUNCTION Nameof(expr AS OBJECT) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Convert an ASCII code to a character value. ")
    sb:AppendLine("/// <remarks>Values between 1 and 127 are stored as literal by the compiler. Larger values are handled at runtime because they depend on the current codepage </remarks>")
    sb:AppendLine(e"/// <param name=\"dwCode\">An ASCII code from 0 to 255.</param>")
    sb:AppendLine("FUNCTION Chr(dwCode as DWORD) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Convert an ASCII code to a character value. ")
    sb:AppendLine("/// <remarks>Values between 1 and 127 are stored as literal by the compiler. Larger values are handled at runtime because they depend on the current codepage </remarks>")
    sb:AppendLine(e"/// <param name=\"dwCode\">An ASCII code from 0 to 255.</param>")
    sb:AppendLine("FUNCTION _Chr(dwCode as DWORD) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Return the type of an expression as a System.Type.")
    sb:AppendLine(e"/// <param name=\"expr\">The expression to check.</param>")
    sb:AppendLine("FUNCTION TypeOf(expr as OBJECT) AS System.Type")
    sb:AppendLine("")
    sb:AppendLine("/// Return the size of an expression")
    sb:AppendLine(e"/// <param name=\"expr\">The expression to check. Must be a type or a variable.</param>")
    sb:AppendLine("FUNCTION SizeOf(expr as OBJECT) AS LONG")
    sb:AppendLine("")
    sb:AppendLine("/// Return the number of parameters that were passed to a function/method of the Clipper calling convention.")
    sb:AppendLine("FUNCTION PCount() AS DWORD")
    sb:AppendLine("")
    sb:AppendLine("/// Return the number of arguments that were declared for a function/method of the Clipper calling convention.")
    sb:AppendLine("FUNCTION ArgCount() AS DWORD")
    sb:AppendLine("")
    sb:AppendLine("/// Return the parameters that were passed to a function/method of the Clipper calling convention as an array of Usuals")
    sb:AppendLine("FUNCTION _Args() AS USUAL[]")
    sb:AppendLine("")
    sb:AppendLine("/// Retrieve a parameter in a function/method of the Clipper calling convention by position.")
    sb:AppendLine(e"/// <param name=\"nParam\">A Number between 1 and PCount()</param>")
    sb:AppendLine("FUNCTION _GetMParam(nParam as DWORD) AS USUAL")
    sb:AppendLine("")
    sb:AppendLine("/// Retrieve a parameter in a function/method of the Clipper calling convention by position.")
    sb:AppendLine(e"/// <param name=\"nParam\">A Number between 1 and PCount()</param>")
    sb:AppendLine("FUNCTION _GetFParam(nParam as DWORD) AS USUAL")
    sb:AppendLine("")
    sb:AppendLine("/// This function will return the module handle for the current module.")
    sb:AppendLine("FUNCTION _GetInst() AS PTR")
    sb:AppendLine("")
    sb:AppendLine("/// Convert a string to PSZ.")
    sb:AppendLine("/// <remarks>Please note that the PSZ is automatically released when the current function/method ends.
")
    sb:AppendLine("/// Use StringAlloc() to allocate PSZ values that are not automatically freed.</remarks>")
    sb:AppendLine(e"/// <param name=\"s\">The string to convert</param>")
    sb:AppendLine("FUNCTION String2Psz(s as STRING) AS PSZ")
    sb:AppendLine("")
    sb:AppendLine("/// Convert a string to PSZ. Please note that the PSZ is automatically released when the current function/method ends.")
    sb:AppendLine("/// <remarks>Please note that the PSZ is automatically released when the current function/method ends.
")
    sb:AppendLine("/// Use StringAlloc() to allocate PSZ values that are not automatically freed.</remarks>")
    sb:AppendLine(e"/// <param name=\"s\">The string to convert</param>")
    sb:AppendLine("FUNCTION Cast2Psz(s as STRING) AS PSZ")
    sb:AppendLine("")
    return sb:ToString()

USING System.Text
USING XSharpModel
FUNCTION XSharpBuiltInFunctions(location as string) as STRING
    local sb as StringBuilder
    local asm as System.Reflection.Assembly
    asm := System.Reflection.Assembly.GetAssembly(typeof(XAssembly))
    sb := StringBuilder{1024}
    sb:AppendLine("//")
    sb:AppendLine("// Comments: This file contains the prototypes of the pseudo functions that are built into the compiler")
    sb:AppendLine("// Location: "+location)
    sb:AppendLine("// Version :  "+ asm:GetName():ToString())
    sb:AppendLine("")
    sb:AppendLine("/// Return the name of an identifier as a string")
    sb:AppendLine(e"/// <param name=\"expr\">An Identifier. This could be the name of a variable or type.</param>")
    sb:AppendLine("FUNCTION Nameof(expr AS OBJECT) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Convert an ASCII code to a character value. ")
    sb:AppendLine("/// <remarks>Values between 1 and 127 are stored as literal by the compiler. Larger values are handled at runtime because they depend on the current codepage </remarks>")
    sb:AppendLine(e"/// <param name=\"dwCode\">An ASCII code from 0 to 255.</param>")
    sb:AppendLine("FUNCTION Chr(dwCode as DWORD) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Convert an ASCII code to a character value. ")
    sb:AppendLine("/// <remarks>Values between 1 and 127 are stored as literal by the compiler. Larger values are handled at runtime because they depend on the current codepage </remarks>")
    sb:AppendLine(e"/// <param name=\"dwCode\">An ASCII code from 0 to 255.</param>")
    sb:AppendLine("FUNCTION _Chr(dwCode as DWORD) AS STRING")
    sb:AppendLine("")
    sb:AppendLine("/// Return the type of an expression as a System.Type.")
    sb:AppendLine(e"/// <param name=\"expr\">The expression to check.</param>")
    sb:AppendLine("FUNCTION TypeOf(expr as OBJECT) AS System.Type")
    sb:AppendLine("")
    sb:AppendLine("/// Return the size of an expression")
    sb:AppendLine(e"/// <param name=\"expr\">The expression to check. Must be a type or a variable.</param>")
    sb:AppendLine("FUNCTION SizeOf(expr as OBJECT) AS LONG")
    sb:AppendLine("")
    sb:AppendLine("/// Return the number of parameters that were passed to a function/method of the Clipper calling convention.")
    sb:AppendLine("FUNCTION PCount() AS DWORD")
    sb:AppendLine("")
    sb:AppendLine("/// Return the number of arguments that were declared for a function/method of the Clipper calling convention.")
    sb:AppendLine("FUNCTION ArgCount() AS DWORD")
    sb:AppendLine("")
    sb:AppendLine("/// Return the parameters that were passed to a function/method of the Clipper calling convention as an array of Usuals")
    sb:AppendLine("FUNCTION _Args() AS USUAL[]")
    sb:AppendLine("")
    sb:AppendLine("/// Retrieve a parameter in a function/method of the Clipper calling convention by position.")
    sb:AppendLine(e"/// <param name=\"nParam\">A Number between 1 and PCount()</param>")
    sb:AppendLine("FUNCTION _GetMParam(nParam as DWORD) AS USUAL")
    sb:AppendLine("")
    sb:AppendLine("/// Retrieve a parameter in a function/method of the Clipper calling convention by position.")
    sb:AppendLine(e"/// <param name=\"nParam\">A Number between 1 and PCount()</param>")
    sb:AppendLine("FUNCTION _GetFParam(nParam as DWORD) AS USUAL")
    sb:AppendLine("")
    sb:AppendLine("/// This function will return the module handle for the current module.")
    sb:AppendLine("FUNCTION _GetInst() AS PTR")
    sb:AppendLine("")
    sb:AppendLine("/// Convert a string to PSZ.")
    sb:AppendLine("/// <remarks>Please note that the PSZ is automatically released when the current function/method ends.
")
    sb:AppendLine("/// Use StringAlloc() to allocate PSZ values that are not automatically freed.</remarks>")
    sb:AppendLine(e"/// <param name=\"s\">The string to convert</param>")
    sb:AppendLine("FUNCTION String2Psz(s as STRING) AS PSZ")
    sb:AppendLine("")
    sb:AppendLine("/// Convert a string to PSZ. Please note that the PSZ is automatically released when the current function/method ends.")
    sb:AppendLine("/// <remarks>Please note that the PSZ is automatically released when the current function/method ends.
")
    sb:AppendLine("/// Use StringAlloc() to allocate PSZ values that are not automatically freed.</remarks>")
    sb:AppendLine(e"/// <param name=\"s\">The string to convert</param>")
    sb:AppendLine("FUNCTION Cast2Psz(s as STRING) AS PSZ")
    sb:AppendLine("")
    return sb:ToString()


[Runtime] Added error message when restoring from Clipper mem file and incorrect field type was found

//
// 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.Text

/// <summary>
/// Copy public and private memory variables visible within the current routine to a disk file.
/// </summary>
/// <param name="cFileName">The name of the file, including an optional drive, directory, and extension. The default extension is .MEM </param>
/// <param name="cSkel">Wildcard pattern to use when saving. This can include literal characters as well as the standard wildcard characters, * and ?. </param>
/// <param name="lLike">When set to TRUE then variables matching the pattern are saved. When set to FALSE then the variables that do NOT match the pattern are saved.</param>
/// <remarks>
/// An existing MEM file will be overwritten. When an existing file is ReadOnly then an exception will be thrown.
/// </remarks>
FUNCTION _MSave(cFileName AS STRING, cSkel AS STRING, lLike AS LOGIC) AS VOID
    LOCAL lAll AS LOGIC
    LOCAL oMemWriter AS MemWriter
    IF String.IsNullOrEmpty(System.IO.Path.GetExtension(cFileName))
        cFileName := System.IO.Path.ChangeExtension(cFileName, ".MEM")
    ENDIF
    IF cSkel == "*"
        lAll := TRUE
        IF ! lLike 			// NOT ALL = nothing, so create empty file and exit
            MemoWrit(cFileName,"")
            RETURN
        ENDIF
        ELSE
            lAll := FALSE
        cSkel := Upper(cSkel)
    ENDIF

    oMemWriter := MemWriter{cFileName}
    IF ! oMemWriter:Ok
        // Throw an error
        ELSE
            LOCAL cVar AS STRING
            cVar := _PublicFirst()

            DO WHILE !String.IsNullOrEmpty(cVar)
                IF lAll .OR. _Like(cSkel, cVar) == lLike
                    oMemWriter:WriteValue(cVar, MemVarGet(cVar))
                ENDIF
                cVar := _PublicNext()
            ENDDO
            cVar := _PrivateFirst()

            DO WHILE !String.IsNullOrEmpty(cVar)
                IF lAll .OR. _Like(cSkel, cVar) == lLike
                    oMemWriter:WriteValue(cVar, MemVarGet(cVar))
                ENDIF
                cVar := _PrivateNext()
            ENDDO
        oMemWriter:Close()
    ENDIF
    RETURN

/// <summary>
/// Recreate public and private variables previously saved to a file and initialize them with their former values.
/// </summary>
/// <param name="cFileName">The name of the memory file to read. The default extension is .MEM </param>
/// <param name="lAdditive">When set to TRUE then the existing memory variables will be saved. Otherwise all memory variables will be deleted first.</param>
/// <param name="cSkel">(Optional) Wildcard pattern to use when saving. This can include literal characters as well as the standard wildcard characters, * and ?. </param>
/// <param name="lLike">(Optional) When set to TRUE then variables matching the pattern are restored. When set to FALSE then the variables that do NOT match the pattern are restored.</param>
/// <remarks>
/// When memory variables are restored, they are recreated as private variables with the scope of the current procedure or function
/// unless they exist as public variables and you specify the ADDITIVE clause .  If ADDITIVE is specified, public and private variables
/// with the same names are overwritten unless hidden with PRIVATE.  If ADDITIVE is not specified, all public and private variables are
/// released before the memory file is loaded. In that case all restored variables will become private variables.
/// </remarks>
FUNCTION _MRestore(cFileName AS STRING, lAdditive AS LOGIC, cSkel := NULL AS STRING, lInclude := TRUE AS LOGIC ) AS VOID
    LOCAL oMemReader AS MemReader
    IF .NOT. lAdditive
        _MClear()
    ENDIF
    IF String.IsNullOrEmpty(System.IO.Path.GetExtension(cFileName))
        cFileName := System.IO.Path.ChangeExtension(cFileName, ".MEM")
    ENDIF
    oMemReader := MemReader{cFileName}
    oMemReader:ReadFile(cSkel, lInclude)
    oMemReader:Close()
    RETURN

INTERNAL CLASS MemWriter
    PRIVATE hFile       AS IntPtr
    PRIVATE aArrayList  AS ARRAY	// to keep track of recursive arrays
    PRIVATE aObjectList AS ARRAY    // to keep track of recursive objects
    PRIVATE cFileName   AS STRING
    PROPERTY Ok         AS LOGIC GET hFile != F_ERROR

    CONSTRUCTOR (cFile AS STRING)
        cFileName := cFile
        hFile := FCreate(cFile)
        IF hFile == F_ERROR
            SELF:_Error()
        ENDIF
        aArrayList  := {}
        aObjectList := {}
        RETURN

    DESTRUCTOR
        SELF:Close()

    METHOD Close() AS VOID
        IF hFile != F_ERROR
            WriteByte(ASC_EOF)
            FClose(hFile)
            hFile := F_ERROR
            UnRegisterAxit(SELF)
        ENDIF
        RETURN

    METHOD _Error() AS VOID
        LOCAL oErr AS Error
        oErr := Error{FException()}
        oErr:Gencode := EG_READ
        oErr:SubCode := XSharp.VOErrors.E_OPEN_MSAVE
        oErr:FuncSym := "_MSAVE"
        oErr:FileName := cFileName
        oErr:OSCode   := FError()
        THROW oErr

    METHOD WriteStr(cVar AS STRING) AS VOID
        WriteBytes(W2Bin(WORD(SLen(cVar))))
        WriteBytes(cVar)
        RETURN

    METHOD WriteBytes(cVar AS STRING) AS VOID   PASCAL
        LOCAL nLen AS DWORD
        LOCAL nWritten AS DWORD
        LOCAL aBytes AS BYTE[]
        nLen   := SLen(cVar)
        aBytes := BYTE[] { nLen}
        FOR VAR nI := 1 TO nLen
            aBytes[nI] := (BYTE) cVar[nI-1]
        NEXT
        nWritten := FWrite3(hFile, aBytes, nLen)
        IF nWritten != nLen
            SELF:_Error()
        ENDIF

    METHOD WriteByte(nByte AS BYTE) AS VOID   PASCAL
        LOCAL nWritten AS DWORD
        nWritten := FWrite3(hFile, @nByte, 1)
        IF nWritten != 1
            SELF:_Error()
        ENDIF
        RETURN

    METHOD WriteValue(cVar AS STRING, uVal AS USUAL) AS VOID
        LOCAL wType 	AS DWORD
        LOCAL cVarName 	AS STRING
        LOCAL wArrayEl 	AS DWORD
        LOCAL WriteName AS Action
        wType    := UsualType(uVal)
        IF !String.IsNullOrEmpty(cVar)
            cVarName := cVar
            WriteName := { =>WriteStr(cVarName) }
        ELSE
            WriteName := { =>  }
        ENDIF

        SWITCH wType
            CASE __UsualType.String
                WriteByte(__UsualType.String)
                WriteName()
                WriteStr(uVal)

            CASE __UsualType.Long
                WriteByte(__UsualType.Long)
                WriteName()
                WriteBytes(L2Bin(uVal))

            CASE __UsualType.Date
            CASE __UsualType.DateTime
                WriteByte(__UsualType.Date)
                WriteName()
                WriteBytes(Date2Bin(uVal))

            CASE __UsualType.Float
            CASE __UsualType.Decimal
            CASE __UsualType.Currency
                WriteByte(__UsualType.Float)
                WriteName()
                WriteBytes(F2Bin(uVal))

            CASE __UsualType.Logic
                WriteByte(__UsualType.Logic)
                WriteName()
                WriteByte(IIF(uVal,1,0))

            CASE __UsualType.Symbol
                WriteByte(__UsualType.Symbol)
                WriteName()
                WriteStr(Symbol2String(uVal))

            CASE __UsualType.Array
                wArrayEl := AScan(aArrayList, uVal)
                IF wArrayEl =0
                    WriteByte(__UsualType.Array)
                    WriteName()
                    WriteArr(uVal)
                    ELSE
                        WriteByte(__UsualType.Array +0x80)
                        WriteName()
                    WriteBytes(W2Bin((WORD) wArrayEl))
                ENDIF

            CASE OBJECT
                wArrayEl := AScan(aObjectList, uVal)
                IF wArrayEl =0
                    WriteByte(__UsualType.Object)
                    WriteName()
                    WriteObj(uVal)
                ELSE
                    WriteByte(__UsualType.Object +0x80)
                    WriteName()
                    WriteBytes(W2Bin((WORD) wArrayEl))
                ENDIF

            CASE PTR
                WriteByte(__UsualType.Ptr)
                WriteName()
                WriteBytes(Ptr2Bin(uVal))
                WriteBytes(W2Bin(WORD(_GetMRandID())))

            OTHERWISE
                WriteByte(__UsualType.Void)
                WriteName()

        END SWITCH
        RETURN

    METHOD WriteObj  (oVar AS OBJECT) AS VOID
        LOCAL aIVarList AS ARRAY
        LOCAL nLen      AS DWORD
        LOCAL wI        AS DWORD
        LOCAL cIVar 	AS STRING
        IF oVar == NULL_OBJECT
            WriteStr("")
        ELSE
            WriteStr(ClassName(oVar))
            AAdd(SELF:aObjectList, oVar)

            aIVarList :=IvarList(oVar)
            nLen :=ALen(aIVarList)
            WriteBytes(W2Bin(WORD(nLen)))

            FOR wI := 1 UPTO nLen
                cIVar :=aIVarList[wI]
                IF IVarGetInfo(oVar, cIVar) > 0
                    WriteValue(cIVar, IVarGet(oVar, cIVar))
                ENDIF
            NEXT
        ENDIF
        RETURN

    METHOD WriteArr  (aVar AS ARRAY) AS VOID

        LOCAL wArrayLen 	AS DWORD
        LOCAL wI     	 	AS DWORD
        LOCAL uVal 			AS USUAL

        AAdd(aArrayList, aVar)

        wArrayLen :=ALen(aVar)
        WriteBytes(W2Bin(WORD(wArrayLen)))

        FOR wI := 1 UPTO wArrayLen

            uVal   :=aVar[wI]
            WriteValue(NULL_STRING, uVal)
        NEXT

        RETURN

END CLASS

FUNCTION _GetMRandID() AS WORD
    RETURN 0x4242

INTERNAL CLASS MemReader
    PRIVATE hFile AS IntPtr
    PRIVATE cFileName AS STRING
    PRIVATE aArrayList 	AS ARRAY		// to keep track of recursive arrays
    PRIVATE aObjectList AS ARRAY    // to keep track of recursive objects
    PRIVATE aBytes 		AS BYTE[]
    PRIVATE lUsemask	AS LOGIC
    PRIVATE cMask		AS STRING
    PRIVATE lInclude	AS LOGIC

    CONSTRUCTOR (cFile AS STRING)
        cFileName := cFile
        hFile := FOpen(cFile)
        IF hFile == F_ERROR
            SELF:_Error()
        ENDIF
        aArrayList  := {}
        aObjectList := {}
        aBytes      := BYTE[]{256}
        RETURN

    DESTRUCTOR
        SELF:Close()

    METHOD _Error() AS VOID
        LOCAL oErr AS Error
        oErr := Error{FException()}
        oErr:Gencode := EG_READ
        oErr:SubCode := XSharp.VOErrors.E_OPEN_MRESTORE
        oErr:FuncSym := "_MRESTORE"
        oErr:FileName := cFileName
        oErr:OSCode   := FError()
        THROW oErr

    METHOD Close() AS VOID
        IF hFile != F_ERROR
            FClose(hFile)
            hFile := F_ERROR
            UnRegisterAxit(SELF)
        ENDIF
        RETURN

    METHOD ReadBytes(nBytes AS DWORD) AS STRING
        IF nBytes > SELF:aBytes:Length
            SELF:aBytes := BYTE[]{nBytes}
        ENDIF
        IF FRead3(hFile, aBytes, nBytes) != nBytes
            SELF:_Error()
        ENDIF
        LOCAL sb AS StringBuilder
        sb := StringBuilder{}
        FOR VAR nI := 1 TO nBytes
            sb:Append( (CHAR) aBytes[nI])
        NEXT
        RETURN sb:ToString()

    METHOD ReadWord() AS WORD
        RETURN Bin2W(SELF:ReadBytes(2))

    METHOD ReadValue(wType AS DWORD) AS USUAL
        LOCAL uValue AS USUAL
        LOCAL wLen AS WORD
        SWITCH wType
        CASE __UsualType.String
            uValue := SELF:ReadString()

        CASE __UsualType.Long
            uValue :=Bin2L(SELF:ReadBytes(4))

        CASE __UsualType.Date
            uValue :=Bin2Date(SELF:ReadBytes(4))

        CASE __UsualType.Float
            uValue :=Bin2F(SELF:ReadBytes(12))

        CASE __UsualType.Logic
            uValue := ReadByte() != 0

        CASE __UsualType.Symbol
            uValue := String2Symbol(SELF:ReadString())

        CASE __UsualType.Array
            wLen := SELF:ReadWord()
            uValue := SELF:ReadArray(wLen)

        CASE __UsualType.Array +0x80
            wLen := SELF:ReadWord()
            uValue :=aArrayList[wLen]

        CASE __UsualType.Object
            uValue :=SELF:ReadObject(SELF:ReadString())

        CASE __UsualType.Object +0x80
            wLen := SELF:ReadWord()
            uValue :=aObjectList[wLen]

        CASE __UsualType.Ptr
            uValue :=Bin2Ptr(SELF:ReadBytes(4))
            IF SELF:ReadWord() <>_GetMRandID()
                uValue :=NULL_PTR
            ENDIF

        CASE __UsualType.Void
        OTHERWISE
                uValue :=NIL

        END SWITCH
        RETURN uValue

    METHOD ReadByte () AS BYTE
        IF FRead3(hFile, aBytes, 1) != 1
            SELF:_Error()
        ENDIF
        RETURN aBytes[1]

    METHOD ReadArray(wArrayLen AS DWORD) AS ARRAY
        LOCAL aVar AS ARRAY
        LOCAL wI    AS WORD
        LOCAL wType AS DWORD
        aVar := ArrayCreate(wArrayLen)
        AAdd(aArrayList, aVar)

        FOR wI := 1 UPTO wArrayLen
            wType    := ReadByte()
            aVar[wI] := ReadValue(wType)
        NEXT

        RETURN aVar
    METHOD ReadObject   (sObject AS STRING) AS OBJECT

        LOCAL oVar     AS OBJECT
        LOCAL nLen     AS DWORD
        LOCAL wI       AS DWORD
        LOCAL cVar		AS STRING
        LOCAL wType 	AS DWORD
        LOCAL uValue	AS USUAL
        IF String.IsNullOrEmpty(sObject)
            RETURN NULL_OBJECT
        ENDIF
        oVar :=CreateInstance(sObject)

        AAdd(aObjectList, oVar)

        nLen := ReadWord()

        FOR wI := 1 UPTO nLen

            wType  := SELF:ReadByte()

            cVar 	:= SELF:ReadString()
            uValue 	:= SELF:ReadValue(wType)
            IVarPut(oVar, cVar, uValue)

        NEXT

        RETURN oVar

    METHOD ReadFile(cMask AS STRING, lInclude AS LOGIC) AS VOID
        LOCAL wType AS BYTE
        aArrayList :={}
        aObjectList :={}

        IF cMask != NULL
            SELF:lUsemask := TRUE
            SELF:cMask    := Upper(cMask)
            SELF:lInclude := lInclude
        ENDIF

        wType  := SELF:ReadByte()

        IF wType< 65 // ASC_A //401@TR001
            ReadVOFile(wType)
        ELSE
            ReadClipperFile(wType)
        ENDIF

    METHOD ReadString() AS STRING
        LOCAL nLen AS WORD
        nLen := SELF:ReadWord()
        RETURN SELF:ReadBytes(nLen)

    METHOD ReadVOFile(wType AS BYTE) AS VOID
        LOCAL cVar AS STRING
        LOCAL uValue AS USUAL
        LOCAL lPut := TRUE AS LOGIC
        DO WHILE wType <>ASC_EOF
            cVar    := ReadString():ToUpper()
            uValue  := ReadValue(wType)
            IF lUsemask
                lPut := _Like(SELF:cMask, cVar) == SELF:lInclude
            ENDIF
            IF lPut
                MemVarPut(cVar, uValue)
            ENDIF
            wType  := SELF:ReadByte()
        ENDDO

    METHOD ReadClipperFile(wType AS BYTE) AS VOID
        LOCAL cType AS STRING
        LOCAL nLen AS DWORD
        LOCAL cVar AS STRING
        LOCAL nType AS BYTE
        LOCAL lPut := TRUE AS LOGIC

        // Clipper type mem file, this has a diffent file format
        // file format is as follows
        // name,  11 bytes nul terminated (Clipper var name is 10 chars max)
        // type,  1  byte   ox80 ored with either "C", "N", "D" or "L"
        // pad,   4  bytes
        // len,   1  byte
        // dec,   1  byte
        // class, 1  byte  not used
        // pad,   13 bytes
        // value, if C length is dec*256+len, null terminated
        //        if N length is 8 bytes, real8 format
        //                  for display - len=number of digits
        //                                dec=number of decimal places
        //        if L length is 1
        //        if D length is 8, real8 format
        DO WHILE wType <>ASC_EOF
            cVar	:= Chr(wType)+SELF:ReadBytes(10)
            cVar 	:= Left(cVar,At(Chr(0),cVar)-1):ToUpper()
            nType   := SELF:ReadByte()
            cType	:= Chr(_AND(nType,127))
            SELF:ReadBytes(4) // pad
            IF lUsemask
                lPut := _Like(SELF:cMask, cVar ) == SELF:lInclude
            ENDIF

            SWITCH cType
            CASE "C" //String
                nLen:=Bin2W(SELF:ReadBytes(2))
                SELF:ReadBytes(14) //Class and pad
                IF lPut
                    MemVarPut(cVar, SELF:ReadBytes(nLen-1))
                ENDIF
                SELF:ReadBytes(1) //nul byte
            CASE "N" //Real8
                SELF:ReadBytes(16) //Len, Dec, Class and pad
                IF lPut
                    MemVarPut(cVar, Bin2Real8(SELF:ReadBytes(8)))
                ENDIF
            CASE "L" //Logic
                SELF:ReadBytes(16) //Len, Dec, Class and pad
                IF lPut
                    MemVarPut(cVar, ReadByte() != 0)
                ENDIF
            CASE "D" //Date
                SELF:ReadBytes(16) //Len, Dec, Class and pad
                IF lPut
                    VAR r8 := Bin2Real8(SELF:ReadBytes(8))
                    MemVarPut(cVar, Bin2Date(L2Bin(LONGINT(r8))))
                ENDIF
            OTHERWISE
                VAR error := Error{"Unknown type '"+cType+"' for memory variable '"+cVar+"'. Expected types are 'CDLN'"}
                error:FileName := cFileName
                THROW error
            END SWITCH
            wType  := SELF:ReadByte()
        ENDDO

        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.Text

/// <summary>
/// Copy public and private memory variables visible within the current routine to a disk file.
/// </summary>
/// <param name="cFileName">The name of the file, including an optional drive, directory, and extension. The default extension is .MEM </param>
/// <param name="cSkel">Wildcard pattern to use when saving. This can include literal characters as well as the standard wildcard characters, * and ?. </param>
/// <param name="lLike">When set to TRUE then variables matching the pattern are saved. When set to FALSE then the variables that do NOT match the pattern are saved.</param>
/// <remarks>
/// An existing MEM file will be overwritten. When an existing file is ReadOnly then an exception will be thrown.
/// </remarks>
FUNCTION _MSave(cFileName AS STRING, cSkel AS STRING, lLike AS LOGIC) AS VOID
    LOCAL lAll AS LOGIC
    LOCAL oMemWriter AS MemWriter
    IF String.IsNullOrEmpty(System.IO.Path.GetExtension(cFileName))
        cFileName := System.IO.Path.ChangeExtension(cFileName, ".MEM")
    ENDIF
    IF cSkel == "*"
        lAll := TRUE
        IF ! lLike 			// NOT ALL = nothing, so create empty file and exit
            MemoWrit(cFileName,"")
            RETURN
        ENDIF
        ELSE
            lAll := FALSE
        cSkel := Upper(cSkel)
    ENDIF

    oMemWriter := MemWriter{cFileName}
    IF ! oMemWriter:Ok
        // Throw an error
        ELSE
            LOCAL cVar AS STRING
            cVar := _PublicFirst()

            DO WHILE !String.IsNullOrEmpty(cVar)
                IF lAll .OR. _Like(cSkel, cVar) == lLike
                    oMemWriter:WriteValue(cVar, MemVarGet(cVar))
                ENDIF
                cVar := _PublicNext()
            ENDDO
            cVar := _PrivateFirst()

            DO WHILE !String.IsNullOrEmpty(cVar)
                IF lAll .OR. _Like(cSkel, cVar) == lLike
                    oMemWriter:WriteValue(cVar, MemVarGet(cVar))
                ENDIF
                cVar := _PrivateNext()
            ENDDO
        oMemWriter:Close()
    ENDIF
    RETURN

/// <summary>
/// Recreate public and private variables previously saved to a file and initialize them with their former values.
/// </summary>
/// <param name="cFileName">The name of the memory file to read. The default extension is .MEM </param>
/// <param name="lAdditive">When set to TRUE then the existing memory variables will be saved. Otherwise all memory variables will be deleted first.</param>
/// <param name="cSkel">(Optional) Wildcard pattern to use when saving. This can include literal characters as well as the standard wildcard characters, * and ?. </param>
/// <param name="lLike">(Optional) When set to TRUE then variables matching the pattern are restored. When set to FALSE then the variables that do NOT match the pattern are restored.</param>
/// <remarks>
/// When memory variables are restored, they are recreated as private variables with the scope of the current procedure or function
/// unless they exist as public variables and you specify the ADDITIVE clause .  If ADDITIVE is specified, public and private variables
/// with the same names are overwritten unless hidden with PRIVATE.  If ADDITIVE is not specified, all public and private variables are
/// released before the memory file is loaded. In that case all restored variables will become private variables.
/// </remarks>
FUNCTION _MRestore(cFileName AS STRING, lAdditive AS LOGIC, cSkel := NULL AS STRING, lInclude := TRUE AS LOGIC ) AS VOID
    LOCAL oMemReader AS MemReader
    IF .NOT. lAdditive
        _MClear()
    ENDIF
    IF String.IsNullOrEmpty(System.IO.Path.GetExtension(cFileName))
        cFileName := System.IO.Path.ChangeExtension(cFileName, ".MEM")
    ENDIF
    oMemReader := MemReader{cFileName}
    oMemReader:ReadFile(cSkel, lInclude)
    oMemReader:Close()
    RETURN

INTERNAL CLASS MemWriter
    PRIVATE hFile       AS IntPtr
    PRIVATE aArrayList  AS ARRAY	// to keep track of recursive arrays
    PRIVATE aObjectList AS ARRAY    // to keep track of recursive objects
    PRIVATE cFileName   AS STRING
    PROPERTY Ok         AS LOGIC GET hFile != F_ERROR

    CONSTRUCTOR (cFile AS STRING)
        cFileName := cFile
        hFile := FCreate(cFile)
        IF hFile == F_ERROR
            SELF:_Error()
        ENDIF
        aArrayList  := {}
        aObjectList := {}
        RETURN

    DESTRUCTOR
        SELF:Close()

    METHOD Close() AS VOID
        IF hFile != F_ERROR
            WriteByte(ASC_EOF)
            FClose(hFile)
            hFile := F_ERROR
            UnRegisterAxit(SELF)
        ENDIF
        RETURN

    METHOD _Error() AS VOID
        LOCAL oErr AS Error
        oErr := Error{FException()}
        oErr:Gencode := EG_READ
        oErr:SubCode := XSharp.VOErrors.E_OPEN_MSAVE
        oErr:FuncSym := "_MSAVE"
        oErr:FileName := cFileName
        oErr:OSCode   := FError()
        THROW oErr

    METHOD WriteStr(cVar AS STRING) AS VOID
        WriteBytes(W2Bin(WORD(SLen(cVar))))
        WriteBytes(cVar)
        RETURN

    METHOD WriteBytes(cVar AS STRING) AS VOID   PASCAL
        LOCAL nLen AS DWORD
        LOCAL nWritten AS DWORD
        LOCAL aBytes AS BYTE[]
        nLen   := SLen(cVar)
        aBytes := BYTE[] { nLen}
        FOR VAR nI := 1 TO nLen
            aBytes[nI] := (BYTE) cVar[nI-1]
        NEXT
        nWritten := FWrite3(hFile, aBytes, nLen)
        IF nWritten != nLen
            SELF:_Error()
        ENDIF

    METHOD WriteByte(nByte AS BYTE) AS VOID   PASCAL
        LOCAL nWritten AS DWORD
        nWritten := FWrite3(hFile, @nByte, 1)
        IF nWritten != 1
            SELF:_Error()
        ENDIF
        RETURN

    METHOD WriteValue(cVar AS STRING, uVal AS USUAL) AS VOID
        LOCAL wType 	AS DWORD
        LOCAL cVarName 	AS STRING
        LOCAL wArrayEl 	AS DWORD
        LOCAL WriteName AS Action
        wType    := UsualType(uVal)
        IF !String.IsNullOrEmpty(cVar)
            cVarName := cVar
            WriteName := { =>WriteStr(cVarName) }
        ELSE
            WriteName := { =>  }
        ENDIF

        SWITCH wType
            CASE __UsualType.String
                WriteByte(__UsualType.String)
                WriteName()
                WriteStr(uVal)

            CASE __UsualType.Long
                WriteByte(__UsualType.Long)
                WriteName()
                WriteBytes(L2Bin(uVal))

        CASE __UsualType.Date
            CASE __UsualType.DateTime
                WriteByte(__UsualType.Date)
                WriteName()
                WriteBytes(Date2Bin(uVal))

            CASE __UsualType.Float
            CASE __UsualType.Decimal
            CASE __UsualType.Currency
                WriteByte(__UsualType.Float)
                WriteName()
                WriteBytes(F2Bin(uVal))

            CASE __UsualType.Logic
                WriteByte(__UsualType.Logic)
                WriteName()
                WriteByte(IIF(uVal,1,0))

            CASE __UsualType.Symbol
                WriteByte(__UsualType.Symbol)
                WriteName()
                WriteStr(Symbol2String(uVal))

            CASE __UsualType.Array
                wArrayEl := AScan(aArrayList, uVal)
                IF wArrayEl =0
                    WriteByte(__UsualType.Array)
                    WriteName()
                    WriteArr(uVal)
                    ELSE
                        WriteByte(__UsualType.Array +0x80)
                        WriteName()
                    WriteBytes(W2Bin((WORD) wArrayEl))
                ENDIF

            CASE OBJECT
                wArrayEl := AScan(aObjectList, uVal)
                IF wArrayEl =0
                    WriteByte(__UsualType.Object)
                    WriteName()
                    WriteObj(uVal)
                    ELSE
                        WriteByte(__UsualType.Object +0x80)
                        WriteName()
                    WriteBytes(W2Bin((WORD) wArrayEl))
                ENDIF

            CASE PTR
                WriteByte(__UsualType.Ptr)
                WriteName()
                WriteBytes(Ptr2Bin(uVal))
                WriteBytes(W2Bin(WORD(_GetMRandID())))

            OTHERWISE
                WriteByte(__UsualType.Void)
                WriteName()

        END SWITCH
        RETURN

    METHOD WriteObj  (oVar AS OBJECT) AS VOID
        LOCAL aIVarList AS ARRAY
        LOCAL nLen      AS DWORD
        LOCAL wI        AS DWORD
        LOCAL cIVar 	AS STRING
        IF oVar == NULL_OBJECT
            WriteStr("")
        ELSE
            WriteStr(ClassName(oVar))
            AAdd(SELF:aObjectList, oVar)

            aIVarList :=IvarList(oVar)
            nLen :=ALen(aIVarList)
            WriteBytes(W2Bin(WORD(nLen)))

            FOR wI := 1 UPTO nLen
                cIVar :=aIVarList[wI]
                IF IVarGetInfo(oVar, cIVar) > 0
                    WriteValue(cIVar, IVarGet(oVar, cIVar))
                ENDIF
            NEXT
        ENDIF
        RETURN

    METHOD WriteArr  (aVar AS ARRAY) AS VOID

        LOCAL wArrayLen 	AS DWORD
        LOCAL wI     	 	AS DWORD
        LOCAL uVal 			AS USUAL

        AAdd(aArrayList, aVar)

        wArrayLen :=ALen(aVar)
        WriteBytes(W2Bin(WORD(wArrayLen)))

        FOR wI := 1 UPTO wArrayLen

            uVal   :=aVar[wI]
            WriteValue(NULL_STRING, uVal)
        NEXT

        RETURN

END CLASS

FUNCTION _GetMRandID() AS WORD
    RETURN 0x4242

INTERNAL CLASS MemReader
    PRIVATE hFile AS IntPtr
    PRIVATE cFileName AS STRING
    PRIVATE aArrayList 	AS ARRAY		// to keep track of recursive arrays
    PRIVATE aObjectList AS ARRAY    // to keep track of recursive objects
    PRIVATE aBytes 		AS BYTE[]
    PRIVATE lUsemask	AS LOGIC
    PRIVATE cMask		AS STRING
    PRIVATE lInclude	AS LOGIC

    CONSTRUCTOR (cFile AS STRING)
        cFileName := cFile
        hFile := FOpen(cFile)
        IF hFile == F_ERROR
            SELF:_Error()
        ENDIF
        aArrayList  := {}
        aObjectList := {}
        aBytes      := BYTE[]{256}
        RETURN

    DESTRUCTOR
        SELF:Close()

    METHOD _Error() AS VOID
        LOCAL oErr AS Error
        oErr := Error{FException()}
        oErr:Gencode := EG_READ
        oErr:SubCode := XSharp.VOErrors.E_OPEN_MRESTORE
        oErr:FuncSym := "_MRESTORE"
        oErr:FileName := cFileName
        oErr:OSCode   := FError()
        THROW oErr

    METHOD Close() AS VOID
        IF hFile != F_ERROR
            FClose(hFile)
            hFile := F_ERROR
            UnRegisterAxit(SELF)
        ENDIF
        RETURN

    METHOD ReadBytes(nBytes AS DWORD) AS STRING
        IF nBytes > SELF:aBytes:Length
            SELF:aBytes := BYTE[]{nBytes}
        ENDIF
        IF FRead3(hFile, aBytes, nBytes) != nBytes
            SELF:_Error()
        ENDIF
        LOCAL sb AS StringBuilder
        sb := StringBuilder{}
        FOR VAR nI := 1 TO nBytes
            sb:Append( (CHAR) aBytes[nI])
        NEXT
        RETURN sb:ToString()

    METHOD ReadWord() AS WORD
        RETURN Bin2W(SELF:ReadBytes(2))

    METHOD ReadValue(wType AS DWORD) AS USUAL
        LOCAL uValue AS USUAL
        LOCAL wLen AS WORD
        SWITCH wType
            CASE __UsualType.String
                uValue := SELF:ReadString()

            CASE __UsualType.Long
                uValue :=Bin2L(SELF:ReadBytes(4))

            CASE __UsualType.Date
                uValue :=Bin2Date(SELF:ReadBytes(4))

            CASE __UsualType.Float
                uValue :=Bin2F(SELF:ReadBytes(12))

            CASE __UsualType.Logic
                uValue := ReadByte() != 0

            CASE __UsualType.Symbol
                uValue := String2Symbol(SELF:ReadString())

            CASE __UsualType.Array
                wLen := SELF:ReadWord()
                uValue := SELF:ReadArray(wLen)

            CASE __UsualType.Array +0x80
                wLen := SELF:ReadWord()
                uValue :=aArrayList[wLen]

            CASE __UsualType.Object
                uValue :=SELF:ReadObject(SELF:ReadString())

            CASE __UsualType.Object +0x80
                wLen := SELF:ReadWord()
                uValue :=aObjectList[wLen]

            CASE __UsualType.Ptr
                uValue :=Bin2Ptr(SELF:ReadBytes(4))
                IF SELF:ReadWord() <>_GetMRandID()
                    uValue :=NULL_PTR
                ENDIF

        CASE __UsualType.Void
        OTHERWISE
                uValue :=NIL

        END SWITCH
        RETURN uValue

    METHOD ReadByte () AS BYTE
        IF FRead3(hFile, aBytes, 1) != 1
            SELF:_Error()
        ENDIF
        RETURN aBytes[1]

    METHOD ReadArray(wArrayLen AS DWORD) AS ARRAY
        LOCAL aVar AS ARRAY
        LOCAL wI    AS WORD
        LOCAL wType AS DWORD
        aVar := ArrayCreate(wArrayLen)
        AAdd(aArrayList, aVar)

        FOR wI := 1 UPTO wArrayLen
            wType    := ReadByte()
            aVar[wI] := ReadValue(wType)
        NEXT

        RETURN aVar
    METHOD ReadObject   (sObject AS STRING) AS OBJECT

        LOCAL oVar     AS OBJECT
        LOCAL nLen     AS DWORD
        LOCAL wI       AS DWORD
        LOCAL cVar		AS STRING
        LOCAL wType 	AS DWORD
        LOCAL uValue	AS USUAL
        IF String.IsNullOrEmpty(sObject)
            RETURN NULL_OBJECT
        ENDIF
        oVar :=CreateInstance(sObject)

        AAdd(aObjectList, oVar)

        nLen := ReadWord()

        FOR wI := 1 UPTO nLen

            wType  := SELF:ReadByte()

            cVar 	:= SELF:ReadString()
            uValue 	:= SELF:ReadValue(wType)
            IVarPut(oVar, cVar, uValue)

        NEXT

        RETURN oVar

    METHOD ReadFile(cMask AS STRING, lInclude AS LOGIC) AS VOID
        LOCAL wType AS BYTE
        aArrayList :={}
        aObjectList :={}

        IF cMask != NULL
            SELF:lUsemask := TRUE
            SELF:cMask    := Upper(cMask)
            SELF:lInclude := lInclude
        ENDIF

        wType  := SELF:ReadByte()

        IF wType< 65 // ASC_A //401@TR001
            ReadVOFile(wType)
        ELSE
            ReadClipperFile(wType)
        ENDIF

    METHOD ReadString() AS STRING
        LOCAL nLen AS WORD
        nLen := SELF:ReadWord()
        RETURN SELF:ReadBytes(nLen)

    METHOD ReadVOFile(wType AS BYTE) AS VOID
        LOCAL cVar AS STRING
        LOCAL uValue AS USUAL
        LOCAL lPut := TRUE AS LOGIC
        DO WHILE wType <>ASC_EOF
            cVar    := ReadString():ToUpper()
            uValue  := ReadValue(wType)
            IF lUsemask
                lPut := _Like(SELF:cMask, cVar) == SELF:lInclude
            ENDIF
            IF lPut
                MemVarPut(cVar, uValue)
            ENDIF
            wType  := SELF:ReadByte()
        ENDDO

    METHOD ReadClipperFile(wType AS BYTE) AS VOID
        LOCAL cType AS STRING
        LOCAL nLen AS DWORD
        LOCAL cVar AS STRING
        LOCAL nType AS BYTE
        LOCAL lPut := TRUE AS LOGIC

        //Clipper type mem file
        // file format is as follows
        // name,  11 bytes nul terminated (Clipper var name is 10 chars max)
        // type,  1  byte   ox80 ored with either "C", "N", "D" or "L"
        // pad,   4  bytes
        // len,   1  byte
        // dec,   1  byte
        // class, 1  byte  not used
        // pad,   13 bytes
        // value, if C length is dec*256+len, null terminated
        //        if N length is 8 bytes, real8 format
        //                  for display - len=number of digits
        //                                dec=number of decimal places
        //        if L length is 1
        //        if D length is 8, real8 format
        DO WHILE wType <>ASC_EOF
            cVar	:= Chr(wType)+SELF:ReadBytes(10)
            cVar 	:= Left(cVar,At(Chr(0),cVar)-1):ToUpper()
            nType   := SELF:ReadByte()
            cType	:= Chr(_AND(nType,127))
            SELF:ReadBytes(4) // pad
            IF lUsemask
                lPut := _Like(SELF:cMask, cVar ) == SELF:lInclude
            ENDIF

            DO CASE
                CASE cType ="C" //String
                    nLen:=Bin2W(SELF:ReadBytes(2))
                    SELF:ReadBytes(14) //Class and pad
                    IF lPut
                        MemVarPut(cVar, SELF:ReadBytes(nLen-1))
                    ENDIF
                SELF:ReadBytes(1) //nul byte
                CASE cType ="N" //Real8
                    SELF:ReadBytes(16) //Len, Dec, Class and pad
                    IF lPut
                        MemVarPut(cVar, Bin2Real8(SELF:ReadBytes(8)))
                    ENDIF
                CASE cType ="L" //Logic
                    SELF:ReadBytes(16) //Len, Dec, Class and pad
                    IF lPut
                        MemVarPut(cVar, ReadByte() != 0)
                    ENDIF
                CASE cType ="D" //Date
                    SELF:ReadBytes(16) //Len, Dec, Class and pad
                    IF lPut
                        VAR r8 := Bin2Real8(SELF:ReadBytes(8))
                        MemVarPut(cVar, Bin2Date(L2Bin(LONGINT(r8))))
                    ENDIF
                OTHERWISE
                BREAK
            ENDCASE
            wType  := SELF:ReadByte()
        ENDDO

        RETURN

END CLASS


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 * o = new QTestEventList();
  Qt4xHb::returnNewObject( o, true );
}

/*
QTestEventList ( const QTestEventList & other )
*/
void QTestEventList_new2()
{
  QTestEventList * o = new QTestEventList( *PQTESTEVENTLIST(1) );
  Qt4xHb::returnNewObject( o, 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

/*

  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 * o = new QTestEventList();
  Qt4xHb::returnNewObject( o, true );
}

/*
QTestEventList ( const QTestEventList & other )
*/
void QTestEventList_new2()
{
  QTestEventList * o = new QTestEventList( *PQTESTEVENTLIST(1) );
  Qt4xHb::returnNewObject( o, 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