Fixes #188

Fixes #188

//
// 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 System.Collections.Generic
USING System.Linq
USING XSharp.RDD
USING XSharp.RDD.Support
USING XSharp.RDD.Enums

BEGIN NAMESPACE XSharp.ADS
    /// Class for Ads Column reading / writing
    CLASS AdsColumn INHERIT RDDFieldInfo
        INTERNAL RDD        AS XSharp.ADS.AdsRDD
        INTERNAL AdsType    as AdsFieldType
        INTERNAL FieldPos   as DWORD
        PROPERTY _Table as IntPtr GET RDD:_Table

        STATIC METHOD Create(oInfo AS RDDFieldInfo, oRDD AS XSharp.ADS.AdsRDD,type as AdsFieldType, nPos as DWORD) AS AdsColumn
            // Commented out types are Harbour specific
            SWITCH type
            // char types
            CASE AdsFieldType.TIMESTAMP
            CASE AdsFieldType.MODTIME
            CASE AdsFieldType.TIME
            CASE AdsFieldType.MONEY
            CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
                return AdsCharacterColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
		    CASE AdsFieldType.NMEMO
		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
                return AdsMemoColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.SHORTINT
		    CASE AdsFieldType.AUTOINC
		    CASE AdsFieldType.INTEGER
		    CASE AdsFieldType.NUMERIC
		    CASE AdsFieldType.DOUBLE
		    CASE AdsFieldType.CURDOUBLE
                return AdsNumericColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.LOGICAL
                return AdsLogicColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.DATE
		    CASE AdsFieldType.COMPACTDATE
                return AdsDateColumn{oInfo, oRDD, type,nPos}
            OTHERWISE
                oRDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+ ((int) type):ToString())
            END SWITCH
            RETURN NULL

        PROTECTED CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType, nPos as DWORD)
            SUPER(oInfo)
            SELF:RDD        := oRDD
            SELF:AdsType    := type
            SELF:FieldPos   := nPos
            RETURN

        VIRTUAL METHOD GetValue() AS OBJECT
            RETURN NIL

        VIRTUAL METHOD PutValue(oValue AS OBJECT) AS LOGIC
            RETURN FALSE

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

    END CLASS

    /// Class for reading / writing String Columns
    CLASS AdsCharacterColumn INHERIT AdsColumn

         CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo, oRDD,type,nPos)
            IF SELF:Decimals != 0
                SELF:Length         += SELF:Decimals * 256
			    SELF:Decimals       := 0
            ENDIF
            RETURN

       OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
	        LOCAL result := 0 AS DWORD
		    LOCAL slength AS DWORD
		    LOCAL strValue AS STRING
    		VAR tc := Type.GetTypeCode(oValue:GetType())
            SWITCH SELF:AdsType
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
            CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
                slength := Math.Min(slength, (DWORD) SELF:Length)
			    IF slength == 0
				    result := ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos)
			    ELSE
                    IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
                        result := ACE.AdsSetStringW(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ELSE
                        result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ENDIF
			    ENDIF
		    CASE AdsFieldType.TIME
		    CASE AdsFieldType.TIMESTAMP
		    CASE AdsFieldType.MONEY
		    CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.MODTIME
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
			    result := ACE.AdsSetField(SELF:_Table, SELF:FieldPos, strValue, slength)
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            IF result != 0 .AND. result != ACE.AE_DATA_TRUNCATED
			    SELF:RDD:ADSERROR(result, EG_WRITE, __ENTITY__)
		    ENDIF
            RETURN TRUE

        OVERRIDE METHOD Validate() AS LOGIC
            IF SELF:Length == 0  .OR. SELF:Decimals > 0  .OR. SELF:Length > System.UInt16.MaxValue
                RETURN FALSE
            ENDIF
            RETURN TRUE

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL result    := 0 as DWORD
            LOCAL slength    := (DWORD) SELF:Length+1 AS DWORD
			LOCAL chars := CHAR[] {slength} as CHAR[]
		    SWITCH SELF:AdsType
		    CASE AdsFieldType.TIME
		    CASE AdsFieldType.TIMESTAMP
		    CASE AdsFieldType.MONEY
		    CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.MODTIME
                LOCAL isEmpty   := 0 AS WORD
			    RDD:_CheckError(ACE.AdsIsEmpty(SELF:_Table,  SELF:FieldPos , OUT isEmpty),EG_READ)
			    IF isEmpty == 1
				    RETURN NULL
			    ENDIF
			    chars := CHAR[] {slength}
			    result := ACE.AdsGetField(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
			    chars := CHAR[] {slength}
                IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
			        result := ACE.AdsGetStringW(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
                ELSE
			        result := ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
                ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
		    SWITCH result
		    CASE 0
			    IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
                    RETURN STRING{chars, 0, (INT) SELF:length}
			    ELSE
				    RETURN SELF:RDD:_Ansi2Unicode(chars, (INT) SELF:length)
			    ENDIF
		    CASE ACE.AE_NO_CURRENT_RECORD
			    RETURN STRING{' ', (INT) SELF:length}
		    OTHERWISE
			    SELF:RDD:_CheckError(result,EG_READ)
		    END SWITCH
            RETURN String.Empty

    END CLASS
    /// Class for reading / writing Date Columns
    CLASS AdsDateColumn INHERIT AdsColumn

         CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo, oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
		    LOCAL lJulian AS LONG
            VAR result := ACE.AdsGetJulian(SELF:_Table, SELF:FieldPos, OUT lJulian)
		    IF result == ACE.AE_NO_CURRENT_RECORD
			    RETURN DbDate{0,0,0}
		    ELSEIF result != 0
			    SELF:RDD:_CheckError(result,EG_READ)
		    ENDIF
		    TRY
			    IF lJulian == 0
				    RETURN DbDate{0,0,0}
			    ELSE
                    // there is a function to convert julian to string but it does not always work correctly
                    // this seems to always do the job
				    LOCAL wLength := ACE.ADS_MAX_DATEMASK+1 AS DWORD
                    LOCAL chars := CHAR[] {SELF:length} as CHAR[]
				    result := ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF wLength, 0)
				    VAR cDate := STRING{chars, 0, 8}
				    IF String.IsNullOrWhiteSpace(cDate)
					    RETURN DbDate{0,0,0}
				    ELSE
					    VAR dt := DateTime.ParseExact(cDate, "yyyyMMdd",NULL)
					    RETURN DbDate{dt:Year, dt:Month, dt:Day}
				    ENDIF
			    ENDIF
		    CATCH

		    END TRY
		    RETURN DbDate{0,0,0}

        OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
            // Note that the XSharp.__Date type also returns a typecode of DateTime
            VAR tc := Type.GetTypeCode(oValue:GetType())
	        IF oValue IS IDate VAR oDate
                tc := TypeCode.DateTime
		        IF oDate:IsEmpty
			        oValue := DateTime.MinValue
		        ELSE
			        oValue := DateTime{oDate:Year, oDate:Month, oDate:Day}
		        ENDIF
            ELSEIF oValue IS DateTime
                tc := TypeCode.DateTime
	        ENDIF
		    IF tc != TypeCode.DateTime
			    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Date or DateTime value expected")
		    ENDIF

		    LOCAL dt := (DateTime) oValue AS DateTime
            if (dt == DateTime.MinValue)
                SELF:RDD:_CheckError(ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos),EG_WRITE)
            ELSE
		        LOCAL text := dt:ToString("yyyyMMdd") AS STRING
		        LOCAL r8Julian AS REAL8
		        SELF:RDD:_CheckError(AceUnPub.AdsConvertStringToJulian(text, (WORD) text:Length, OUT r8Julian),EG_WRITE)
		        SELF:RDD:_CheckError(ACE.AdsSetJulian(SELF:_Table, SELF:FieldPos, (LONG) r8Julian),EG_WRITE)
            ENDIF
            RETURN TRUE

        OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 8  .AND.  SELF:Decimals == 0

    END CLASS

    /// Class for reading / writing Logic Columns
    CLASS AdsLogicColumn INHERIT AdsColumn

        CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
	        LOCAL wValue AS WORD
		    var result := ACE.AdsGetLogical(SELF:_Table, SELF:FieldPos, OUT wValue)
		    IF result ==  ACE.AE_NO_CURRENT_RECORD
			    wValue := 0
		    ELSEIF ! SELF:RDD:_CheckError(result,EG_READ)
              // Exception
		    ENDIF
		    RETURN wValue != 0

       OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
            VAR tc := Type.GetTypeCode(oValue:GetType())
		    IF tc != TypeCode.Boolean
			    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Logic value expected")
		    ENDIF
		    SELF:RDD:_CheckError(ACE.AdsSetLogical(SELF:_Table, SELF:FieldPos, (WORD)  IIF( (LOGIC) oValue, 1, 0)),EG_WRITE)
            RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 1  .AND.  SELF:Decimals == 0
    END CLASS

    /// Class for reading / writing Numeric Columns
    CLASS AdsNumericColumn INHERIT AdsColumn

    CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL result    := 0 as DWORD
		    SWITCH SELF:AdsType
		    CASE AdsFieldType.NUMERIC
		    CASE AdsFieldType.DOUBLE
		    CASE AdsFieldType.INTEGER
		    CASE AdsFieldType.SHORTINT
		    CASE AdsFieldType.AUTOINC
		    CASE AdsFieldType.CURDOUBLE
			    LOCAL r8 AS REAL8
			    result := ACE.AdsGetDouble(SELF:_Table, SELF:FieldPos, OUT r8)
			    IF result == ACE.AE_NO_CURRENT_RECORD
				    r8 := 0.0
			    ENDIF
			    IF SELF:AdsType:IsDouble()
				    VAR value := r8:ToString()
				    VAR pos := VALUE:IndexOf('.')
				    RETURN DbFloat{r8, SELF:Length, IIF(pos > 0, SELF:Length - pos -1, 0)}
			    ELSE
				    RETURN DbFloat{r8, SELF:Length, SELF:Decimals}
			    ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            RETURN NULL

      OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
      	IF oValue IS IFloat VAR floatValue
		    oValue := floatValue:Value
        ENDIF
        LOCAL wType AS WORD
        SELF:RDD:_CheckError(ACE.AdsGetFieldType(SELF:_Table, SELF:FieldPos, OUT wType),EG_READ)
        IF wType != ACE.ADS_AUTOINC
	        TRY
	            LOCAL r8 AS REAL8
		        r8 := Convert.ToDouble(oValue)
		        SELF:RDD:_CheckError(ACE.AdsSetDouble(SELF:_Table, SELF:FieldPos, r8),EG_WRITE)

            CATCH
		        SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Numeric value expected")
                RETURN FALSE
	        END TRY
        ELSE
	        NOP // Do not allow to write to AUTO INC field
        ENDIF
        RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
           IF SELF:Length >= 1  .AND.  SELF:Length <= 255
                IF SELF:Decimals > 0
                    // We must check that we have enough space for DOT and decimal
                    IF SELF:Length <= 2  .OR.  SELF:Decimals >= SELF:Length -1
                        RETURN FALSE
                    ENDIF
                ENDIF
            ELSE
                RETURN FALSE
            ENDIF
            RETURN TRUE

    END CLASS

    /// Class for reading / writing Memo Columns.
    CLASS AdsMemoColumn INHERIT AdsColumn
        // AdsFieldType.MEMO
        // AdsFieldType.NMEMO
        // AdsFieldType.BINARY
        // AdsFieldType.IMAGE
        // AdsFieldType.RAW
        // AdsFieldType.VARBINARY_FOX

        CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL isEmpty   := 0 AS WORD
            LOCAL result    := 0 as DWORD
            LOCAL mlength    := 0 AS DWORD
            LOCAL bytes     := NULL AS BYTE[]
			LOCAL chars := CHAR[] {length} as CHAR[]
            SWITCH SELF:AdsType
		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.NMEMO
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
			    result := ACE.AdsGetMemoLength(SELF:_Table, SELF:FieldPos, OUT mlength )
			    SWITCH result
			    CASE 0
				    IF mlength == 0
					    RETURN string.Empty
				    ENDIF
			    CASE ACE.AE_NO_CURRENT_RECORD
				    IF SELF:AdsType == AdsFieldType.MEMO .or. SELF:AdsType == AdsFieldType.NMEMO
					    RETURN string.Empty
				    ELSE    // image and binary
					    RETURN NULL
				    ENDIF
			    OTHERWISE
				    SELF:RDD:_CheckError(result,EG_READ)
			    END SWITCH
			    SWITCH SELF:AdsType
			    CASE AdsFieldType.MEMO
				    chars := CHAR[] {++mlength}
				    SELF:RDD:_CheckError(ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF mlength ,0),EG_READ)
				    RETURN SELF:RDD:_Ansi2Unicode(chars, (INT) mlength)
			    CASE AdsFieldType.NMEMO
				    chars := CHAR[] {++mlength}
				    SELF:RDD:_CheckError(ACE.AdsGetStringW(SELF:_Table, SELF:FieldPos, chars, REF mlength ,0),EG_READ)
                    return String{chars,0, (int)mLength-1}
			    CASE AdsFieldType.BINARY
			    CASE AdsFieldType.IMAGE
				    bytes := BYTE[] {mlength}
				    SELF:RDD:_CheckError(ACE.AdsGetBinary(SELF:_Table, SELF:FieldPos, 0, bytes, REF mlength ),EG_READ)
				    RETURN bytes
			    END SWITCH

		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
			    result := ACE.AdsIsEmpty(SELF:_Table, SELF:FieldPos, OUT isEmpty)
			    IF result == 0
				    IF isEmpty == 1
					    RETURN NULL
				    ENDIF
			    ELSE
				    SELF:RDD:_CheckError(result,EG_READ)
			    ENDIF
			    mlength := (DWORD) SELF:Length
			    bytes := BYTE[] {mlength}
			    SELF:RDD:_CheckError(ACE.AdsGetBinary(SELF:_Table, SELF:FieldPos, 0, bytes, REF mlength ),EG_READ)
			    RETURN bytes
            OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            RETURN NULL

        OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
	        LOCAL result := 0 AS DWORD
		    LOCAL slength AS DWORD
		    LOCAL strValue AS STRING
    		VAR tc := Type.GetTypeCode(oValue:GetType())
            SWITCH SELF:AdsType
		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.NMEMO
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
			    IF slength == 0
				    result := ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos)
			    ELSE
                    IF SELF:AdsType == AdsFieldType.NMEMO
                        result := ACE.AdsSetStringW(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ELSE
                        result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ENDIF
			    ENDIF
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
			    IF tc != TypeCode.String .AND. tc != TypeCode.Object
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String or Object expected")
			    ENDIF
			    IF tc != TypeCode.String
				    strValue := (STRING) oValue
				    slength := (DWORD) strValue:Length
				    result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
			    ELSE
				    LOCAL bytes AS BYTE[]
				    bytes   := (BYTE[]) oValue
				    slength  := (DWORD) bytes:Length
				    IF SELF:AdsType == AdsFieldType.RAW .OR. SELF:AdsType == AdsFieldType.VARBINARY_FOX
					    result := ACE.AdsSetField(SELF:_Table, SELF:FieldPos, bytes, slength)
				    ELSE
					    result := ACE.AdsSetBinary(SELF:_Table, SELF:FieldPos, SELF:AdsType, slength, 0, bytes, slength)
				    ENDIF
			    ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            IF result != 0 .AND. result != ACE.AE_DATA_TRUNCATED
			    SELF:RDD:ADSERROR(result, EG_WRITE, __ENTITY__)
		    ENDIF
            RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 10 .AND.  SELF:Decimals == 0

    END CLASS

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 System.Collections.Generic
USING System.Linq
USING XSharp.RDD
USING XSharp.RDD.Support
USING XSharp.RDD.Enums

BEGIN NAMESPACE XSharp.ADS
    /// Class for Ads Column reading / writing
    CLASS AdsColumn INHERIT RDDFieldInfo
        INTERNAL RDD        AS XSharp.ADS.AdsRDD
        INTERNAL AdsType    as AdsFieldType
        INTERNAL FieldPos   as DWORD
        PROPERTY _Table as IntPtr GET RDD:_Table

        STATIC METHOD Create(oInfo AS RDDFieldInfo, oRDD AS XSharp.ADS.AdsRDD,type as AdsFieldType, nPos as DWORD) AS AdsColumn
            // Commented out types are Harbour specific
            SWITCH type
            // char types
            CASE AdsFieldType.TIMESTAMP
            CASE AdsFieldType.MODTIME
            CASE AdsFieldType.TIME
            CASE AdsFieldType.MONEY
            CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
                return AdsCharacterColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
		    CASE AdsFieldType.NMEMO
		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
                return AdsMemoColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.SHORTINT
		    CASE AdsFieldType.AUTOINC
		    CASE AdsFieldType.INTEGER
		    CASE AdsFieldType.NUMERIC
		    CASE AdsFieldType.DOUBLE
		    CASE AdsFieldType.CURDOUBLE
                return AdsNumericColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.LOGICAL
                return AdsLogicColumn{oInfo, oRDD, type,nPos}

		    CASE AdsFieldType.DATE
		    CASE AdsFieldType.COMPACTDATE
                return AdsDateColumn{oInfo, oRDD, type,nPos}
            OTHERWISE
                oRDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+ ((int) type):ToString())
            END SWITCH
            RETURN NULL

        PROTECTED CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType, nPos as DWORD)
            SUPER(oInfo)
            SELF:RDD        := oRDD
            SELF:AdsType    := type
            SELF:FieldPos   := nPos
            RETURN

        VIRTUAL METHOD GetValue() AS OBJECT
            RETURN NIL

        VIRTUAL METHOD PutValue(oValue AS OBJECT) AS LOGIC
            RETURN FALSE

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

    END CLASS

    /// Class for reading / writing String Columns
    CLASS AdsCharacterColumn INHERIT AdsColumn

         CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo, oRDD,type,nPos)
            IF SELF:Decimals != 0
                SELF:Length         += SELF:Decimals * 256
			    SELF:Decimals       := 0
            ENDIF
            RETURN

       OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
	        LOCAL result := 0 AS DWORD
		    LOCAL slength AS DWORD
		    LOCAL strValue AS STRING
    		VAR tc := Type.GetTypeCode(oValue:GetType())
            SWITCH SELF:AdsType
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
            CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
                slength := Math.Min(slength, (DWORD) SELF:Length)
			    IF slength == 0
				    result := ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos)
			    ELSE
                    IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
                        result := ACE.AdsSetStringW(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ELSE
                        result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ENDIF
			    ENDIF
		    CASE AdsFieldType.TIME
		    CASE AdsFieldType.TIMESTAMP
		    CASE AdsFieldType.MONEY
		    CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.MODTIME
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
			    result := ACE.AdsSetField(SELF:_Table, SELF:FieldPos, strValue, slength)
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            IF result != 0 .AND. result != ACE.AE_DATA_TRUNCATED
			    SELF:RDD:ADSERROR(result, EG_WRITE, __ENTITY__)
		    ENDIF
            RETURN TRUE

        OVERRIDE METHOD Validate() AS LOGIC
            IF SELF:Length == 0  .OR. SELF:Decimals > 0  .OR. SELF:Length > System.UInt16.MaxValue
                RETURN FALSE
            ENDIF
            RETURN TRUE

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL result    := 0 as DWORD
            LOCAL slength    := (DWORD) SELF:Length+1 AS DWORD
			LOCAL chars := CHAR[] {slength} as CHAR[]
		    SWITCH SELF:AdsType
		    CASE AdsFieldType.TIME
		    CASE AdsFieldType.TIMESTAMP
		    CASE AdsFieldType.MONEY
		    CASE AdsFieldType.ROWVERSION
		    CASE AdsFieldType.MODTIME
                LOCAL isEmpty   := 0 AS WORD
			    RDD:_CheckError(ACE.AdsIsEmpty(SELF:_Table,  SELF:FieldPos , OUT isEmpty),EG_READ)
			    IF isEmpty == 1
				    RETURN NULL
			    ENDIF
			    chars := CHAR[] {slength}
			    result := ACE.AdsGetField(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
		    CASE AdsFieldType.STRING
		    CASE AdsFieldType.VARCHAR
		    CASE AdsFieldType.CISTRING
		    CASE AdsFieldType.VARCHAR_FOX
		    CASE AdsFieldType.NCHAR
		    CASE AdsFieldType.NVARCHAR
			    chars := CHAR[] {slength}
                IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
			        result := ACE.AdsGetStringW(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
                ELSE
			        result := ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF slength ,0)
                ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
		    SWITCH result
		    CASE 0
			    IF SELF:AdsType == AdsFieldType.NCHAR .or. SELF:AdsType == AdsFieldType.NVARCHAR
                    RETURN STRING{chars, 0, (INT) SELF:length}
			    ELSE
				    RETURN SELF:RDD:_Ansi2Unicode(chars, (INT) SELF:length)
			    ENDIF
		    CASE ACE.AE_NO_CURRENT_RECORD
			    RETURN STRING{' ', (INT) SELF:length}
		    OTHERWISE
			    SELF:RDD:_CheckError(result,EG_READ)
		    END SWITCH
            RETURN String.Empty

    END CLASS
    /// Class for reading / writing Date Columns
    CLASS AdsDateColumn INHERIT AdsColumn

         CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo, oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
		    LOCAL lJulian AS LONG
            VAR result := ACE.AdsGetJulian(SELF:_Table, SELF:FieldPos, OUT lJulian)
		    IF result == ACE.AE_NO_CURRENT_RECORD
			    RETURN DbDate{0,0,0}
		    ELSEIF result != 0
			    SELF:RDD:_CheckError(result,EG_READ)
		    ENDIF
		    TRY
			    IF lJulian == 0
				    RETURN DbDate{0,0,0}
			    ELSE
                    // there is a function to convert julian to string but it does not always work correctly
                    // this seems to always do the job
				    LOCAL wLength := ACE.ADS_MAX_DATEMASK+1 AS DWORD
                    LOCAL chars := CHAR[] {SELF:length} as CHAR[]
				    result := ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF wLength, 0)
				    VAR cDate := STRING{chars, 0, 8}
				    IF String.IsNullOrWhiteSpace(cDate)
					    RETURN DbDate{0,0,0}
				    ELSE
					    VAR dt := DateTime.ParseExact(cDate, "yyyyMMdd",NULL)
					    RETURN DbDate{dt:Year, dt:Month, dt:Day}
				    ENDIF
			    ENDIF
		    CATCH

		    END TRY
		    RETURN DbDate{0,0,0}

        OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
            // Note that the XSharp.__Date type also returns a typecode of DateTime
            VAR tc := Type.GetTypeCode(oValue:GetType())
	        IF oValue IS IDate VAR oDate
                tc := TypeCode.DateTime
		        IF oDate:IsEmpty
			        oValue := DateTime.MinValue
		        ELSE
			        oValue := DateTime{oDate:Year, oDate:Month, oDate:Day}
		        ENDIF
            ELSEIF oValue IS DateTime
                tc := TypeCode.DateTime
	        ENDIF
		    IF tc != TypeCode.DateTime
			    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Date or DateTime value expected")
		    ENDIF

		    LOCAL dt := (DateTime) oValue AS DateTime
            if (dt == DateTime.MinValue)
                SELF:RDD:_CheckError(ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos),EG_WRITE)
            ELSE
		        LOCAL text := dt:ToString("yyyyMMdd") AS STRING
		        LOCAL r8Julian AS REAL8
		        SELF:RDD:_CheckError(AceUnPub.AdsConvertStringToJulian(text, (WORD) text:Length, OUT r8Julian),EG_WRITE)
		        SELF:RDD:_CheckError(ACE.AdsSetJulian(SELF:_Table, SELF:FieldPos, (LONG) r8Julian),EG_WRITE)
            ENDIF
            RETURN TRUE

        OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 8  .AND.  SELF:Decimals == 0

    END CLASS

    /// Class for reading / writing Logic Columns
    CLASS AdsLogicColumn INHERIT AdsColumn

        CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
	        LOCAL wValue AS WORD
		    var result := ACE.AdsGetLogical(SELF:_Table, SELF:FieldPos, OUT wValue)
		    IF result ==  ACE.AE_NO_CURRENT_RECORD
			    wValue := 0
		    ELSEIF ! SELF:RDD:_CheckError(result,EG_READ)
              // Exception
		    ENDIF
		    RETURN wValue != 0

       OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
            VAR tc := Type.GetTypeCode(oValue:GetType())
		    IF tc != TypeCode.Boolean
			    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Logic value expected")
		    ENDIF
		    SELF:RDD:_CheckError(ACE.AdsSetLogical(SELF:_Table, SELF:FieldPos, (WORD)  IIF( (LOGIC) oValue, 1, 0)),EG_WRITE)
            RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 1  .AND.  SELF:Decimals == 0
    END CLASS

    /// Class for reading / writing Numeric Columns
    CLASS AdsNumericColumn INHERIT AdsColumn

    CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL result    := 0 as DWORD
		    SWITCH SELF:AdsType
		    CASE AdsFieldType.NUMERIC
		    CASE AdsFieldType.DOUBLE
		    CASE AdsFieldType.INTEGER
		    CASE AdsFieldType.SHORTINT
		    CASE AdsFieldType.AUTOINC
		    CASE AdsFieldType.CURDOUBLE
			    LOCAL r8 AS REAL8
			    result := ACE.AdsGetDouble(SELF:_Table, SELF:FieldPos, OUT r8)
			    IF result == ACE.AE_NO_CURRENT_RECORD
				    r8 := 0.0
			    ENDIF
			    IF SELF:AdsType:IsDouble()
				    VAR value := r8:ToString()
				    VAR pos := VALUE:IndexOf('.')
				    RETURN DbFloat{r8, SELF:Length, IIF(pos > 0, SELF:Length - pos -1, 0)}
			    ELSE
				    RETURN DbFloat{r8, SELF:Length, SELF:Decimals}
			    ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            RETURN NULL

      OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
      	IF oValue IS IFloat VAR floatValue
		    oValue := floatValue:Value
        ENDIF
        LOCAL wType AS WORD
        SELF:RDD:_CheckError(ACE.AdsGetFieldType(SELF:_Table, SELF:FieldPos, OUT wType),EG_READ)
        IF wType != ACE.ADS_AUTOINC
	        TRY
	            LOCAL r8 AS REAL8
		        r8 := Convert.ToDouble(oValue)
		        SELF:RDD:_CheckError(ACE.AdsSetDouble(SELF:_Table, SELF:FieldPos, r8),EG_WRITE)

            CATCH
		        SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Numeric value expected")
                RETURN FALSE
	        END TRY
        ELSE
	        NOP // Do not allow to write to AUTO INC field
        ENDIF
        RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
           IF SELF:Length >= 1  .AND.  SELF:Length <= 255
                IF SELF:Decimals > 0
                    // We must check that we have enough space for DOT and decimal
                    IF SELF:Length <= 2  .OR.  SELF:Decimals >= SELF:Length -1
                        RETURN FALSE
                    ENDIF
                ENDIF
            ELSE
                RETURN FALSE
            ENDIF
            RETURN TRUE

    END CLASS

    /// Class for reading / writing Memo Columns.
    CLASS AdsMemoColumn INHERIT AdsColumn
        // AdsFieldType.MEMO
        // AdsFieldType.NMEMO
        // AdsFieldType.BINARY
        // AdsFieldType.IMAGE
        // AdsFieldType.RAW
        // AdsFieldType.VARBINARY_FOX

        CONSTRUCTOR(oInfo AS RddFieldInfo,oRDD AS XSharp.ADS.AdsRDD, type as AdsFieldType,nPos AS DWORD)
            SUPER(oInfo,oRDD,type,nPos)
            RETURN

        OVERRIDE METHOD GetValue() AS OBJECT
            LOCAL isEmpty   := 0 AS WORD
            LOCAL result    := 0 as DWORD
            LOCAL mlength    := 0 AS DWORD
            LOCAL bytes     := NULL AS BYTE[]
			LOCAL chars := CHAR[] {length} as CHAR[]
            SWITCH SELF:AdsType
		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.NMEMO
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
			    result := ACE.AdsGetMemoLength(SELF:_Table, SELF:FieldPos, OUT mlength )
			    SWITCH result
			    CASE 0
				    IF length == 0
					    RETURN string.Empty
				    ENDIF
			    CASE ACE.AE_NO_CURRENT_RECORD
				    IF SELF:AdsType == AdsFieldType.MEMO .or. SELF:AdsType == AdsFieldType.NMEMO
					    RETURN string.Empty
				    ELSE    // image and binary
					    RETURN NULL
				    ENDIF
			    OTHERWISE
				    SELF:RDD:_CheckError(result,EG_READ)
			    END SWITCH
			    SWITCH SELF:AdsType
			    CASE AdsFieldType.MEMO
				    chars := CHAR[] {mlength+1}
				    SELF:RDD:_CheckError(ACE.AdsGetString(SELF:_Table, SELF:FieldPos, chars, REF mlength ,0),EG_READ)
				    RETURN SELF:RDD:_Ansi2Unicode(chars, (INT) length)
			    CASE AdsFieldType.NMEMO
				    chars := CHAR[] {++length}
				    SELF:RDD:_CheckError(ACE.AdsGetStringW(SELF:_Table, SELF:FieldPos, chars, REF mlength ,0),EG_READ)
			    CASE AdsFieldType.BINARY
			    CASE AdsFieldType.IMAGE
				    bytes := BYTE[] {mlength}
				    SELF:RDD:_CheckError(ACE.AdsGetBinary(SELF:_Table, SELF:FieldPos, 0, bytes, REF mlength ),EG_READ)
				    RETURN bytes
			    END SWITCH

		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
			    result := ACE.AdsIsEmpty(SELF:_Table, SELF:FieldPos, OUT isEmpty)
			    IF result == 0
				    IF isEmpty == 1
					    RETURN NULL
				    ENDIF
			    ELSE
				    SELF:RDD:_CheckError(result,EG_READ)
			    ENDIF
			    mlength := (DWORD) SELF:Length
			    bytes := BYTE[] {mlength}
			    SELF:RDD:_CheckError(ACE.AdsGetBinary(SELF:_Table, SELF:FieldPos, 0, bytes, REF mlength ),EG_READ)
			    RETURN bytes
            OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            RETURN NULL

        OVERRIDE METHOD PutValue(oValue AS OBJECT) AS LOGIC
	        LOCAL result := 0 AS DWORD
		    LOCAL slength AS DWORD
		    LOCAL strValue AS STRING
    		VAR tc := Type.GetTypeCode(oValue:GetType())
            SWITCH SELF:AdsType
		    CASE AdsFieldType.MEMO
		    CASE AdsFieldType.NMEMO
			    IF tc != TypeCode.String
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String expected")
			    ENDIF
			    strValue := (STRING) oValue
			    slength  := (DWORD) strValue:Length
			    IF slength == 0
				    result := ACE.AdsSetEmpty(SELF:_Table, SELF:FieldPos)
			    ELSE
                    IF SELF:AdsType == AdsFieldType.NMEMO
                        result := ACE.AdsSetStringW(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ELSE
                        result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
                    ENDIF
			    ENDIF
		    CASE AdsFieldType.BINARY
		    CASE AdsFieldType.IMAGE
		    CASE AdsFieldType.RAW
		    CASE AdsFieldType.VARBINARY_FOX
			    IF tc != TypeCode.String .AND. tc != TypeCode.Object
				    SELF:RDD:ADSERROR(ERDD_DATATYPE, EG_DataType, __ENTITY__,"String or Object expected")
			    ENDIF
			    IF tc != TypeCode.String
				    strValue := (STRING) oValue
				    slength := (DWORD) strValue:Length
				    result := ACE.AdsSetString(SELF:_Table, SELF:FieldPos, strValue, slength)
			    ELSE
				    LOCAL bytes AS BYTE[]
				    bytes   := (BYTE[]) oValue
				    slength  := (DWORD) bytes:Length
				    IF SELF:AdsType == AdsFieldType.RAW .OR. SELF:AdsType == AdsFieldType.VARBINARY_FOX
					    result := ACE.AdsSetField(SELF:_Table, SELF:FieldPos, bytes, slength)
				    ELSE
					    result := ACE.AdsSetBinary(SELF:_Table, SELF:FieldPos, SELF:AdsType, slength, 0, bytes, slength)
				    ENDIF
			    ENDIF
		    OTHERWISE
                // Should never happen. We filter on the type when creating the column object
			    SELF:RDD:ADSError(ERDD_DATATYPE, EG_DataType, __ENTITY__,"Unexpected fieldtype: "+SELF:AdsType:ToString())
		    END SWITCH
            IF result != 0 .AND. result != ACE.AE_DATA_TRUNCATED
			    SELF:RDD:ADSERROR(result, EG_WRITE, __ENTITY__)
		    ENDIF
            RETURN TRUE

       OVERRIDE METHOD Validate() AS LOGIC
            RETURN SELF:Length == 10 .AND.  SELF:Decimals == 0

    END CLASS

END NAMESPACE


QtWebEngineWidgets: module updated

QtWebEngineWidgets: module updated

Modified:
source/QtWebEngineWidgets/QWebEngineHistory.prg

/*

  Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5

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

*/

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

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QWEBENGINEHISTORYITEM
#endif

CLASS QWebEngineHistory

   DATA pointer
   DATA self_destruction INIT .F.

   METHOD clear
   METHOD items
   METHOD backItems
   METHOD forwardItems
   METHOD canGoBack
   METHOD canGoForward
   METHOD back
   METHOD forward
   METHOD goToItem
   METHOD backItem
   METHOD currentItem
   METHOD forwardItem
   METHOD itemAt
   METHOD currentItemIndex
   METHOD count

   METHOD newFrom
   METHOD newFromObject
   METHOD newFromPointer
   METHOD selfDestruction
   METHOD setSelfDestruction

   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QWebEngineHistory>
#endif
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_macros.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QWebEngineHistory>
#endif
#endif

/*
void clear()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CLEAR )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QList<QWebEngineHistoryItem> items() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_ITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QList<QWebEngineHistoryItem> list = obj->items ();
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
        else
        {
          hb_errRT_BASE( EG_NOFUNC, 1001, NULL, "QWEBENGINEHISTORYITEM", HB_ERR_ARGS_BASEPARAMS );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QList<QWebEngineHistoryItem> backItems(int maxItems) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACKITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QList<QWebEngineHistoryItem> list = obj->backItems ( PINT(1) );
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
        else
        {
          hb_errRT_BASE( EG_NOFUNC, 1001, NULL, "QWEBENGINEHISTORYITEM", HB_ERR_ARGS_BASEPARAMS );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QList<QWebEngineHistoryItem> forwardItems(int maxItems) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARDITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QList<QWebEngineHistoryItem> list = obj->forwardItems ( PINT(1) );
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
        else
        {
          hb_errRT_BASE( EG_NOFUNC, 1001, NULL, "QWEBENGINEHISTORYITEM", HB_ERR_ARGS_BASEPARAMS );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
bool canGoBack() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CANGOBACK )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
bool canGoForward() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CANGOFORWARD )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
void back()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACK )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      obj->back ();
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
void forward()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARD )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      obj->forward ();
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
void goToItem(const QWebEngineHistoryItem &item)
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_GOTOITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISQWEBENGINEHISTORYITEM(1) )
    {
      obj->goToItem ( *PQWEBENGINEHISTORYITEM(1) );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QWebEngineHistoryItem backItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACKITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->backItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem currentItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CURRENTITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->currentItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem forwardItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARDITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->forwardItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem itemAt(int i) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_ITEMAT )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->itemAt ( PINT(1) ) );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
int currentItemIndex() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CURRENTITEMINDEX )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
int count() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_COUNT )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

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

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

  hb_itemReturn( self );
}

HB_FUNC_STATIC( QWEBENGINEHISTORY_NEWFROMOBJECT )
{
  HB_FUNC_EXEC( QWEBENGINEHISTORY_NEWFROM );
}

HB_FUNC_STATIC( QWEBENGINEHISTORY_NEWFROMPOINTER )
{
  HB_FUNC_EXEC( QWEBENGINEHISTORY_NEWFROM );
}

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

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

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

  hb_itemReturn( self );
}

#pragma ENDDUMP

/*

  Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5

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

*/

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

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QWEBENGINEHISTORYITEM
#endif

CLASS QWebEngineHistory

   DATA pointer
   DATA self_destruction INIT .F.

   METHOD clear
   METHOD items
   METHOD backItems
   METHOD forwardItems
   METHOD canGoBack
   METHOD canGoForward
   METHOD back
   METHOD forward
   METHOD goToItem
   METHOD backItem
   METHOD currentItem
   METHOD forwardItem
   METHOD itemAt
   METHOD currentItemIndex
   METHOD count

   METHOD newFrom
   METHOD newFromObject
   METHOD newFromPointer
   METHOD selfDestruction
   METHOD setSelfDestruction

   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QWebEngineHistory>
#endif
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_macros.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
#include <QWebEngineHistory>
#endif
#endif

/*
void clear()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CLEAR )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QList<QWebEngineHistoryItem> items() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_ITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QList<QWebEngineHistoryItem> list = obj->items ();
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QList<QWebEngineHistoryItem> backItems(int maxItems) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACKITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QList<QWebEngineHistoryItem> list = obj->backItems ( PINT(1) );
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QList<QWebEngineHistoryItem> forwardItems(int maxItems) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARDITEMS )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QList<QWebEngineHistoryItem> list = obj->forwardItems ( PINT(1) );
      PHB_DYNS pDynSym = hb_dynsymFindName( "QWEBENGINEHISTORYITEM" );
      PHB_ITEM pArray = hb_itemArrayNew(0);
      int i;
      for(i=0;i<list.count();i++)
      {
        if( pDynSym )
        {
          hb_vmPushDynSym( pDynSym );
          hb_vmPushNil();
          hb_vmDo( 0 );
          PHB_ITEM pObject = hb_itemNew( NULL );
          hb_itemCopy( pObject, hb_stackReturnItem() );
          PHB_ITEM pItem = hb_itemNew( NULL );
          hb_itemPutPtr( pItem, (QWebEngineHistoryItem *) new QWebEngineHistoryItem ( list[i] ) );
          hb_objSendMsg( pObject, "_POINTER", 1, pItem );
          hb_itemRelease( pItem );
          PHB_ITEM pDestroy = hb_itemNew( NULL );
          hb_itemPutL( pDestroy, true );
          hb_objSendMsg( pObject, "_SELF_DESTRUCTION", 1, pDestroy );
          hb_itemRelease( pDestroy );
          hb_arrayAddForward( pArray, pObject );
          hb_itemRelease( pObject );
        }
      }
      hb_itemReturnRelease(pArray);
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
bool canGoBack() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CANGOBACK )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
bool canGoForward() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CANGOFORWARD )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
void back()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACK )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      obj->back ();
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
void forward()
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARD )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      obj->forward ();
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
void goToItem(const QWebEngineHistoryItem &item)
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_GOTOITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISQWEBENGINEHISTORYITEM(1) )
    {
      obj->goToItem ( *PQWEBENGINEHISTORYITEM(1) );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }

  hb_itemReturn( hb_stackSelfItem() );
#endif
}

/*
QWebEngineHistoryItem backItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_BACKITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->backItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem currentItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CURRENTITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->currentItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem forwardItem() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_FORWARDITEM )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(0) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->forwardItem () );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
QWebEngineHistoryItem itemAt(int i) const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_ITEMAT )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

  if( obj )
  {
    if( ISNUMPAR(1) && ISNUM(1) )
    {
      QWebEngineHistoryItem * ptr = new QWebEngineHistoryItem( obj->itemAt ( PINT(1) ) );
      _qt5xhb_createReturnClass ( ptr, "QWEBENGINEHISTORYITEM", true );
    }
    else
    {
      hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
    }
  }
#endif
}

/*
int currentItemIndex() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_CURRENTITEMINDEX )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

/*
int count() const
*/
HB_FUNC_STATIC( QWEBENGINEHISTORY_COUNT )
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0))
  QWebEngineHistory * obj = (QWebEngineHistory *) _qt5xhb_itemGetPtrStackSelfItem();

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

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

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

  hb_itemReturn( self );
}

HB_FUNC_STATIC( QWEBENGINEHISTORY_NEWFROMOBJECT )
{
  HB_FUNC_EXEC( QWEBENGINEHISTORY_NEWFROM );
}

HB_FUNC_STATIC( QWEBENGINEHISTORY_NEWFROMPOINTER )
{
  HB_FUNC_EXEC( QWEBENGINEHISTORY_NEWFROM );
}

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

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

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

  hb_itemReturn( self );
}

#pragma ENDDUMP