[RDD] Add support for char fields > 255

[RDD] Add support for char fields > 255

//
// 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.IO
USING XSharp.RDD.Enums
USING System.Collections.Generic
USING System.Linq
USING XSharp.RDD
// The classes below are simple. No properties, but all public fields.

BEGIN NAMESPACE XSharp.RDD.Support

/// Helper class to store the scope and codeblock for a DbEval() operation.
CLASS DbEvalInfo

	/// A code block to be evaluated with DbEval() on each row of the work area that is in the range defined by ScopeInfo.
	PUBLIC Block	 AS ICodeblock

	/// A DbScopeInfo structure limiting the evaluation of Block.
	PUBLIC ScopeInfo AS DbScopeInfo
    /// Construct a DbEvalInfo object.
    CONSTRUCTOR()
        SELF:ScopeInfo := DbScopeInfo{}
        RETURN
END CLASS

/// Helper class to store a filter condition for a table.
CLASS DbFilterInfo
	/// A string representing the source code for itmCobExpr.
	PUBLIC FilterText	AS STRING

	/// A code block representing the condition that is evaluated at each cursor location.  If the result of the evaluation is FALSE, the cursor location requested is invalid according to the current filter condition.
	PUBLIC FilterBlock	AS ICodeblock

	/// A flag that is TRUE if a filter is active.
	PUBLIC Active		AS LOGIC

	/// A flag that is TRUE if a filter is optimized.
	PUBLIC Optimized	AS LOGIC

	///Clear the filter fields.
	METHOD Clear() AS VOID
		SELF:FilterBlock := NULL
		SELF:FilterText	 := NULL
		SELF:Active		 := FALSE
		SELF:Optimized	 := FALSE
		RETURN

	///Clone the filter object.
	METHOD Clone AS DbFilterInfo
		LOCAL oCLone AS DbFilterInfo
		oCLone := DbFilterInfo{}
		oCLone:FilterBlock := SELF:FilterBlock
		oClone:FilterText  := SELF:FilterText
		oClone:Optimized   := SELF:Optimized
		oClone:Active	   := FALSE
		RETURN oClone

    /// Construct a DbFilterInfo object.
    CONSTRUCTOR
        SELF:Clear()
        RETURN

	METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:FilterBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:FilterText)
            SELF:FilterBlock := oRDD:Compile(SELF:FilterText)
        ENDIF
END CLASS

/// Helper structure to store information needed to lock a row or table for exclusive access.
STRUCTURE DbLockInfo
	/// An Item indicating the ID of the row to lock.  This member is meaningful only if Method is set to EXCLUSIVE or MULTIPLE.
	PUBLIC RecId		AS OBJECT

	/// A constant indicating the type of lock to obtain.  The possible values are of the Lockmethod enum.
	PUBLIC @@Method AS LockMethod

	/// A flag that is TRUE if the lock operation was successful.
	PUBLIC Result		AS LOGIC
	/// List of possible Locking Methods
	ENUM LockMethod
		/// Lock a row, releasing currently locked rows.
		MEMBER Exclusive := 1
		/// Lock a row, maintaining currently locked rows.
		MEMBER Multiple  := 2
		/// Lock a table, releasing locks currently held.
		MEMBER File 	 := 3
	END ENUM
END STRUCTURE

/// Helper class to store information needed to open a table.
CLASS DbOpenInfo
	/// Should the table be opened Readonly?
	PUBLIC ReadOnly 	AS LOGIC
	/// Should the table be opened Shared?
	PUBLIC Shared		AS LOGIC
	/// Unique Alias that the table has. This must be a valid XBase Identifier
	PUBLIC Alias		AS STRING
	/// The extension for the table that must be opened.
	PUBLIC Extension    AS STRING
	/// The filename (optionally includig a path) for the table that must be opened.
	PUBLIC FileName		AS STRING
	/// Workarea number in which the table will be opened.
	PUBLIC WorkArea		AS DWORD
    /// Construct a DbOpenInfo object.

	CONSTRUCTOR()
        SUPER()
    /// Construct a DbOpenInfo object.
	CONSTRUCTOR(sFileName AS STRING, sAlias AS STRING, dwWorkArea AS DWORD, lShared AS LOGIC, lReadOnly AS LOGIC)
		FileName 	:= sFileName
        Extension   := Path.GetExtension(sFileName)
		IF String.IsNullOrEmpty( sAlias )
			Alias := Path.GetFileNameWithoutExtension( sFileName )
		ELSE
			Alias	 	:= sAlias
		ENDIF
		WorkArea	:= dwWorkArea
		Shared		:= lShared
		ReadOnly	:= lReadOnly
	/// Return the numeric FileMode based on the Shared and Readonly flags
	PUBLIC PROPERTY FileMode AS DWORD
	GET
		LOCAL nMode AS DWORD
		nMode := FO_COMPAT
		IF (Shared)
			nMode |= FO_SHARED
		ELSE
			nMode |= FO_EXCLUSIVE
		ENDIF
		IF (ReadOnly)
			nMode |= FO_READ
		ELSE
			nMode |= FO_READWRITE
		ENDIF
		RETURN nMode
	END GET
	END PROPERTY
    PUBLIC METHOD Clone() AS DbOpenInfo
        RETURN (DbOpenInfo) SELF:MemberwiseClone()
END CLASS

/// Helper class to store information needed to create a conditional order.
CLASS DbOrderCondInfo
	///  A flag that is TRUE if one or more valid conditions have been specified in the structure.
	PUBLIC Active			AS LOGIC
	///  A flag that is TRUE if open orders should remain open while the new order is being created.
	PUBLIC Additive			AS LOGIC
	///  A flag that is TRUE if all rows are to be processed during order creation.
	PUBLIC All				AS LOGIC
	/// A flag that is TRUE if the new order will be a custom built order.
	PUBLIC Custom			AS LOGIC
	///  A flag that is TRUE if the order should be created in descending order.
	PUBLIC DESCENDING 	AS LOGIC
	/// A code block defining the expression to evaluate every StepSize rows during the creation of the order.  The code block referenced should return a logical value: TRUE indicates that creation of the order should continue normally, and FALSE indicates that order creation should terminate.
	PUBLIC EvalBlock		AS ICodeblock
	/// A code block defining the for condition to use for the creation and maintenance of the order.
	PUBLIC ForBlock			AS ICodeblock
	/// A string defining the for condition to use for the creation and maintenance of the order.
	PUBLIC ForExpression	AS STRING
	/// The number of rows to process for order creation.
	PUBLIC NextCount		AS LONG
	/// A flag that is TRUE if the for condition may NOT be optimized,
	PUBLIC NoOptimize		AS LOGIC
	///  A single row number to include in the order.
	PUBLIC RecNo			AS LONG
	/// A flag that is TRUE if only the rows specified by lStartRecno through end-of-file are to be included in the order.
	PUBLIC Rest				AS LOGIC
	/// A flag indicating whether the order is to be scoped. fScoped will be TRUE if WhileBlock, NextCount, Recno, Rest, or All is specified.
	PUBLIC Scoped			AS LOGIC
	/// The row at which to begin processing when either the NextCount or Rest scoping options are specified.
	PUBLIC StartRecNo		AS LONG
	/// The frequency of the evaluation of EvalBlock.
	PUBLIC StepSize			AS LONG
	/// A flag that is TRUE if only rows in the controlling order are to be included in the order.
	PUBLIC UseCurrent		AS LOGIC
	/// A code block defining the while condition to use for the creation of the order.  An empty value indicates that no while condition is being imposed.
	PUBLIC WhileBlock		AS ICodeblock
	/// A string defining the for while condition to use for the creation and maintenance of the order.
	PUBLIC WhileExpression	AS STRING

    METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:WhileBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:WhileExpression)
            SELF:WhileBlock := oRDD:Compile(SELF:WhileExpression)
        ENDIF
        IF SELF:ForBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:ForExpression)
            SELF:ForBlock := oRDD:Compile(SELF:ForExpression)
        ENDIF
    METHOD Validate() AS VOID
        SELF:Active := FALSE
        SELF:Scoped := FALSE
        IF SELF:All .OR. SELF:ForBlock != NULL .OR. SELF:WhileBlock != NULL .OR.  ! String.IsNullOrEmpty(SELF:ForExpression ) ;
            .OR. SELF:NextCount != 0 .OR. SELF:RecNo != 0 .OR. SELF:Rest  .OR. SELF:Descending .OR. ! String.IsNullOrEmpty(SELF:WhileExpression)
            SELF:Active := TRUE
        ENDIF
        IF SELF:EvalBlock != NULL .AND. SELF:StepSize == 0
            SELF:StepSize := 1
        ENDIF
        IF SELF:Active
            IF SELF:All .OR. SELF:WhileBlock != NULL .OR. SELF:NextCount != 0 .OR. SELF:RecNo != 0 .OR. SELF:Rest
                SELF:Scoped := TRUE
            ENDIF
        ENDIF

    METHOD Clone() AS DbOrderCondInfo
        RETURN (DbOrderCondInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store information needed to create a new order.
CLASS DbOrderCreateInfo
	/// The index file name.
	PUBLIC BagName		AS STRING
	/// The order name or number to create in BagName.
	PUBLIC Order		AS OBJECT
	/// The key expression defining the order.
	PUBLIC Expression	AS STRING
	/// A flag that is TRUE if the order should contain only unique keys.
	PUBLIC Unique		AS LOGIC
	/// A code block containing the key expression defining the order imposed on the work area.
	PUBLIC Block		AS ICodeblock
	/// A DbOrderCondInfo object containing information about the condition (if any) for the order.
	PUBLIC OrdCondInfo	AS DbOrderCondInfo

    METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:Block == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:Expression)
            SELF:Block := oRDD:Compile(SELF:Expression)
        ENDIF
        IF SELF:OrdCondInfo != NULL
            SELF:OrdCondInfo:Compile(oRDD)
        ENDIF

   METHOD Clone() AS DbOrderCreateInfo
        RETURN (DbOrderCreateInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store information needed to open/address an order.
CLASS DbOrderInfo
	/// A flag that is TRUE if all tags of the index file must be opened.
	PUBLIC AllTags		AS LOGIC
	/// A code block containing the key expression defining the order imposed on the work area.
	PUBLIC Expression	AS ICodeblock
	/// An object containing the order name or number
	PUBLIC Order		AS OBJECT
	/// The index file name.
	PUBLIC BagName		AS STRING
	/// Return value for some order operations.
	PUBLIC Result		AS OBJECT

    METHOD Clone() AS DbOrderInfo
        RETURN (DbOrderInfo) SELF:MemberwiseClone()
    PROPERTY IsEmpty AS LOGIC
        GET
            IF Order == NULL
                RETURN String.IsNullOrEmpty(BagName)
            ENDIF
            IF Order IS LONG .AND. (LONG) Order = 0
                RETURN String.IsNullOrEmpty(BagName)
            ENDIF
            RETURN FALSE
        END GET
    END PROPERTY
END CLASS

/// Helper class to store a list of relational information.
CLASS DbRelInfo
	/// The expression used to reposition the cursor of the child table when this relation is resolved.
	PUBLIC Key			AS STRING
	/// A code block used to reposition the cursor of the child table when this relation is resolved.
	PUBLIC Block		AS ICodeblock
	/// A reference to the child RDD for the relation.
	PUBLIC Child		AS IRDD
	/// A reference to the parent RDD for the relation.
	PUBLIC Parent		AS IRDD

    /// name of the relation. Defaults to the parent alias = '_' + child alias.
	PUBLIC Name         AS STRING
    METHOD Compile() AS VOID
        IF SELF:Block == NULL .AND. SELF:Parent != NULL .AND. ! String.IsNullOrWhiteSpace(SELF:Key)
            SELF:Block := SELF:Parent:Compile(SELF:Key)
        ENDIF

    METHOD Clone() AS DbRelInfo
        RETURN (DbRelInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store references to all of the scope clause expressions.
CLASS DbScopeInfo
	/// A flag that is TRUE if a process should ignore duplicate key values.
	PUBLIC IgnoreDuplicates AS LOGIC
	/// A flag that is TRUE if a process should ignore any filter condition imposed on the current work area.
	PUBLIC IgnoreFilter		AS LOGIC
	///  A flag that is TRUE if a process should include deleted rows.
	PUBLIC IncludeDeleted	AS LOGIC
	/// A code block representing the conditional for clause.  A for condition is, essentially, a filter that hides rows for which the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC ForBlock			AS ICodeblock
	/// A string representing the conditional for clause.  A for condition is, essentially, a filter that hides rows for which the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC ForExpression	AS STRING
	/// A flag that is TRUE if the last row of the current scope is required.
	PUBLIC Last				AS LOGIC
	/// Permits continuation of a process for the next lNext rows, while obeying for and while clauses.
	PUBLIC NextCount		AS LONG
	/// Permits continuation of a process for a single row number, while obeying for and while clauses.
	PUBLIC RecId			AS OBJECT
	/// A flag that is TRUE if a process should continue stepping through data from the current work area cursor position until logical end-of-file.
	PUBLIC Rest				AS LOGIC
	/// A code block representing the conditional while clause.  A while condition permits continuation of a process that steps through rows until the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC WhileBlock		AS ICodeblock
	/// A string representing the conditional while clause.  A while condition permits continuation of a process that steps through rows until the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC WhileExpression	AS STRING
	/// Construct a DbScopeInfo object.
	CONSTRUCTOR()
		SELF:Clear()

	///Clear the scope fields.
	PUBLIC METHOD Clear() AS VOID
		IgnoreDuplicates := FALSE
		IgnoreFilter	 := FALSE
		IncludeDeleted 	 := FALSE
		ForBlock		 := NULL
		ForExpression	 := NULL
		Last			 := FALSE
		NextCount		 := 0
		RecId			 := NULL
		Rest			 := FALSE
		WhileBlock		 := NULL
		WhileExpression  := NULL

	///Clone the scopeinfo object.
	METHOD Clone AS DbScopeInfo
		RETURN (DbScopeInfo) SELF:MemberwiseClone()

	METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:WhileBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:WhileExpression)
            SELF:WhileBlock := oRDD:Compile(SELF:WhileExpression)
        ENDIF
        IF SELF:ForBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:ForExpression)
            SELF:ForBlock := oRDD:Compile(SELF:ForExpression)
        ENDIF
END CLASS

/// Helper structure to store information needed to perform a seek operation
STRUCTURE DbSeekInfo
	/// A flag that is TRUE if the last occurrence of the specified key value is to be sought, rather than the first.
	PUBLIC Last 	AS LOGIC
	/// A flag that is TRUE if a soft seek is to be performed.
	PUBLIC SoftSeek AS LOGIC
	/// An object containing the key value to find.
	PUBLIC Value AS OBJECT
END STRUCTURE

/// Helper class to store information needed to perform a physical sort.
CLASS DbSortInfo
	/// A DbTransInfo object holding the destination work area, column transfer information, and scoping information for the Sort() method.
	PUBLIC TransInfo  AS DbTransInfo
	/// An array of DbSortItem structures defining the key values for the sort.  Note that the key values are processed in the order that they appear in this array.
	PUBLIC Items	  AS DbSortItem[]
	/// Number of items in the Items array.
    PROPERTY ItemCount  AS LONG GET Items:Length
    /// Construct a DbSortInfo object.
    CONSTRUCTOR(transItemCount AS LONG, sortItemCount AS LONG)
        SELF:TransInfo := DbTransInfo{transItemCount}
        SELF:Items     := DbSortItem[]{sortItemCount}
        RETURN
END CLASS

/// Helper structure to store information about a single sort key value.
STRUCTURE DbSortItem
	/// A one-based index indicating the column on which the sort is based.
	PUBLIC FieldNo 	AS LONG
	/// The offset of the field in the workarea buffer.
	PUBLIC OffSet	AS LONG
	/// The length of the field in the workarea buffer.
	PUBLIC Length	AS LONG
	/// One or more constants that function as sort optimization and control flags.
    /// They are passed to your RDD Sort() routine from the high-level wrapper function for the DBSort() function.
	PUBLIC Flags	AS  DbSortFlags

END STRUCTURE

/// Helper class to store information needed for the global transfer of data items from one work area to another.
CLASS DbTransInfo
	/// A DbScopeInfo object describing the limits of the scope of the transfer.
	PUBLIC Scope		AS DbScopeInfo
	/// The source work area.
	PUBLIC Source		AS IRDD
	/// The destination work area.
	PUBLIC Destination 	AS IRDD
	/// An array of DbTransItem structures defining the items to transfer to the destination work area. This is usually a list of column mappings from the source to the destination.
	PUBLIC Items		AS DbTransItem[]
	/// Transfer attributes specified using one or more of the constants Match or PutRec.
	PUBLIC Flags		AS DbTransInfoFlags
    /// Number of items in the Items array.
    PUBLIC PROPERTY ItemCount AS LONG AUTO
    /// Construct a DbTransInfo object.
    CONSTRUCTOR(itemCount AS LONG)
        SELF:Items := DbTransItem[]{itemCount}
        SELF:Scope := DbScopeInfo{}
        SELF:ItemCount := itemCount
        SELF:Flags := DbTransInfoFlags.None
END CLASS

/// Helper structure to store information about a single piece of data (usually a column) to transfer from one work area to another.
STRUCTURE DbTransItem
	/// A one-based field index in the source work area.
	PUBLIC Source 		AS LONG
	/// A one-based field index in the destination work area.
	PUBLIC Destination 	AS LONG
END STRUCTURE

/// Helper class for the RDD system to store field information
CLASS RddFieldInfo
	PUBLIC Name 		AS STRING
	PUBLIC FieldType 	AS DBFieldType
	PUBLIC Length 		AS LONG
	PUBLIC Decimals 	AS LONG
	PUBLIC Alias 		AS STRING
    	PUBLIC Flags        AS DbfFieldFlags
	PUBLIC Offset       AS LONG

     /// Construct a RddFieldInfo object.
	CONSTRUCTOR(sName AS STRING, sType AS STRING, nLength AS LONG, nDecimals AS LONG, nOffSet := -1 AS LONG)
		Name 		:= sName
		Length 		:= nLength
		Decimals 	:= nDecimals
        	Flags       := DbfFieldFlags.None
		IF !String.IsNullOrEmpty(sType)
			FieldType := (DbFieldType) Char.ToUpper(sType[0])
			IF sType:IndexOf("0",1) >= 0
			    Flags |= DbfFieldFlags.Nullable
			ENDIF
			IF FieldType:IsBinary() .OR. sType:IndexOf("B", 1) >= 0
			    Flags |= DbfFieldFlags.Binary
			ENDIF
            IF sType:Contains('+')
                Flags |= DbfFieldFlags.AutoIncrement
            ENDIF
		ELSE
			FieldType := DBFieldType.Unknown
		ENDIF
		IF String.Compare(Name, _NULLFLAGS, TRUE) == 0
		    Flags |= DbfFieldFlags.System
		    Flags |= DbfFieldFlags.Binary
		ENDIF
		Alias       := sName
		SELF:Offset := nOffSet
		RETURN
    /// Construct a RddFieldInfo object.
	CONSTRUCTOR(sName AS STRING, nType AS DbFieldType, nLength AS LONG, nDecimals AS LONG, nOffSet := -1 AS LONG, nFlags := DbfFieldFlags.None AS DbfFieldFlags)
		SELF:Name 		:= sName
		SELF:FieldType 	:= nType
		SELF:Length 	:= nLength
		SELF:Decimals 	:= nDecimals
		SELF:Alias      := sName
		SELF:Offset     := nOffSet
        	SELF:Flags      := nFLags
		RETURN

    CONSTRUCTOR(oInfo AS RddFieldInfo)
 		SELF:Name 		:= oInfo:Name
		SELF:FieldType 	:= oInfo:FieldType
		SELF:Length 	:= oInfo:Length
		SELF:Alias      := oInfo:Alias
		SELF:Flags      := oInfo:Flags
		SELF:OffSet     := oInfo:OffSet
        IF SELF:FieldType:HasDecimals()  .OR. SELF:FieldType == DbFieldType.Character  // Support for char fields > 255 characters
        	SELF:Decimals 	:= oInfo:Decimals
        ENDIF

    /// Clone a RddFieldInfo object.
	METHOD Clone() AS RddFieldInfo
        VAR info := (RddFieldInfo) SELF:MemberwiseClone()
        RETURN info

    /// Check if two fields match in type, length and decimals.
    METHOD SameType(oFld AS RDDFieldInfo) AS LOGIC
        RETURN SELF:FieldType == oFld:FieldType .AND. SELF:Length == oFld:Length .AND. SELF:Decimals == oFld:Decimals

    VIRTUAL METHOD Validate() AS LOGIC
        RETURN TRUE

    OVERRIDE METHOD ToString() AS STRING
        RETURN SELF:Name+" ('"+SELF:FieldTypeStr+"',"+SELF:Length:ToString()+","+SELF:Decimals:ToString()+","+SELF:Flags:ToString()+")"

    PROPERTY FieldTypeStr AS STRING GET ((CHAR) SELF:FieldType):ToString()
    PROPERTY IsMemo      AS LOGIC GET SELF:FieldType:IsMemo()
    PROPERTY IsBinary    AS LOGIC GET SELF:FieldType:IsBinary()
    PROPERTY IsNullable  AS LOGIC GET SELF:Flags:HasFlag(DbfFieldFlags.Nullable)
    PROPERTY IsAutoIncrement AS LOGIC GET SELF:Flags:HasFLag(DbfFieldFlags.AutoIncrement)
    PROPERTY IsStandard  AS LOGIC GET SELF:FieldType:IsStandard()
    PROPERTY IsVfp       AS LOGIC GET SELF:FieldType:IsVfp()
    PROPERTY IsVarLength AS LOGIC GET SELF:FieldType:IsVarLength()

END CLASS

STATIC CLASS RDDExtensions
    STATIC METHOD IsMemo(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Memo
        CASE DbFieldType.Picture
        CASE DbFieldType.General
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsVarLength(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsStandard(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.Character
        CASE DbFieldType.Date
        CASE DbFieldType.Logic
        CASE DbFieldType.Memo
        CASE DbFieldType.Number
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsBinary(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Integer
        CASE DbFieldType.Currency
        CASE DbFieldType.Double
        CASE DbFieldType.Picture
        CASE DbFieldType.Blob
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
        CASE DbFieldType.DateTime
            RETURN TRUE
        END SWITCH
        RETURN FALSE
    STATIC METHOD HasDecimals(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.Double
        CASE DbFieldType.Float
        CASE DBFieldType.Number
            RETURN TRUE
        END SWITCH
        RETURN FALSE
    STATIC METHOD IsVfp(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Character
        CASE DbFieldType.Blob
        CASE DbFieldType.Currency
        CASE DBFieldType.Date
        CASE DBFieldType.DateTime
        CASE DbFieldType.Double
        CASE DbFieldType.Float
        CASE DbFieldType.General
        CASE DBFieldType.Integer
        CASE DBFieldType.Logic
        CASE DBFieldType.Memo
        CASE DBFieldType.Number
        CASE DbFieldType.Picture
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
        CASE DbFieldType.NullFlags
            RETURN TRUE
        END SWITCH
        RETURN FALSE
END CLASS
END NAMESPACE

BEGIN NAMESPACE XSharp

/// Helper class for VoDbTrans and VoDbSort()
CLASS _FieldNames
    /// List of field names.
    PUBLIC fields AS STRING[]
    /// Number of fields in the list.
    PROPERTY fieldCount AS LONG GET fields:Length
    /// Construct a _FieldNames object.
    CONSTRUCTOR (aFields AS IList<STRING>)
        SELF:Fields := aFields:ToArray()
        RETURN
END CLASS

/// Helper class for DbJoin()
CLASS _JoinList
    /// Area number of destination workarea.
    PUBLIC uiDestSel AS DWORD
    /// List of field areas and positions.
    PUBLIC Fields AS _JoinField[]
    /// Number of fields in the list.
    PUBLIC PROPERTY Count AS LONG GET Fields:Length
    /// Construct a _JoinList object.
    PUBLIC CONSTRUCTOR(nFields AS LONG)
        SELF:Fields := _JoinField[]{nFields}
        RETURN
END CLASS

/// Helper structure for DbJoin()
STRUCTURE _JoinField
    /// Source workarea number.
    PUBLIC Area AS DWORD
    /// Source field position.
    PUBLIC Pos  AS DWORD
END STRUCTURE

/// Helper structure to store information for a list of RDD names for DbUseArea()
STRUCTURE _RddList
    /// List of RDD names.
    EXPORT atomRddName AS STRING[]
    /// Number of names in the list.
    PROPERTY uiRDDCount AS DWORD GET (DWORD) atomRDDName:Length

    /// Construct _RddList from class Tree.
    CONSTRUCTOR(oRDD AS WorkArea)
        VAR names := List<STRING>{}
        VAR type  := oRDD:GetType()
        DO WHILE type != typeof(WorkArea)
            VAR name := type:Name:ToUpper()
            // map names to VO compatible names
            IF name == "DBF"
                names:Add("CAVODBF")
            ELSE
                names:Add(name)
            ENDIF
            type := type:BaseType
        ENDDO
        names:Reverse()
        atomRDDName := names:ToArray()
    /// Construct _RddList from list of names.
    CONSTRUCTOR(aNames AS STRING[])
        atomRDDName := aNames
        RETURN

END STRUCTURE
END NAMESPACE

//
// 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.IO
USING XSharp.RDD.Enums
USING System.Collections.Generic
USING System.Linq
USING XSharp.RDD
// The classes below are simple. No properties, but all public fields.

BEGIN NAMESPACE XSharp.RDD.Support

/// Helper class to store the scope and codeblock for a DbEval() operation.
CLASS DbEvalInfo

	/// A code block to be evaluated with DbEval() on each row of the work area that is in the range defined by ScopeInfo.
	PUBLIC Block	 AS ICodeblock

	/// A DbScopeInfo structure limiting the evaluation of Block.
	PUBLIC ScopeInfo AS DbScopeInfo
    /// Construct a DbEvalInfo object.
    CONSTRUCTOR()
        SELF:ScopeInfo := DbScopeInfo{}
        RETURN
END CLASS

/// Helper class to store a filter condition for a table.
CLASS DbFilterInfo
	/// A string representing the source code for itmCobExpr.
	PUBLIC FilterText	AS STRING

	/// A code block representing the condition that is evaluated at each cursor location.  If the result of the evaluation is FALSE, the cursor location requested is invalid according to the current filter condition.
	PUBLIC FilterBlock	AS ICodeblock

	/// A flag that is TRUE if a filter is active.
	PUBLIC Active		AS LOGIC

	/// A flag that is TRUE if a filter is optimized.
	PUBLIC Optimized	AS LOGIC

	///Clear the filter fields.
	METHOD Clear() AS VOID
		SELF:FilterBlock := NULL
		SELF:FilterText	 := NULL
		SELF:Active		 := FALSE
		SELF:Optimized	 := FALSE
		RETURN

	///Clone the filter object.
	METHOD Clone AS DbFilterInfo
		LOCAL oCLone AS DbFilterInfo
		oCLone := DbFilterInfo{}
		oCLone:FilterBlock := SELF:FilterBlock
		oClone:FilterText  := SELF:FilterText
		oClone:Optimized   := SELF:Optimized
		oClone:Active	   := FALSE
		RETURN oClone

    /// Construct a DbFilterInfo object.
    CONSTRUCTOR
        SELF:Clear()
        RETURN

	METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:FilterBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:FilterText)
            SELF:FilterBlock := oRDD:Compile(SELF:FilterText)
        ENDIF
END CLASS

/// Helper structure to store information needed to lock a row or table for exclusive access.
STRUCTURE DbLockInfo
	/// An Item indicating the ID of the row to lock.  This member is meaningful only if Method is set to EXCLUSIVE or MULTIPLE.
	PUBLIC RecId		AS OBJECT

	/// A constant indicating the type of lock to obtain.  The possible values are of the Lockmethod enum.
	PUBLIC @@Method AS LockMethod

	/// A flag that is TRUE if the lock operation was successful.
	PUBLIC Result		AS LOGIC
	/// List of possible Locking Methods
	ENUM LockMethod
		/// Lock a row, releasing currently locked rows.
		MEMBER Exclusive := 1
		/// Lock a row, maintaining currently locked rows.
		MEMBER Multiple  := 2
		/// Lock a table, releasing locks currently held.
		MEMBER File 	 := 3
	END ENUM
END STRUCTURE

/// Helper class to store information needed to open a table.
CLASS DbOpenInfo
	/// Should the table be opened Readonly?
	PUBLIC ReadOnly 	AS LOGIC
	/// Should the table be opened Shared?
	PUBLIC Shared		AS LOGIC
	/// Unique Alias that the table has. This must be a valid XBase Identifier
	PUBLIC Alias		AS STRING
	/// The extension for the table that must be opened.
	PUBLIC Extension    AS STRING
	/// The filename (optionally includig a path) for the table that must be opened.
	PUBLIC FileName		AS STRING
	/// Workarea number in which the table will be opened.
	PUBLIC WorkArea		AS DWORD
    /// Construct a DbOpenInfo object.

	CONSTRUCTOR()
        SUPER()
    /// Construct a DbOpenInfo object.
	CONSTRUCTOR(sFileName AS STRING, sAlias AS STRING, dwWorkArea AS DWORD, lShared AS LOGIC, lReadOnly AS LOGIC)
		FileName 	:= sFileName
        Extension   := Path.GetExtension(sFileName)
		IF String.IsNullOrEmpty( sAlias )
			Alias := Path.GetFileNameWithoutExtension( sFileName )
		ELSE
			Alias	 	:= sAlias
		ENDIF
		WorkArea	:= dwWorkArea
		Shared		:= lShared
		ReadOnly	:= lReadOnly
	/// Return the numeric FileMode based on the Shared and Readonly flags
	PUBLIC PROPERTY FileMode AS DWORD
	GET
		LOCAL nMode AS DWORD
		nMode := FO_COMPAT
		IF (Shared)
			nMode |= FO_SHARED
		ELSE
			nMode |= FO_EXCLUSIVE
		ENDIF
		IF (ReadOnly)
			nMode |= FO_READ
		ELSE
			nMode |= FO_READWRITE
		ENDIF
		RETURN nMode
	END GET
	END PROPERTY
    PUBLIC METHOD Clone() AS DbOpenInfo
        RETURN (DbOpenInfo) SELF:MemberwiseClone()
END CLASS

/// Helper class to store information needed to create a conditional order.
CLASS DbOrderCondInfo
	///  A flag that is TRUE if one or more valid conditions have been specified in the structure.
	PUBLIC Active			AS LOGIC
	///  A flag that is TRUE if open orders should remain open while the new order is being created.
	PUBLIC Additive			AS LOGIC
	///  A flag that is TRUE if all rows are to be processed during order creation.
	PUBLIC All				AS LOGIC
	/// A flag that is TRUE if the new order will be a custom built order.
	PUBLIC Custom			AS LOGIC
	///  A flag that is TRUE if the order should be created in descending order.
	PUBLIC DESCENDING 	AS LOGIC
	/// A code block defining the expression to evaluate every StepSize rows during the creation of the order.  The code block referenced should return a logical value: TRUE indicates that creation of the order should continue normally, and FALSE indicates that order creation should terminate.
	PUBLIC EvalBlock		AS ICodeblock
	/// A code block defining the for condition to use for the creation and maintenance of the order.
	PUBLIC ForBlock			AS ICodeblock
	/// A string defining the for condition to use for the creation and maintenance of the order.
	PUBLIC ForExpression	AS STRING
	/// The number of rows to process for order creation.
	PUBLIC NextCount		AS LONG
	/// A flag that is TRUE if the for condition may NOT be optimized,
	PUBLIC NoOptimize		AS LOGIC
	///  A single row number to include in the order.
	PUBLIC RecNo			AS LONG
	/// A flag that is TRUE if only the rows specified by lStartRecno through end-of-file are to be included in the order.
	PUBLIC Rest				AS LOGIC
	/// A flag indicating whether the order is to be scoped. fScoped will be TRUE if WhileBlock, NextCount, Recno, Rest, or All is specified.
	PUBLIC Scoped			AS LOGIC
	/// The row at which to begin processing when either the NextCount or Rest scoping options are specified.
	PUBLIC StartRecNo		AS LONG
	/// The frequency of the evaluation of EvalBlock.
	PUBLIC StepSize			AS LONG
	/// A flag that is TRUE if only rows in the controlling order are to be included in the order.
	PUBLIC UseCurrent		AS LOGIC
	/// A code block defining the while condition to use for the creation of the order.  An empty value indicates that no while condition is being imposed.
	PUBLIC WhileBlock		AS ICodeblock
	/// A string defining the for while condition to use for the creation and maintenance of the order.
	PUBLIC WhileExpression	AS STRING

    METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:WhileBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:WhileExpression)
            SELF:WhileBlock := oRDD:Compile(SELF:WhileExpression)
        ENDIF
        IF SELF:ForBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:ForExpression)
            SELF:ForBlock := oRDD:Compile(SELF:ForExpression)
        ENDIF
    METHOD Validate() AS VOID
        SELF:Active := FALSE
        SELF:Scoped := FALSE
        IF SELF:All .OR. SELF:ForBlock != NULL .OR. SELF:WhileBlock != NULL .OR.  ! String.IsNullOrEmpty(SELF:ForExpression ) ;
            .OR. SELF:NextCount != 0 .OR. SELF:RecNo != 0 .OR. SELF:Rest  .OR. SELF:Descending .OR. ! String.IsNullOrEmpty(SELF:WhileExpression)
            SELF:Active := TRUE
        ENDIF
        IF SELF:EvalBlock != NULL .AND. SELF:StepSize == 0
            SELF:StepSize := 1
        ENDIF
        IF SELF:Active
            IF SELF:All .OR. SELF:WhileBlock != NULL .OR. SELF:NextCount != 0 .OR. SELF:RecNo != 0 .OR. SELF:Rest
                SELF:Scoped := TRUE
            ENDIF
        ENDIF

    METHOD Clone() AS DbOrderCondInfo
        RETURN (DbOrderCondInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store information needed to create a new order.
CLASS DbOrderCreateInfo
	/// The index file name.
	PUBLIC BagName		AS STRING
	/// The order name or number to create in BagName.
	PUBLIC Order		AS OBJECT
	/// The key expression defining the order.
	PUBLIC Expression	AS STRING
	/// A flag that is TRUE if the order should contain only unique keys.
	PUBLIC Unique		AS LOGIC
	/// A code block containing the key expression defining the order imposed on the work area.
	PUBLIC Block		AS ICodeblock
	/// A DbOrderCondInfo object containing information about the condition (if any) for the order.
	PUBLIC OrdCondInfo	AS DbOrderCondInfo

    METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:Block == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:Expression)
            SELF:Block := oRDD:Compile(SELF:Expression)
        ENDIF
        IF SELF:OrdCondInfo != NULL
            SELF:OrdCondInfo:Compile(oRDD)
        ENDIF

   METHOD Clone() AS DbOrderCreateInfo
        RETURN (DbOrderCreateInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store information needed to open/address an order.
CLASS DbOrderInfo
	/// A flag that is TRUE if all tags of the index file must be opened.
	PUBLIC AllTags		AS LOGIC
	/// A code block containing the key expression defining the order imposed on the work area.
	PUBLIC Expression	AS ICodeblock
	/// An object containing the order name or number
	PUBLIC Order		AS OBJECT
	/// The index file name.
	PUBLIC BagName		AS STRING
	/// Return value for some order operations.
	PUBLIC Result		AS OBJECT

    METHOD Clone() AS DbOrderInfo
        RETURN (DbOrderInfo) SELF:MemberwiseClone()
    PROPERTY IsEmpty AS LOGIC
        GET
            IF Order == NULL
                RETURN String.IsNullOrEmpty(BagName)
            ENDIF
            IF Order IS LONG .AND. (LONG) Order = 0
                RETURN String.IsNullOrEmpty(BagName)
            ENDIF
            RETURN FALSE
        END GET
    END PROPERTY
END CLASS

/// Helper class to store a list of relational information.
CLASS DbRelInfo
	/// The expression used to reposition the cursor of the child table when this relation is resolved.
	PUBLIC Key			AS STRING
	/// A code block used to reposition the cursor of the child table when this relation is resolved.
	PUBLIC Block		AS ICodeblock
	/// A reference to the child RDD for the relation.
	PUBLIC Child		AS IRDD
	/// A reference to the parent RDD for the relation.
	PUBLIC Parent		AS IRDD

    /// name of the relation. Defaults to the parent alias = '_' + child alias.
	PUBLIC Name         AS STRING
    METHOD Compile() AS VOID
        IF SELF:Block == NULL .AND. SELF:Parent != NULL .AND. ! String.IsNullOrWhiteSpace(SELF:Key)
            SELF:Block := SELF:Parent:Compile(SELF:Key)
        ENDIF

    METHOD Clone() AS DbRelInfo
        RETURN (DbRelInfo) SELF:MemberwiseClone()

END CLASS

/// Helper class to store references to all of the scope clause expressions.
CLASS DbScopeInfo
	/// A flag that is TRUE if a process should ignore duplicate key values.
	PUBLIC IgnoreDuplicates AS LOGIC
	/// A flag that is TRUE if a process should ignore any filter condition imposed on the current work area.
	PUBLIC IgnoreFilter		AS LOGIC
	///  A flag that is TRUE if a process should include deleted rows.
	PUBLIC IncludeDeleted	AS LOGIC
	/// A code block representing the conditional for clause.  A for condition is, essentially, a filter that hides rows for which the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC ForBlock			AS ICodeblock
	/// A string representing the conditional for clause.  A for condition is, essentially, a filter that hides rows for which the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC ForExpression	AS STRING
	/// A flag that is TRUE if the last row of the current scope is required.
	PUBLIC Last				AS LOGIC
	/// Permits continuation of a process for the next lNext rows, while obeying for and while clauses.
	PUBLIC NextCount		AS LONG
	/// Permits continuation of a process for a single row number, while obeying for and while clauses.
	PUBLIC RecId			AS OBJECT
	/// A flag that is TRUE if a process should continue stepping through data from the current work area cursor position until logical end-of-file.
	PUBLIC Rest				AS LOGIC
	/// A code block representing the conditional while clause.  A while condition permits continuation of a process that steps through rows until the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC WhileBlock		AS ICodeblock
	/// A string representing the conditional while clause.  A while condition permits continuation of a process that steps through rows until the condition evaluates to FALSE.  The string value is provided for storage, while the code block is provided as a parameter for the EvalBlock() method.
	PUBLIC WhileExpression	AS STRING
	/// Construct a DbScopeInfo object.
	CONSTRUCTOR()
		SELF:Clear()

	///Clear the scope fields.
	PUBLIC METHOD Clear() AS VOID
		IgnoreDuplicates := FALSE
		IgnoreFilter	 := FALSE
		IncludeDeleted 	 := FALSE
		ForBlock		 := NULL
		ForExpression	 := NULL
		Last			 := FALSE
		NextCount		 := 0
		RecId			 := NULL
		Rest			 := FALSE
		WhileBlock		 := NULL
		WhileExpression  := NULL

	///Clone the scopeinfo object.
	METHOD Clone AS DbScopeInfo
		RETURN (DbScopeInfo) SELF:MemberwiseClone()

	METHOD Compile(oRDD AS IRDD) AS VOID
        IF SELF:WhileBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:WhileExpression)
            SELF:WhileBlock := oRDD:Compile(SELF:WhileExpression)
        ENDIF
        IF SELF:ForBlock == NULL .AND. ! String.IsNullOrWhiteSpace(SELF:ForExpression)
            SELF:ForBlock := oRDD:Compile(SELF:ForExpression)
        ENDIF
END CLASS

/// Helper structure to store information needed to perform a seek operation
STRUCTURE DbSeekInfo
	/// A flag that is TRUE if the last occurrence of the specified key value is to be sought, rather than the first.
	PUBLIC Last 	AS LOGIC
	/// A flag that is TRUE if a soft seek is to be performed.
	PUBLIC SoftSeek AS LOGIC
	/// An object containing the key value to find.
	PUBLIC Value AS OBJECT
END STRUCTURE

/// Helper class to store information needed to perform a physical sort.
CLASS DbSortInfo
	/// A DbTransInfo object holding the destination work area, column transfer information, and scoping information for the Sort() method.
	PUBLIC TransInfo  AS DbTransInfo
	/// An array of DbSortItem structures defining the key values for the sort.  Note that the key values are processed in the order that they appear in this array.
	PUBLIC Items	  AS DbSortItem[]
	/// Number of items in the Items array.
    PROPERTY ItemCount  AS LONG GET Items:Length
    /// Construct a DbSortInfo object.
    CONSTRUCTOR(transItemCount AS LONG, sortItemCount AS LONG)
        SELF:TransInfo := DbTransInfo{transItemCount}
        SELF:Items     := DbSortItem[]{sortItemCount}
        RETURN
END CLASS

/// Helper structure to store information about a single sort key value.
STRUCTURE DbSortItem
	/// A one-based index indicating the column on which the sort is based.
	PUBLIC FieldNo 	AS LONG
	/// The offset of the field in the workarea buffer.
	PUBLIC OffSet	AS LONG
	/// The length of the field in the workarea buffer.
	PUBLIC Length	AS LONG
	/// One or more constants that function as sort optimization and control flags.
    /// They are passed to your RDD Sort() routine from the high-level wrapper function for the DBSort() function.
	PUBLIC Flags	AS  DbSortFlags

END STRUCTURE

/// Helper class to store information needed for the global transfer of data items from one work area to another.
CLASS DbTransInfo
	/// A DbScopeInfo object describing the limits of the scope of the transfer.
	PUBLIC Scope		AS DbScopeInfo
	/// The source work area.
	PUBLIC Source		AS IRDD
	/// The destination work area.
	PUBLIC Destination 	AS IRDD
	/// An array of DbTransItem structures defining the items to transfer to the destination work area. This is usually a list of column mappings from the source to the destination.
	PUBLIC Items		AS DbTransItem[]
	/// Transfer attributes specified using one or more of the constants Match or PutRec.
	PUBLIC Flags		AS DbTransInfoFlags
    /// Number of items in the Items array.
    PUBLIC PROPERTY ItemCount AS LONG AUTO
    /// Construct a DbTransInfo object.
    CONSTRUCTOR(itemCount AS LONG)
        SELF:Items := DbTransItem[]{itemCount}
        SELF:Scope := DbScopeInfo{}
        SELF:ItemCount := itemCount
        SELF:Flags := DbTransInfoFlags.None
END CLASS

/// Helper structure to store information about a single piece of data (usually a column) to transfer from one work area to another.
STRUCTURE DbTransItem
	/// A one-based field index in the source work area.
	PUBLIC Source 		AS LONG
	/// A one-based field index in the destination work area.
	PUBLIC Destination 	AS LONG
END STRUCTURE

/// Helper class for the RDD system to store field information
CLASS RddFieldInfo
	PUBLIC Name 		AS STRING
	PUBLIC FieldType 	AS DBFieldType
	PUBLIC Length 		AS LONG
	PUBLIC Decimals 	AS LONG
	PUBLIC Alias 		AS STRING
    	PUBLIC Flags        AS DbfFieldFlags
	PUBLIC Offset       AS LONG

     /// Construct a RddFieldInfo object.
	CONSTRUCTOR(sName AS STRING, sType AS STRING, nLength AS LONG, nDecimals AS LONG, nOffSet := -1 AS LONG)
		Name 		:= sName
		Length 		:= nLength
		Decimals 	:= nDecimals
        	Flags       := DbfFieldFlags.None
		IF !String.IsNullOrEmpty(sType)
			FieldType := (DbFieldType) Char.ToUpper(sType[0])
			IF sType:IndexOf("0",1) >= 0
			    Flags |= DbfFieldFlags.Nullable
			ENDIF
			IF FieldType:IsBinary() .OR. sType:IndexOf("B", 1) >= 0
			    Flags |= DbfFieldFlags.Binary
			ENDIF
            IF sType:Contains('+')
                Flags |= DbfFieldFlags.AutoIncrement
            ENDIF
		ELSE
			FieldType := DBFieldType.Unknown
		ENDIF
		IF String.Compare(Name, _NULLFLAGS, TRUE) == 0
		    Flags |= DbfFieldFlags.System
		    Flags |= DbfFieldFlags.Binary
		ENDIF
		Alias       := sName
		SELF:Offset := nOffSet
		RETURN
    /// Construct a RddFieldInfo object.
	CONSTRUCTOR(sName AS STRING, nType AS DbFieldType, nLength AS LONG, nDecimals AS LONG, nOffSet := -1 AS LONG, nFlags := DbfFieldFlags.None AS DbfFieldFlags)
		SELF:Name 		:= sName
		SELF:FieldType 	:= nType
		SELF:Length 	:= nLength
		SELF:Decimals 	:= nDecimals
		SELF:Alias      := sName
		SELF:Offset     := nOffSet
        	SELF:Flags      := nFLags
		RETURN

    CONSTRUCTOR(oInfo AS RddFieldInfo)
 		SELF:Name 		:= oInfo:Name
		SELF:FieldType 	:= oInfo:FieldType
		SELF:Length 	:= oInfo:Length
		SELF:Alias      := oInfo:Alias
		SELF:Flags      := oInfo:Flags
		SELF:OffSet     := oInfo:OffSet
        IF SELF:FieldType:HasDecimals()
        	SELF:Decimals 	:= oInfo:Decimals
        ENDIF

    /// Clone a RddFieldInfo object.
	METHOD Clone() AS RddFieldInfo
        VAR info := (RddFieldInfo) SELF:MemberwiseClone()
        RETURN info

    /// Check if two fields match in type, length and decimals.
    METHOD SameType(oFld AS RDDFieldInfo) AS LOGIC
        RETURN SELF:FieldType == oFld:FieldType .AND. SELF:Length == oFld:Length .AND. SELF:Decimals == oFld:Decimals

    VIRTUAL METHOD Validate() AS LOGIC
        RETURN TRUE

    OVERRIDE METHOD ToString() AS STRING
        RETURN SELF:Name+" ('"+SELF:FieldTypeStr+"',"+SELF:Length:ToString()+","+SELF:Decimals:ToString()+","+SELF:Flags:ToString()+")"

    PROPERTY FieldTypeStr AS STRING GET ((CHAR) SELF:FieldType):ToString()
    PROPERTY IsMemo      AS LOGIC GET SELF:FieldType:IsMemo()
    PROPERTY IsBinary    AS LOGIC GET SELF:FieldType:IsBinary()
    PROPERTY IsNullable  AS LOGIC GET SELF:Flags:HasFlag(DbfFieldFlags.Nullable)
    PROPERTY IsAutoIncrement AS LOGIC GET SELF:Flags:HasFLag(DbfFieldFlags.AutoIncrement)
    PROPERTY IsStandard  AS LOGIC GET SELF:FieldType:IsStandard()
    PROPERTY IsVfp       AS LOGIC GET SELF:FieldType:IsVfp()
    PROPERTY IsVarLength AS LOGIC GET SELF:FieldType:IsVarLength()

END CLASS

STATIC CLASS RDDExtensions
    STATIC METHOD IsMemo(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Memo
        CASE DbFieldType.Picture
        CASE DbFieldType.General
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsVarLength(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsStandard(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.Character
        CASE DbFieldType.Date
        CASE DbFieldType.Logic
        CASE DbFieldType.Memo
        CASE DbFieldType.Number
            RETURN TRUE
        END SWITCH
        RETURN FALSE

    STATIC METHOD IsBinary(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Integer
        CASE DbFieldType.Currency
        CASE DbFieldType.Double
        CASE DbFieldType.Picture
        CASE DbFieldType.Blob
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
        CASE DbFieldType.DateTime
            RETURN TRUE
        END SWITCH
        RETURN FALSE
    STATIC METHOD HasDecimals(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DbFieldType.Double
        CASE DbFieldType.Float
        CASE DBFieldType.Number
            RETURN TRUE
        END SWITCH
        RETURN FALSE
    STATIC METHOD IsVfp(SELF eType AS DBFieldType ) AS LOGIC
        SWITCH eType
        CASE DBFieldType.Character
        CASE DbFieldType.Blob
        CASE DbFieldType.Currency
        CASE DBFieldType.Date
        CASE DBFieldType.DateTime
        CASE DbFieldType.Double
        CASE DbFieldType.Float
        CASE DbFieldType.General
        CASE DBFieldType.Integer
        CASE DBFieldType.Logic
        CASE DBFieldType.Memo
        CASE DBFieldType.Number
        CASE DbFieldType.Picture
        CASE DbFieldType.VarBinary
        CASE DbFieldType.VarChar
        CASE DbFieldType.NullFlags
            RETURN TRUE
        END SWITCH
        RETURN FALSE
END CLASS
END NAMESPACE

BEGIN NAMESPACE XSharp

/// Helper class for VoDbTrans and VoDbSort()
CLASS _FieldNames
    /// List of field names.
    PUBLIC fields AS STRING[]
    /// Number of fields in the list.
    PROPERTY fieldCount AS LONG GET fields:Length
    /// Construct a _FieldNames object.
    CONSTRUCTOR (aFields AS IList<STRING>)
        SELF:Fields := aFields:ToArray()
        RETURN
END CLASS

/// Helper class for DbJoin()
CLASS _JoinList
    /// Area number of destination workarea.
    PUBLIC uiDestSel AS DWORD
    /// List of field areas and positions.
    PUBLIC Fields AS _JoinField[]
    /// Number of fields in the list.
    PUBLIC PROPERTY Count AS LONG GET Fields:Length
    /// Construct a _JoinList object.
    PUBLIC CONSTRUCTOR(nFields AS LONG)
        SELF:Fields := _JoinField[]{nFields}
        RETURN
END CLASS

/// Helper structure for DbJoin()
STRUCTURE _JoinField
    /// Source workarea number.
    PUBLIC Area AS DWORD
    /// Source field position.
    PUBLIC Pos  AS DWORD
END STRUCTURE

/// Helper structure to store information for a list of RDD names for DbUseArea()
STRUCTURE _RddList
    /// List of RDD names.
    EXPORT atomRddName AS STRING[]
    /// Number of names in the list.
    PROPERTY uiRDDCount AS DWORD GET (DWORD) atomRDDName:Length

    /// Construct _RddList from class Tree.
    CONSTRUCTOR(oRDD AS WorkArea)
        VAR names := List<STRING>{}
        VAR type  := oRDD:GetType()
        DO WHILE type != typeof(WorkArea)
            VAR name := type:Name:ToUpper()
            // map names to VO compatible names
            IF name == "DBF"
                names:Add("CAVODBF")
            ELSE
                names:Add(name)
            ENDIF
            type := type:BaseType
        ENDDO
        names:Reverse()
        atomRDDName := names:ToArray()
    /// Construct _RddList from list of names.
    CONSTRUCTOR(aNames AS STRING[])
        atomRDDName := aNames
        RETURN

END STRUCTURE
END NAMESPACE


[Runtime] A few more missing defines

[Runtime] A few more missing defines

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

//
// subscripts for Directory() array
//
/// Position in Directory() sub-array for fileName (as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_NAME  := 1
/// Position in Directory() sub-array for filesize(as a numeric).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_SIZE  := 2
/// Position in Directory() sub-array for last file write date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_DATE  := 3
/// Position in Directory() sub-array for last file write date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_WRITE_DATE  := 3
/// Position in Directory() sub-array for last file write time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_TIME  := 4
/// Position in Directory() sub-array for last file write time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_WRITE_TIME  := 4
/// Position in Directory() sub-array for file attributes(as a number).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ATTR  := 5
/// Position in Directory() sub-array for Size of extended attributes(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_EA_SIZE := 6
/// Position in Directory() sub-array for creation date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_CREATION_DATE := 7
/// Position in Directory() sub-array for creation time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_CREATION_TIME := 8
/// Position in Directory() sub-array for last access date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ACCESS_DATE := 9
/// Position in Directory() sub-array for last access time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ACCESS_TIME := 10
/// Length of Directory() sub-array.
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_LEN   := 10   // length of

//
// Standard math definitions
//

DEFINE PI      :=    3.14159265358979323846      // Pi
DEFINE PI_2    :=    1.57079632679489661923      // Pi/2  ** NEW !
DEFINE PI_4    :=    0.785398163397448309616     // Pi/4  ** NEW !
DEFINE L2E     :=    1.44269504088896340736      // Log2 ( e)
DEFINE L2T     :=    3.32192809488736234781      // Log2 (10)
DEFINE L10E    :=    0.434294481903251827651     // Log10 (e) ** NEW !
DEFINE LG2     :=    0.301029995663981195226     // Log10( 2)
DEFINE LN2     :=    0.693147180559945309417     // LogE ( 2)
DEFINE LN10    :=    2.30258509299404568402      // LogE ( 10) ** NEW !

DEFINE REAL4_EPSILON := 1.192092896e-07          // smallest such that 1.0+REAL4_EPSILON != 1.0
DEFINE REAL4_MAX     := 3.402823466e+38          // Maximum representable number
DEFINE REAL8_EPSILON := 2.2204460492503131e-016  // smallest such that 1.0+REAL8_EPSILON != 1.0
DEFINE REAL8_MAX     := 1.7976931348623158e+308  // Maximum representable number

DEFINE TICK_FREQUENCY   :=    18.20647  // ticks per second

//
// ASCII character equates
//

DEFINE ASC_BELL   :=     7    // Bell
DEFINE ASC_TAB    :=     9    // Tab
DEFINE ASC_SOFT_CR :=   141      // softCarriageReturn
DEFINE ASC_EOF    :=    26    // EndOfFile
#ifndef CRLF
DEFINE	 CRLF       := e"\r\n"
#endif

DEFINE SE_ABORT := 0
DEFINE SE_IGNORE := 1
DEFINE SE_RETRY := 2
DEFINE SE_CANCEL := 3
DEFINE SE_OK := 4
DEFINE SE_YES := 5
DEFINE SE_NO := 6
DEFINE SE_CLOSE := 7
DEFINE SE_DEFAULT := 0x80000000
DEFINE EC_ALERT := 0
DEFINE EC_IGNORE := 1
DEFINE EC_RETRY := 2
DEFINE EC_BREAK := 3
DEFINE REG_BUFF_SIZE := 64
DEFINE INT_WINDOWS := 1
DEFINE INT_CLIPPER := 0
DEFINE INT_BINARY := 2

DEFINE INTERNET_ERROR_BASE := 12000
DEFINE VOVER_BUILDNUMBER := __VERSION__
DEFINE SUCCESS := 0
DEFINE FAILURE := -1
DEFINE DBOI_LOCK_ALL := 100
DEFINE DBOI_LOCK_FAIL := 101
DEFINE DBOI_HPLOCK_GATE := 102
DEFINE RDD_INFO := 100
DEFINE RDD_INFO_MAX := 114
DEFINE NEW_AREA := 0
DEFINE BUFF_SIZE := 0x00008000
DEFINE MAXFILENAME := 260
DEFINE MAX_EXT_NAME := 5
DEFINE DB_MAXAREAS := 1024
DEFINE MAXDRIVERNAME := 12
DEFINE MAX_KEY_LEN := 256
DEFINE DBF_ANSI := 0x04
DEFINE DBF_VER := 0x03
DEFINE DBF_MEMO := 0x80
DEFINE DBF_DB4MEMO := 0x88
DEFINE DBF_PRODINDEX := 0x01
DEFINE DBF_MEMOS := 0x02
DEFINE DBF_ISDATABASE := 0x04
DEFINE DBF_OLE := 0x80
DEFINE _MAX_DIR := 256
DEFINE _MAX_FNAME := 256
DEFINE _MAX_EXT := 256

DEFINE MAX_INST := 10
DEFINE ASC_BS := 8
DEFINE ASC_LF := 10
DEFINE ASC_FF := 12
DEFINE ASC_CR := 13
DEFINE ASC_ESC := 27
DEFINE ASC_BLANK := 32
DEFINE ASC_0 := 48
DEFINE ASC_1 := 49
DEFINE ASC_9 := 57
DEFINE ASC_A := 65
DEFINE ASC_Z := 90
DEFINE MAX_ALLOC := 65527
DEFINE _MAX_DRIVE := 3

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

//
// subscripts for Directory() array
//
/// Position in Directory() sub-array for fileName (as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_NAME  := 1
/// Position in Directory() sub-array for filesize(as a numeric).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_SIZE  := 2
/// Position in Directory() sub-array for last file write date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_DATE  := 3
/// Position in Directory() sub-array for last file write date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_WRITE_DATE  := 3
/// Position in Directory() sub-array for last file write time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_TIME  := 4
/// Position in Directory() sub-array for last file write time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_WRITE_TIME  := 4
/// Position in Directory() sub-array for file attributes(as a number).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ATTR  := 5
/// Position in Directory() sub-array for Size of extended attributes(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_EA_SIZE := 6
/// Position in Directory() sub-array for creation date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_CREATION_DATE := 7
/// Position in Directory() sub-array for creation time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_CREATION_TIME := 8
/// Position in Directory() sub-array for last access date(as a date).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ACCESS_DATE := 9
/// Position in Directory() sub-array for last access time(as a string).
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_ACCESS_TIME := 10
/// Length of Directory() sub-array.
/// <include file="CoreComments.xml" path="Comments/Directory/*" />
DEFINE F_LEN   := 10   // length of

//
// Standard math definitions
//

DEFINE PI      :=    3.14159265358979323846      // Pi
DEFINE PI_2    :=    1.57079632679489661923      // Pi/2  ** NEW !
DEFINE PI_4    :=    0.785398163397448309616     // Pi/4  ** NEW !
DEFINE L2E     :=    1.44269504088896340736      // Log2 ( e)
DEFINE L2T     :=    3.32192809488736234781      // Log2 (10)
DEFINE L10E    :=    0.434294481903251827651     // Log10 (e) ** NEW !
DEFINE LG2     :=    0.301029995663981195226     // Log10( 2)
DEFINE LN2     :=    0.693147180559945309417     // LogE ( 2)
DEFINE LN10    :=    2.30258509299404568402      // LogE ( 10) ** NEW !

DEFINE REAL4_EPSILON := 1.192092896e-07          // smallest such that 1.0+REAL4_EPSILON != 1.0
DEFINE REAL4_MAX     := 3.402823466e+38          // Maximum representable number
DEFINE REAL8_EPSILON := 2.2204460492503131e-016  // smallest such that 1.0+REAL8_EPSILON != 1.0
DEFINE REAL8_MAX     := 1.7976931348623158e+308  // Maximum representable number

DEFINE TICK_FREQUENCY   :=    18.20647  // ticks per second

//
// ASCII character equates
//

DEFINE ASC_BELL   :=     7    // Bell
DEFINE ASC_TAB    :=     9    // Tab
DEFINE ASC_SOFT_CR :=   141      // softCarriageReturn
DEFINE ASC_EOF    :=    26    // EndOfFile
#ifndef CRLF
DEFINE	 CRLF       := e"\r\n"
#endif

DEFINE SE_ABORT := 0
DEFINE SE_IGNORE := 1
DEFINE SE_RETRY := 2
DEFINE SE_CANCEL := 3
DEFINE SE_OK := 4
DEFINE SE_YES := 5
DEFINE SE_NO := 6
DEFINE SE_CLOSE := 7
DEFINE SE_DEFAULT := 0x80000000
DEFINE EC_ALERT := 0
DEFINE EC_IGNORE := 1
DEFINE EC_RETRY := 2
DEFINE EC_BREAK := 3
DEFINE REG_BUFF_SIZE := 64
DEFINE INT_WINDOWS := 1
DEFINE INT_CLIPPER := 0
DEFINE INT_BINARY := 2

DEFINE INTERNET_ERROR_BASE := 12000
DEFINE VOVER_BUILDNUMBER := __VERSION__
DEFINE SUCCESS := 0
DEFINE FAILURE := -1
DEFINE DBOI_LOCK_ALL := 100
DEFINE DBOI_LOCK_FAIL := 101
DEFINE DBOI_HPLOCK_GATE := 102
DEFINE RDD_INFO := 100
DEFINE RDD_INFO_MAX := 114
DEFINE NEW_AREA := 0
DEFINE BUFF_SIZE := 0x00008000
DEFINE MAXFILENAME := 260
DEFINE MAX_EXT_NAME := 5
DEFINE DB_MAXAREAS := 1024
DEFINE MAXDRIVERNAME := 12
DEFINE MAX_KEY_LEN := 256
DEFINE DBF_ANSI := 0x04
DEFINE DBF_VER := 0x03
DEFINE DBF_MEMO := 0x80
DEFINE DBF_DB4MEMO := 0x88
DEFINE DBF_PRODINDEX := 0x01
DEFINE DBF_MEMOS := 0x02
DEFINE DBF_ISDATABASE := 0x04
DEFINE DBF_OLE := 0x80

DEFINE MAX_INST := 10
DEFINE ASC_BS := 8
DEFINE ASC_LF := 10
DEFINE ASC_FF := 12
DEFINE ASC_CR := 13
DEFINE ASC_ESC := 27
DEFINE ASC_BLANK := 32
DEFINE ASC_0 := 48
DEFINE ASC_1 := 49
DEFINE ASC_9 := 57
DEFINE ASC_A := 65
DEFINE ASC_Z := 90
DEFINE MAX_ALLOC := 65527
DEFINE _MAX_DRIVE := 3


shortened delay between cycles

shortened delay between cycles

# july 4th, memorial day, presidents' day, etc.
STEP 255 0 0 1000
STEP 200 200 200 1000
STEP 0 0 255 1000
STEP 0 0 0 1000

# july 4th, memorial day, presidents' day, etc.
STEP 255 0 0 1000
STEP 200 200 200 1000
STEP 0 0 255 1000
STEP 0 0 0 3000


QtTest: updated to use the macros PBOOL, PINT, PDOUBLE, PFLOAT and PQREAL

/*

  Qt4xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 4

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"
#include "qt4xhb_clsid.ch"

CLASS QTestEventList

   DATA pointer
   DATA class_id INIT Class_Id_QTestEventList
   DATA self_destruction INIT .F.

   METHOD new1
   METHOD new2
   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 <QTestEventList>

#include "qt4xhb_common.h"
#include "qt4xhb_clsid.h"
#include "qt4xhb_utils.h"

/*
QTestEventList ()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_NEW1 )
{
  QTestEventList * o = NULL;
  o = new QTestEventList (  );
  PHB_ITEM self = hb_stackSelfItem();
  PHB_ITEM ptr = hb_itemPutPtr( NULL,(QTestEventList *) o );
  hb_objSendMsg( self, "_pointer", 1, ptr );
  hb_itemRelease( ptr );
  hb_itemReturn( self );
}

/*
QTestEventList ( const QTestEventList & other )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_NEW2 )
{
  QTestEventList * o = NULL;
  QTestEventList * par1 = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
  o = new QTestEventList ( *par1 );
  PHB_ITEM self = hb_stackSelfItem();
  PHB_ITEM ptr = hb_itemPutPtr( NULL,(QTestEventList *) o );
  hb_objSendMsg( self, "_pointer", 1, ptr );
  hb_itemRelease( ptr );
  hb_itemReturn( self );
}

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

HB_FUNC_STATIC( QTESTEVENTLIST_NEW )
{
  if( ISNUMPAR(0) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_NEW1 );
  }
  else if( ISNUMPAR(1) && ISQTESTEVENTLIST(1) )
  {
    HB_FUNC_EXEC( 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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addDelay ( PINT(1) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyClick (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyClick ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addKeyClicks ( const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICKS )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QString par1 = hb_parc(1);
    obj->addKeyClicks ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyPress (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyPress ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addKeyRelease ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE1 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyRelease (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyRelease ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyRelease ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addMouseClick ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSECLICK )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseClick (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseDClick (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseMove ( QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEMOVE )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QPoint par1 = ISNIL(1)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseMove ( par1, ISNIL(2)? -1 : hb_parni(2) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMousePress (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseRelease (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void clear ()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_CLEAR )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->clear (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void simulate ( QWidget * w )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_SIMULATE )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->simulate ( par1 );
  }
  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 );
  }

  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 );
  }

  hb_itemReturn( self );
}

#pragma ENDDUMP

/*

  Qt4xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 4

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"
#include "qt4xhb_clsid.ch"

CLASS QTestEventList

   DATA pointer
   DATA class_id INIT Class_Id_QTestEventList
   DATA self_destruction INIT .F.

   METHOD new1
   METHOD new2
   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 <QTestEventList>

#include "qt4xhb_common.h"
#include "qt4xhb_clsid.h"
#include "qt4xhb_utils.h"

/*
QTestEventList ()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_NEW1 )
{
  QTestEventList * o = NULL;
  o = new QTestEventList (  );
  PHB_ITEM self = hb_stackSelfItem();
  PHB_ITEM ptr = hb_itemPutPtr( NULL,(QTestEventList *) o );
  hb_objSendMsg( self, "_pointer", 1, ptr );
  hb_itemRelease( ptr );
  hb_itemReturn( self );
}

/*
QTestEventList ( const QTestEventList & other )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_NEW2 )
{
  QTestEventList * o = NULL;
  QTestEventList * par1 = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
  o = new QTestEventList ( *par1 );
  PHB_ITEM self = hb_stackSelfItem();
  PHB_ITEM ptr = hb_itemPutPtr( NULL,(QTestEventList *) o );
  hb_objSendMsg( self, "_pointer", 1, ptr );
  hb_itemRelease( ptr );
  hb_itemReturn( self );
}

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

HB_FUNC_STATIC( QTESTEVENTLIST_NEW )
{
  if( ISNUMPAR(0) )
  {
    HB_FUNC_EXEC( QTESTEVENTLIST_NEW1 );
  }
  else if( ISNUMPAR(1) && ISQTESTEVENTLIST(1) )
  {
    HB_FUNC_EXEC( 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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addDelay ( hb_parni(1) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyClick (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyClick ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICK2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyClick ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addKeyClicks ( const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYCLICKS )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QString par1 = hb_parc(1);
    obj->addKeyClicks ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyPress (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyPress ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYPRESS2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyPress ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addKeyRelease ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE1 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->addKeyRelease (  (Qt::Key) hb_parni(1), ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addKeyRelease ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDKEYRELEASE2 )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    char par1 = ISCHAR(1)? (char) hb_parc(1)[0] : (ISNUM(1)? hb_parni(1) : 0);
    obj->addKeyRelease ( par1, ISNIL(2)? Qt::NoModifier : (Qt::KeyboardModifiers) hb_parni(2), ISNIL(3)? -1 : hb_parni(3) );
  }
  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 );
  }
}

/*
void addMouseClick ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSECLICK )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseClick (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseDClick (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addMouseMove ( QPoint pos = QPoint(), int delay = -1 )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_ADDMOUSEMOVE )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QPoint par1 = ISNIL(1)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseMove ( par1, ISNIL(2)? -1 : hb_parni(2) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMousePress (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  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 *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  int par2 = ISNIL(2)? 0 :  hb_parni(2);
  if( obj )
  {
    QPoint par3 = ISNIL(3)? QPoint() : *(QPoint *) hb_itemGetPtr( hb_objSendMsg( hb_param(3, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->addMouseRelease (  (Qt::MouseButton) hb_parni(1), (Qt::KeyboardModifiers) par2, par3, ISNIL(4)? -1 : hb_parni(4) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void clear ()
*/
HB_FUNC_STATIC( QTESTEVENTLIST_CLEAR )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->clear (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void simulate ( QWidget * w )
*/
HB_FUNC_STATIC( QTESTEVENTLIST_SIMULATE )
{
  QTestEventList * obj = (QTestEventList *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->simulate ( par1 );
  }
  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 );
  }

  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 );
  }

  hb_itemReturn( self );
}

#pragma ENDDUMP


QtScriptTools: formatting

QtScriptTools: formatting

(  ) -> ()

/*

  Qt4xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 4

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"
#include "qt4xhb_clsid.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

CLASS QScriptEngineDebugger INHERIT QObject

   DATA class_id INIT Class_Id_QScriptEngineDebugger
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget
   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended
   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <QScriptEngineDebugger>

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

/*
QScriptEngineDebugger ( QObject * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_NEW )
{
  QScriptEngineDebugger * o = NULL;
  QObject * par1 = ISNIL(1)? 0 : (QObject *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
  o = new QScriptEngineDebugger ( par1 );
  _qt4xhb_storePointerAndFlag ( o, false );
}

HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_DELETE )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  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() );
}

/*
QAction * action ( DebuggerAction action ) const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_ACTION )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QAction * ptr = obj->action (  (QScriptEngineDebugger::DebuggerAction) hb_parni(1) );
    _qt4xhb_createReturnClass ( ptr, "QACTION" );
  }
}

/*
void attachTo ( QScriptEngine * engine )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_ATTACHTO )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QScriptEngine * par1 = (QScriptEngine *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->attachTo ( par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
bool autoShowStandardWindow () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_AUTOSHOWSTANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    hb_retl( obj->autoShowStandardWindow () );
  }
}

/*
QMenu * createStandardMenu ( QWidget * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_CREATESTANDARDMENU )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = ISNIL(1)? 0 : (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    QMenu * ptr = obj->createStandardMenu ( par1 );
    _qt4xhb_createReturnClass ( ptr, "QMENU" );
  }
}

/*
QToolBar * createStandardToolBar ( QWidget * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_CREATESTANDARDTOOLBAR )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = ISNIL(1)? 0 : (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    QToolBar * ptr = obj->createStandardToolBar ( par1 );
    _qt4xhb_createReturnClass ( ptr, "QTOOLBAR" );
  }
}

/*
void detach ()
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_DETACH )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->detach ();
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setAutoShowStandardWindow ( bool autoShow )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_SETAUTOSHOWSTANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->setAutoShowStandardWindow ( PBOOL(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QMainWindow * standardWindow () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_STANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QMainWindow * ptr = obj->standardWindow ();
    _qt4xhb_createReturnClass ( ptr, "QMAINWINDOW" );
  }
}

/*
DebuggerState state () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_STATE )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    hb_retni( (int) obj->state () );
  }
}

/*
QWidget * widget ( DebuggerWidget widget ) const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_WIDGET )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * ptr = obj->widget (  (QScriptEngineDebugger::DebuggerWidget) hb_parni(1) );
    _qt4xhb_createReturnClass ( ptr, "QWIDGET" );
  }
}

#pragma ENDDUMP

/*

  Qt4xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 4

  Copyright (C) 2012-2017 Marcos Antonio Gambeta <marcosgambeta@uol.com.br>

*/

#include "hbclass.ch"
#include "qt4xhb_clsid.ch"

#ifndef QT4XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QMENU
REQUEST QTOOLBAR
REQUEST QMAINWINDOW
REQUEST QWIDGET
#endif

CLASS QScriptEngineDebugger INHERIT QObject

   DATA class_id INIT Class_Id_QScriptEngineDebugger
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD action
   METHOD attachTo
   METHOD autoShowStandardWindow
   METHOD createStandardMenu
   METHOD createStandardToolBar
   METHOD detach
   METHOD setAutoShowStandardWindow
   METHOD standardWindow
   METHOD state
   METHOD widget
   METHOD onEvaluationResumed
   METHOD onEvaluationSuspended
   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <QScriptEngineDebugger>

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

/*
QScriptEngineDebugger ( QObject * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_NEW )
{
  QScriptEngineDebugger * o = NULL;
  QObject * par1 = ISNIL(1)? 0 : (QObject *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
  o = new QScriptEngineDebugger ( par1 );
  _qt4xhb_storePointerAndFlag ( o, false );
}

HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_DELETE )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  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() );
}

/*
QAction * action ( DebuggerAction action ) const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_ACTION )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QAction * ptr = obj->action (  (QScriptEngineDebugger::DebuggerAction) hb_parni(1) );
    _qt4xhb_createReturnClass ( ptr, "QACTION" );
  }
}

/*
void attachTo ( QScriptEngine * engine )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_ATTACHTO )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QScriptEngine * par1 = (QScriptEngine *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    obj->attachTo ( par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
bool autoShowStandardWindow () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_AUTOSHOWSTANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    hb_retl( obj->autoShowStandardWindow (  ) );
  }
}

/*
QMenu * createStandardMenu ( QWidget * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_CREATESTANDARDMENU )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = ISNIL(1)? 0 : (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    QMenu * ptr = obj->createStandardMenu ( par1 );
    _qt4xhb_createReturnClass ( ptr, "QMENU" );
  }
}

/*
QToolBar * createStandardToolBar ( QWidget * parent = 0 )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_CREATESTANDARDTOOLBAR )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * par1 = ISNIL(1)? 0 : (QWidget *) hb_itemGetPtr( hb_objSendMsg( hb_param(1, HB_IT_OBJECT ), "POINTER", 0 ) );
    QToolBar * ptr = obj->createStandardToolBar ( par1 );
    _qt4xhb_createReturnClass ( ptr, "QTOOLBAR" );
  }
}

/*
void detach ()
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_DETACH )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->detach (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setAutoShowStandardWindow ( bool autoShow )
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_SETAUTOSHOWSTANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    obj->setAutoShowStandardWindow ( PBOOL(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QMainWindow * standardWindow () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_STANDARDWINDOW )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QMainWindow * ptr = obj->standardWindow (  );
    _qt4xhb_createReturnClass ( ptr, "QMAINWINDOW" );
  }
}

/*
DebuggerState state () const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_STATE )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    hb_retni( (int) obj->state (  ) );
  }
}

/*
QWidget * widget ( DebuggerWidget widget ) const
*/
HB_FUNC_STATIC( QSCRIPTENGINEDEBUGGER_WIDGET )
{
  QScriptEngineDebugger * obj = (QScriptEngineDebugger *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    QWidget * ptr = obj->widget (  (QScriptEngineDebugger::DebuggerWidget) hb_parni(1) );
    _qt4xhb_createReturnClass ( ptr, "QWIDGET" );
  }
}

#pragma ENDDUMP