[Runtime] Fix location of VOError.Log()

[Runtime] Fix location of VOError.Log()

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

DELEGATE ShowErrorDialog_Delegate(oError AS Error) AS INT
GLOBAL ShowErrorDialog_Handler AS ShowErrorDialog_Delegate

PROCEDURE ErrorSys _INIT1
   ErrorBlock( {|oError| DefError(oError)} )
   SetErrorLog( TRUE )
   SetErrorLogFile( "VOERROR.LOG" )
   RETURN

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/break/*" />
FUNCTION _Break(uValue AS USUAL) AS USUAL
	BREAK uValue

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/errorblock/*" />
FUNCTION ErrorBlock() AS USUAL STRICT
	LOCAL cbOld AS CODEBLOCK
	cbOld := XSharp.RuntimeState.GetValue<CODEBLOCK>(Set.ErrorBlock)
	IF cbOld == NULL_CODEBLOCK
		cbOld := {|e| DefError(  e ) }
		XSharp.RuntimeState.SetValue<CODEBLOCK>(Set.ErrorBlock, cbOld)
	ENDIF
	RETURN cbOld

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/errorblock/*" />
FUNCTION ErrorBlock(cbNewSetting AS CODEBLOCK) AS USUAL
	LOCAL cbOld AS CODEBLOCK
	cbOld := XSharp.RuntimeState.GetValue<CODEBLOCK>(Set.ErrorBlock)
	XSharp.RuntimeState.SetValue<CODEBLOCK>(Set.ErrorBlock, cbNewSetting)
	RETURN cbOld

/// <exclude />
FUNCTION VO_Sprintf( format AS USUAL,  args PARAMS OBJECT[] ) AS STRING
    IF format:IsString
	    RETURN _VO_Sprintf( (STRING) format, args)
    ENDIF
    RETURN _VO_Sprintf( (DWORD) format, args)

INTERNAL FUNCTION DefError(oErr AS OBJECT) AS OBJECT PASCAL

	LOCAL dwChoice			AS INT
	LOCAL cMessage			AS STRING
	LOCAL cTitle			AS STRING
	LOCAL hf				AS IntPtr
	STATIC LOCAL dwDefError 		AS DWORD

	IF !(oErr IS Error)
		VAR err := Error{}
		err:Gencode   := EG_WRONGCLASS
		err:Severity  := ES_ERROR
		err:FuncSym    := "DefError"
		err:Arg        := oErr:ToString()
		err:ArgNum    :=  1
		err:CanDefault := .T.
		THROW err

	ENDIF
	LOCAL oError := (Error) oErr AS Error
	IF oError:CanDefault
		// network open error?
		IF (oError:Gencode = EG_OPEN)
			IF (oError:OSCode  = 32) .OR.;					// Sharing Violation
				(oError:OSCode  = 33)    .OR.;				// Lock Violation
				(oError:Gencode = EG_APPENDLOCK)
				NetErr(.T.)
				RETURN E_DEFAULT                // continue with default behavior
			ENDIF
		ENDIF
	ENDIF

	IF oError:Severity = ES_WARNING
		cTitle := "WARNING"
	ELSE
		cTitle := "ERROR"
	ENDIF

	IF oError:SubstituteType = PTR
		oError:Severity := ES_CATASTROPHIC
	ENDIF

	cMessage := oError:ToString()

	dwChoice := 3

	IF SetErrorLog()
		hf := __OpenErrorLog()

		IF hf != F_ERROR
			FSeek3(hf, 0, FS_END)
			__WriteErrorLog(hf, cMessage, oError)
			FClose(hf)
		ENDIF
	ENDIF
	IF ShowErrorDialog_Handler != NULL
		dwChoice := ShowErrorDialog_Handler(oError)
	ELSE
		dwChoice := MessageBoxW(IntPtr.Zero, cMessage, cTitle, MB_ABORTRETRYIGNORE)
	ENDIF

	DO CASE
	CASE dwChoice = IDIGNORE
		IF oError:CanSubstitute
			RETURN NULL
		ELSE
			RETURN E_DEFAULT
		ENDIF

	CASE dwChoice = IDRETRY
		RETURN E_RETRY
	ENDCASE

	IF CanBreak()
		THROW XSharp.Internal.WrappedException{oError}
	ENDIF

	ErrorLevel(oError:Gencode)

	dwDefError := 0

	CoreDb.CloseAll()

	_Quit()

	RETURN NIL

INTERNAL FUNCTION __OpenErrorLog() AS IntPtr PASCAL

	LOCAL cFile                     AS STRING
	LOCAL cBuffer                   AS STRING
	LOCAL hfRet                     AS IntPtr
    LOCAL cFolder                   AS STRING
    cFolder := System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly():Location)
	cFile := System.IO.Path.Combine(cFolder, SetErrorLogFile())

	hfRet := FOpen2(cFile, FO_WRITE)

	IF hfRet != F_ERROR
		FSeek3( hfRet, 0, FS_END)
		FPutS( hfRet, "", 0)
	ELSE
		hfRet := FCreate2(cFile, FC_ARCHIVED)

		IF FError() = 3                          // path not found

			cFile :=""

			IF !GetDefaultDir() ==""
				cBuffer :="SetDefaultDir: " +GetDefaultDir()
				SetDefaultDir(NULL_PSZ)
			ELSE
				cBuffer :="SetDefault: " +GetDefault()
				SetDefault("")
			ENDIF

			//_IError(EG_ARG, .F., String2Psz(cBuffer))
			? cBuffer
		ENDIF
	ENDIF

	RETURN hfRet

INTERNAL FUNCTION __WriteErrorLog (hf AS IntPtr, cMsg AS STRING, oError AS Error) AS VOID PASCAL
   LOCAL cExe		AS STRING

	FPutS(hf, "***********************ERROR********************************")
	FPutS(hf, __VERSION__ )
	FPutS(hf, DateTime.Now:ToString())
	cExe	:= _ExecName()
	FPutS(hf, "Application: " + cExe )
	FPutS(hf, " " )
	FPutS(hf, "Error message:" )
	FPutS(hf, "--------------" )
	FPutS(hf, cMsg)

	FPutS(hf, "Error Object created:" )
	FPutS(hf, "--------------------" )
	FPutS(hf, "SubSystem       :" + AsString(oError:SubSystem) )
	FPutS(hf, "SubCode         :" + AsString(oError:SubCode)   )
	FPutS(hf, "GenCode         :" + ErrString(oError:Gencode ) )

	IF oError:SubCode = E_EXCEPTION
		FPutS(hf, "ExceptionCode   :" + oError:OSCode:ToString("X") )
		FPutS(hf, "ExceptionFlags  :" + oError:ArgType:ToString("X") )
		FPutS(hf, "ExceptionAddress:" + oError:FuncPtr:ToString("X") )
		FPutS(hf, "ParamNumber     :" + AsString(oError:ArgNum)    )
		FPutS(hf, "ExceptionInfo   :" + AsString(oError:FuncSym) )

	ELSE

		FPutS(hf, "OsCode          :" + oError:OSCode:ToString() )
		FPutS(hf, "ArgType         :" + TypeString(oError:ArgType    ) )
		FPutS(hf, "FuncPtr         :" + oError:FuncPtr:ToString()   )
		FPutS(hf, "ArgNum          :" + oError:ArgNum:ToString()    )
		FPutS(hf, "FuncSym         :" + oError:FuncSym:ToString()   )

	ENDIF

	FPutS(hf, "Severity        :" + AsString(oError:Severity ) )
	FPutS(hf, "CanDefault      :" + AsString(oError:CanDefault))
	FPutS(hf, "CanRetry        :" + AsString(oError:CanRetry ) )
	FPutS(hf, "CanSubstitute   :" + AsString(oError:CanSubstitute))
	FPutS(hf, "Operation       :" + AsString(oError:Operation) )
	FPutS(hf, "Description     :" + AsString(oError:Description))
	FPutS(hf, "FileName        :" + AsString(oError:FileName ) )
	FPutS(hf, "Tries           :" + AsString(oError:Tries    ) )
	FPutS(hf, "FileHandle      :" + AsString(oError:FileHandle))
	FPutS(hf, "SubCodeText     :" + AsString(oError:SubCodeText))
	FPutS(hf, "Arg             :" + AsString(oError:Arg) )
	FPutS(hf, "ArgTypeReq      :" + TypeString(oError:ArgTypeReq) )
	FPutS(hf, "MaxSize         :" + AsString(oError:MaxSize      ) )
	FPutS(hf, "SubstituteType  :" + TypeString(oError:SubstituteType))
	FPutS(hf, "CallFuncSym     :" + AsString(oError:CallFuncSym ) )
	FPutS(hf, "--------------------" )

	RETURN
INTERNAL _DLL FUNCTION MessageBoxW(hwnd AS IntPtr, lpText AS STRING, lpCaption AS STRING, uType AS DWORD)	AS INT PASCAL:USER32.MessageBoxW UNICODE

INTERNAL  DEFINE MB_ABORTRETRYIGNORE    := 0x00000002U

INTERNAL DEFINE IDOK            := 1
INTERNAL DEFINE IDCANCEL        := 2
INTERNAL DEFINE IDABORT         := 3
INTERNAL DEFINE IDRETRY         := 4
INTERNAL DEFINE IDIGNORE        := 5
INTERNAL DEFINE IDYES           := 6
INTERNAL DEFINE IDNO            := 7
INTERNAL DEFINE IDCLOSE         := 8
INTERNAL DEFINE IDHELP          :=9
INTERNAL DEFINE IDTRYAGAIN      := 10
INTERNAL DEFINE IDCONTINUE      := 11

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

DELEGATE ShowErrorDialog_Delegate(oError AS Error) AS INT
GLOBAL ShowErrorDialog_Handler AS ShowErrorDialog_Delegate

PROCEDURE ErrorSys _INIT1
   ErrorBlock( {|oError| DefError(oError)} )
   SetErrorLog( TRUE )
   SetErrorLogFile( "VOERROR.LOG" )
   RETURN

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/break/*" />
FUNCTION _Break(uValue AS USUAL) AS USUAL
	BREAK uValue

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/errorblock/*" />
FUNCTION ErrorBlock() AS USUAL STRICT
	LOCAL cbOld AS CODEBLOCK
	cbOld := XSharp.RuntimeState.GetValue<CODEBLOCK>(Set.ErrorBlock)
	IF cbOld == NULL_CODEBLOCK
		cbOld := {|e| DefError(  e ) }
		XSharp.RuntimeState.SetValue<CODEBLOCK>(Set.ErrorBlock, cbOld)
	ENDIF
	RETURN cbOld

/// <include file="VoFunctionDocs.xml" path="Runtimefunctions/errorblock/*" />
FUNCTION ErrorBlock(cbNewSetting AS CODEBLOCK) AS USUAL
	LOCAL cbOld AS CODEBLOCK
	cbOld := XSharp.RuntimeState.GetValue<CODEBLOCK>(Set.ErrorBlock)
	XSharp.RuntimeState.SetValue<CODEBLOCK>(Set.ErrorBlock, cbNewSetting)
	RETURN cbOld

/// <exclude />
FUNCTION VO_Sprintf( format AS USUAL,  args PARAMS OBJECT[] ) AS STRING
    IF format:IsString
	    RETURN _VO_Sprintf( (STRING) format, args)
    ENDIF
    RETURN _VO_Sprintf( (DWORD) format, args)

INTERNAL FUNCTION DefError(oErr AS OBJECT) AS OBJECT PASCAL

	LOCAL dwChoice			AS INT
	LOCAL cMessage			AS STRING
	LOCAL cTitle			AS STRING
	LOCAL hf				AS IntPtr
	STATIC LOCAL dwDefError 		AS DWORD

	IF !(oErr IS Error)
		VAR err := Error{}
		err:Gencode   := EG_WRONGCLASS
		err:Severity  := ES_ERROR
		err:FuncSym    := "DefError"
		err:Arg        := oErr:ToString()
		err:ArgNum    :=  1
		err:CanDefault := .T.
		THROW err

	ENDIF
	LOCAL oError := (Error) oErr AS Error
	IF oError:CanDefault
		// network open error?
		IF (oError:Gencode = EG_OPEN)
			IF (oError:OSCode  = 32) .OR.;					// Sharing Violation
				(oError:OSCode  = 33)    .OR.;				// Lock Violation
				(oError:Gencode = EG_APPENDLOCK)
				NetErr(.T.)
				RETURN E_DEFAULT                // continue with default behavior
			ENDIF
		ENDIF
	ENDIF

	IF oError:Severity = ES_WARNING
		cTitle := "WARNING"
	ELSE
		cTitle := "ERROR"
	ENDIF

	IF oError:SubstituteType = PTR
		oError:Severity := ES_CATASTROPHIC
	ENDIF

	cMessage := oError:ToString()

	dwChoice := 3

	IF SetErrorLog()
		hf := __OpenErrorLog()

		IF hf != F_ERROR
			FSeek3(hf, 0, FS_END)
			__WriteErrorLog(hf, cMessage, oError)
			FClose(hf)
		ENDIF
	ENDIF
	IF ShowErrorDialog_Handler != NULL
		dwChoice := ShowErrorDialog_Handler(oError)
	ELSE
		dwChoice := MessageBoxW(IntPtr.Zero, cMessage, cTitle, MB_ABORTRETRYIGNORE)
	ENDIF

	DO CASE
	CASE dwChoice = IDIGNORE
		IF oError:CanSubstitute
			RETURN NULL
		ELSE
			RETURN E_DEFAULT
		ENDIF

	CASE dwChoice = IDRETRY
		RETURN E_RETRY
	ENDCASE

	IF CanBreak()
		THROW XSharp.Internal.WrappedException{oError}
	ENDIF

	ErrorLevel(oError:Gencode)

	dwDefError := 0

	CoreDb.CloseAll()

	_Quit()

	RETURN NIL

INTERNAL FUNCTION __OpenErrorLog() AS IntPtr PASCAL

	LOCAL cFile                     AS STRING
	LOCAL cBuffer                   AS STRING
	LOCAL hfRet                     AS IntPtr

	cFile := WorkDir() + SetErrorLogFile()

	hfRet := FOpen2(cFile, FO_WRITE)

	IF hfRet != F_ERROR
		FSeek3( hfRet, 0, FS_END)
		FPutS( hfRet, "", 0)
	ELSE
		hfRet := FCreate2(cFile, FC_ARCHIVED)

		IF FError() = 3                          // path not found

			cFile :=""

			IF !GetDefaultDir() ==""
				cBuffer :="SetDefaultDir: " +GetDefaultDir()
				SetDefaultDir(NULL_PSZ)
			ELSE
				cBuffer :="SetDefault: " +GetDefault()
				SetDefault("")
			ENDIF

			//_IError(EG_ARG, .F., String2Psz(cBuffer))
			? cBuffer
		ENDIF
	ENDIF

	RETURN hfRet

INTERNAL FUNCTION __WriteErrorLog (hf AS IntPtr, cMsg AS STRING, oError AS Error) AS VOID PASCAL
   LOCAL cExe		AS STRING

	FPutS(hf, "***********************ERROR********************************")
	FPutS(hf, __VERSION__ )
	FPutS(hf, DateTime.Now:ToString())
	cExe	:= _ExecName()
	FPutS(hf, "Application: " + cExe )
	FPutS(hf, " " )
	FPutS(hf, "Error message:" )
	FPutS(hf, "--------------" )
	FPutS(hf, cMsg)

	FPutS(hf, "Error Object created:" )
	FPutS(hf, "--------------------" )
	FPutS(hf, "SubSystem       :" + AsString(oError:SubSystem) )
	FPutS(hf, "SubCode         :" + AsString(oError:SubCode)   )
	FPutS(hf, "GenCode         :" + ErrString(oError:Gencode ) )

	IF oError:SubCode = E_EXCEPTION
		FPutS(hf, "ExceptionCode   :" + oError:OSCode:ToString("X") )
		FPutS(hf, "ExceptionFlags  :" + oError:ArgType:ToString("X") )
		FPutS(hf, "ExceptionAddress:" + oError:FuncPtr:ToString("X") )
		FPutS(hf, "ParamNumber     :" + AsString(oError:ArgNum)    )
		FPutS(hf, "ExceptionInfo   :" + AsString(oError:FuncSym) )

	ELSE

		FPutS(hf, "OsCode          :" + oError:OSCode:ToString() )
		FPutS(hf, "ArgType         :" + TypeString(oError:ArgType    ) )
		FPutS(hf, "FuncPtr         :" + oError:FuncPtr:ToString()   )
		FPutS(hf, "ArgNum          :" + oError:ArgNum:ToString()    )
		FPutS(hf, "FuncSym         :" + oError:FuncSym:ToString()   )

	ENDIF

	FPutS(hf, "Severity        :" + AsString(oError:Severity ) )
	FPutS(hf, "CanDefault      :" + AsString(oError:CanDefault))
	FPutS(hf, "CanRetry        :" + AsString(oError:CanRetry ) )
	FPutS(hf, "CanSubstitute   :" + AsString(oError:CanSubstitute))
	FPutS(hf, "Operation       :" + AsString(oError:Operation) )
	FPutS(hf, "Description     :" + AsString(oError:Description))
	FPutS(hf, "FileName        :" + AsString(oError:FileName ) )
	FPutS(hf, "Tries           :" + AsString(oError:Tries    ) )
	FPutS(hf, "FileHandle      :" + AsString(oError:FileHandle))
	FPutS(hf, "SubCodeText     :" + AsString(oError:SubCodeText))
	FPutS(hf, "Arg             :" + AsString(oError:Arg) )
	FPutS(hf, "ArgTypeReq      :" + TypeString(oError:ArgTypeReq) )
	FPutS(hf, "MaxSize         :" + AsString(oError:MaxSize      ) )
	FPutS(hf, "SubstituteType  :" + TypeString(oError:SubstituteType))
	FPutS(hf, "CallFuncSym     :" + AsString(oError:CallFuncSym ) )
	FPutS(hf, "--------------------" )

	RETURN
INTERNAL _DLL FUNCTION MessageBoxW(hwnd AS IntPtr, lpText AS STRING, lpCaption AS STRING, uType AS DWORD)	AS INT PASCAL:USER32.MessageBoxW UNICODE

INTERNAL  DEFINE MB_ABORTRETRYIGNORE    := 0x00000002U

INTERNAL DEFINE IDOK            := 1
INTERNAL DEFINE IDCANCEL        := 2
INTERNAL DEFINE IDABORT         := 3
INTERNAL DEFINE IDRETRY         := 4
INTERNAL DEFINE IDIGNORE        := 5
INTERNAL DEFINE IDYES           := 6
INTERNAL DEFINE IDNO            := 7
INTERNAL DEFINE IDCLOSE         := 8
INTERNAL DEFINE IDHELP          :=9
INTERNAL DEFINE IDTRYAGAIN      := 10
INTERNAL DEFINE IDCONTINUE      := 11


[Codemodel] Fixes #656

[Codemodel] Fixes #656

//
// 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
USING System.Linq
USING System.Collections.Generic
USING System.Diagnostics
USING Mono.Cecil

BEGIN NAMESPACE XSharpModel
   /// <summary>
      /// Model for Namespace, Class, Interface, Structure, Enum
   /// </summary>
   [DebuggerDisplay("{ToString(),nq}")];
   CLASS XPETypeSymbol INHERIT XPESymbol IMPLEMENTS IXTypeSymbol
      PRIVATE _baseType       AS XPETypeSymbol
      PRIVATE _members        AS List<XPEMemberSymbol>
      PRIVATE _children       AS List<XPETypeSymbol>
      PRIVATE _signature      AS XTypeSignature
      PRIVATE _typeDef        AS TypeDefinition
      PRIVATE _initialized   := FALSE  AS LOGIC
      PROPERTY ShortName      AS STRING       AUTO GET INTERNAL SET
      PROPERTY TypeDef        AS TypeDefinition GET _typeDef

     CONSTRUCTOR(typedef as TypeDefinition, asm as XAssembly)
         SUPER(typedef:Name, GetKind(typedef), ConvertAttributes(typedef:Attributes), asm)
         SELF:_typeDef        := typedef
         SELF:_members        := List<XPEMemberSymbol>{}
         SELF:_children       := List<XPETypeSymbol>{}
         SELF:_signature      := XTypeSignature{"System.Object"}
         SELF:Namespace       := typedef:Namespace
         IF SELF:Namespace:Length == 0 .AND. typedef:DeclaringType != NULL
            // nested type !
            SELF:Namespace    := typedef:DeclaringType:FullName
         ENDIF
         IF typedef:BaseType != NULL
            SELF:BaseType     := RemoveGenericParameters(typedef:BaseType:FullName)
         ELSE
            SELF:BaseType     := ""
         ENDIF
         SELF:OriginalTypeName := typedef:FullName
         IF typedef:HasGenericParameters

            VAR cName          := SELF:Name
            VAR nsGeneric := FALSE
            VAR pos := cName:IndexOf('`')
            IF pos == -1
               cName := SELF:Namespace
               nsGeneric := TRUE
               pos := cName:IndexOf('`')
            ENDIF
            IF pos > 0
               cName := cName:Substring(0,pos)
               SELF:ShortName := cName
               SELF:_signature:ReadGenericParameters(typedef:GenericParameters)
               cName += _signature:GetTypeParameterNames()
               IF nsGeneric
                  SELF:Namespace := cName
               ELSE
                  SELF:Name := cName
               ENDIF
            ENDIF
         ENDIF

      PRIVATE STATIC METHOD GetKind(typedef as TypeDefinition) AS Kind
         IF typedef:BaseType != NULL
            SWITCH typedef:BaseType:FullName
            CASE "System.ValueType"
               RETURN Kind.Structure
            CASE "System.MulticastDelegate"
               RETURN Kind.Delegate
            END SWITCH
         ENDIF
         DO CASE
         CASE typedef:IsEnum
            RETURN Kind.Enum
         CASE typedef:IsClass
            RETURN Kind.Class
         CASE typedef:IsInterface
            RETURN Kind.Interface
         ENDCASE
         RETURN Kind.Structure

      STATIC METHOD ConvertAttributes (attributes AS TypeAttributes) as Modifiers
         var modifiers := Modifiers.None
         var visattributes := _AND(attributes, TypeAttributes.VisibilityMask)
         SWITCH visattributes
         CASE TypeAttributes.Public
            modifiers :=  Modifiers.Public
         CASE TypeAttributes.NotPublic
            modifiers := Modifiers.Private
         CASE TypeAttributes.NestedFamily
            modifiers := Modifiers.Protected
         CASE TypeAttributes.NestedAssembly
            modifiers := Modifiers.Internal
         CASE TypeAttributes.NestedFamANDAssem
         CASE TypeAttributes.NestedFamORAssem
            modifiers := Modifiers.ProtectedInternal
         OTHERWISE
            modifiers := Modifiers.Public
         END SWITCH

         IF attributes:HasFlag(TypeAttributes.Abstract | TypeAttributes.Sealed)
            modifiers |= Modifiers.Static
         ELSEIF attributes:HasFlag(TypeAttributes.Abstract)
            modifiers |= Modifiers.Abstract
         ELSEIF attributes:HasFlag(TypeAttributes.Sealed)
            modifiers |= Modifiers.Sealed
         ENDIF
         IF attributes:HasFlag(TypeAttributes.Import)
            modifiers |= Modifiers.External
         ENDIF
         RETURN modifiers

      INTERNAL STATIC METHOD AddMembers(aMembers AS  List<XPEMemberSymbol>, typedef AS TypeDefinition, parent AS XPETypeSymbol) AS VOID

            IF typedef:HasMethods
               FOREACH VAR md IN typedef:Methods
                  // filter
                  IF md:IsPrivate .OR. md:IsAssembly
                     LOOP
                  ENDIF
                  VAR kind := Kind.Method
                  IF md:IsRuntimeSpecialName
                     VAR name := md:Name
                     IF name:StartsWith("set_")
                        LOOP
                     ELSEIF name:StartsWith("get_")
                        LOOP
                     ELSEIF name:StartsWith("op_")
                        kind := Kind.Operator
                     ELSEIF name:StartsWith(".ctor")
                        kind := Kind.Constructor
                     ENDIF
                  ENDIF
                  VAR xmember := XPEMethodSymbol{md,parent:Assembly}
                  IF xmember:Kind == Kind.Method      // this could have changed from Method to Function
                     xmember:Kind := kind
                  ENDIF
                  aMembers:Add(xmember)
                  xmember:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasProperties
               FOREACH VAR pd IN typedef:Properties
                  IF pd:GetMethod != NULL .AND. pd:GetMethod:IsPrivate
                     LOOP
                  ENDIF
                  VAR xprop := XPEPropertySymbol{pd,parent:Assembly}
                  aMembers:Add(xprop)
                  xprop:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasFields
               FOREACH VAR fd IN typedef:Fields
                  IF fd:IsPrivate
                     LOOP
                  ENDIF
                  VAR xField := XPEFieldSymbol{fd,parent:Assembly}
                  aMembers:Add(xField)
                  xField:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasEvents
               FOREACH VAR ed IN typedef:Events
                  IF ed:AddMethod != NULL .AND. ed:AddMethod:IsPrivate
                     LOOP
                  ENDIF
                  VAR xEvent := XPEEventSymbol{ed,parent:Assembly}
                  aMembers:Add(xEvent)
                  xEvent:Parent := parent

               NEXT
            ENDIF

      INTERNAL METHOD Resolve() AS VOID
         IF ! SELF:_initialized .AND. SELF:_typeDef != NULL
               VAR aMembers := List<XPEMemberSymbol>{}
               AddMembers(aMembers, SELF:_typeDef, SELF)
              // Get methods from parent class(es), recursively
              if SELF:Assembly != NULL .and. ! String.IsNullOrEmpty(SELF:BaseType)
                  _baseType := SystemTypeController.FindType(SELF:BaseType, SELF:Assembly:FullName)
                  if _baseType != NULL
                     _baseType:Resolve()
                     VAR basemembers := _baseType:XMembers:Where( { m => m.Kind != Kind.Constructor .AND. m.Visibility != Modifiers.Private })
                     aMembers:AddRange( basemembers )
                  ENDIF
               ENDIF

              // nested children ?
              IF _typeDef:HasNestedTypes
                  var aChildren := List<XPETypeSymbol>{}
                  FOREACH var child in _typeDef:NestedTypes
                     aChildren:Add(XPETypeSymbol{child,SELF:Assembly})
                  NEXT
                  BEGIN LOCK SELF
                     SELF:_children := aChildren
                  END LOCK
                ENDIF
               IF _typeDef:HasInterfaces
                  VAR isCoClass := FALSE
                  IF _typeDef:HasCustomAttributes
                    isCoClass := _typeDef:CustomAttributes:FirstOrDefault( { x => x:AttributeType:FullName == "System.Runtime.InteropServices.CoClassAttribute"}) != NULL
                  ENDIF
                  FOREACH VAR @@interface IN _typeDef:Interfaces
                     VAR ifname := @@interface:InterfaceType:FullName
                     // cecil returns System.Collections.Generic.IList`1<T> for the FullName
                     VAR LtPos := ifname:IndexOf(c'<')
                     IF  LtPos > 0 .AND. ifname:Contains(c'`')
                          ifname := ifname:Substring(0, LtPos)
                     ENDIF
                     SELF:_signature:AddInterface(ifname)
                     VAR mod := _typeDef:Module
                     // see if we can find the type behind the interface in our assembly
                     // and if we do then update the member list
                     // this is especially needed with AdoDb where the Connection interface
                     // has no members but inherits all its members from 2 other interfaces
                     VAR ifType := mod:GetType(ifname)
                     IF ifType != NULL .AND. isCoClass
                        AddMembers(aMembers, ifType, SELF)
                     ENDIF

                  NEXT
                ENDIF
              BEGIN LOCK SELF
                  // now add to
                  SELF:_members:Clear()
                  SELF:_members:AddRange(aMembers)
              END LOCK

              SELF:_initialized := TRUE
         ENDIF
         RETURN

      METHOD GetMembers(elementName AS STRING) AS IList<IXMemberSymbol>
         VAR tempMembers := List<IXMemberSymbol>{}
          IF elementName:StartsWith("@@")
                elementName := elementName:Substring(2)
          ENDIF
          SELF:Resolve()
          IF ! String.IsNullOrEmpty(elementName)
            tempMembers:AddRange(SELF:_members:Where ( {m => m.Name.StartsWith(elementName, StringComparison.OrdinalIgnoreCase) }))
          ELSE
            tempMembers:AddRange(SELF:_members)
          ENDIF
         RETURN tempMembers

      METHOD GetMembers(elementName AS STRING, lExact AS LOGIC) AS IList<IXMemberSymbol>
      IF elementName:StartsWith("@@")
            elementName := elementName:Substring(2)
      ENDIF
      IF lExact
         SELF:Resolve()
         var result := List<IXMemberSymbol>{}
         result:AddRange(SELF:_members:Where ( {m => m.Name.Equals(elementName, StringComparison.OrdinalIgnoreCase) }))
         RETURN result
      ELSE
         RETURN SELF:GetMembers(elementName)
      ENDIF

      PROPERTY Members AS IList<IXMemberSymbol>
         GET
            SELF:Resolve()
            VAR members := List<IXMemberSymbol>{}
            members:AddRange(SELF:_members)
            RETURN members
         END GET
      END PROPERTY

      PROPERTY XMembers AS IList<XPEMemberSymbol>
         GET
            SELF:Resolve()
            RETURN SELF:_members:ToArray()
         END GET
      END PROPERTY

      PROPERTY FullName AS STRING   GET SELF:GetFullName()

      PROPERTY Description AS STRING GET SELF:GetDescription()

      PROPERTY IsNested  AS LOGIC GET SELF:Parent IS XPETypeSymbol
      PROPERTY IsGeneric as LOGIC GET _typeDef:HasGenericParameters
      PROPERTY IsStatic  AS LOGIC GET _typeDef:Attributes:HasFlag(TypeAttributes.Abstract |TypeAttributes.Sealed)
      PROPERTY Location AS STRING GET SELF:Assembly:DisplayName

      PROPERTY Children   AS IList<IXTypeSymbol>
         GET
            return (IList<IXTypeSymbol> ) SELF:_children
         END GET
      END PROPERTY

      PROPERTY XChildren   AS IList<XPETypeSymbol>
         GET
            BEGIN LOCK SELF
               return SELF:_children
            END LOCK
         END GET
      END PROPERTY

      PROPERTY Interfaces  AS IList<STRING>
            GET
                SELF:Resolve()
                RETURN _signature:Interfaces:ToArray()
            END GET
      END PROPERTY

      PROPERTY BaseType AS STRING GET SELF:_signature:BaseType SET SELF:_signature:BaseType := @@value

      METHOD AddTypeParameter(name AS STRING) AS VOID
         SELF:_signature:AddTypeParameter(name)

      METHOD AddConstraints(name AS STRING) AS VOID
         SELF:_signature:AddConstraints(name)

      PROPERTY TypeParameters as IList<STRING> GET SELF:_signature:TypeParameters:ToArray()
      PROPERTY TypeParameterConstraints as IList<STRING> GET SELF:_signature:TypeParameterContraints:ToArray()

      PROPERTY XMLSignature   AS STRING GET SELF:GetXmlSignature()

   METHOD ToString() AS STRING
      var result := i"{Kind} {Name}"
      RETURN result

   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
USING System.Linq
USING System.Collections.Generic
USING System.Diagnostics
USING Mono.Cecil

BEGIN NAMESPACE XSharpModel
   /// <summary>
      /// Model for Namespace, Class, Interface, Structure, Enum
   /// </summary>
   [DebuggerDisplay("{ToString(),nq}")];
   CLASS XPETypeSymbol INHERIT XPESymbol IMPLEMENTS IXTypeSymbol
      PRIVATE _baseType       AS XPETypeSymbol
      PRIVATE _members        AS List<XPEMemberSymbol>
      PRIVATE _children       AS List<XPETypeSymbol>
      PRIVATE _signature      AS XTypeSignature
      PRIVATE _typeDef        AS TypeDefinition
      PRIVATE _initialized   := FALSE  AS LOGIC
      PROPERTY ShortName      AS STRING       AUTO GET INTERNAL SET
      PROPERTY TypeDef        AS TypeDefinition GET _typeDef

     CONSTRUCTOR(typedef as TypeDefinition, asm as XAssembly)
         SUPER(typedef:Name, GetKind(typedef), ConvertAttributes(typedef:Attributes), asm)
         SELF:_typeDef        := typedef
         SELF:_members        := List<XPEMemberSymbol>{}
         SELF:_children       := List<XPETypeSymbol>{}
         SELF:_signature      := XTypeSignature{"System.Object"}
         SELF:Namespace       := typedef:Namespace
         IF SELF:Namespace:Length == 0 .AND. typedef:DeclaringType != NULL
            // nested type !
            SELF:Namespace    := typedef:DeclaringType:FullName
         ENDIF
         IF typedef:BaseType != NULL
            SELF:BaseType     := RemoveGenericParameters(typedef:BaseType:FullName)
         ELSE
            SELF:BaseType     := ""
         ENDIF
         SELF:OriginalTypeName := typedef:FullName
         IF typedef:HasGenericParameters

            VAR cName          := SELF:Name
            VAR nsGeneric := FALSE
            VAR pos := cName:IndexOf('`')
            IF pos == -1
               cName := SELF:Namespace
               nsGeneric := TRUE
               pos := cName:IndexOf('`')
            ENDIF
            IF pos > 0
               cName := cName:Substring(0,pos)
               SELF:ShortName := cName
               SELF:_signature:ReadGenericParameters(typedef:GenericParameters)
               cName += _signature:GetTypeParameterNames()
               IF nsGeneric
                  SELF:Namespace := cName
               ELSE
                  SELF:Name := cName
               ENDIF
            ENDIF
         ENDIF

      PRIVATE STATIC METHOD GetKind(typedef as TypeDefinition) AS Kind
         IF typedef:BaseType != NULL
            SWITCH typedef:BaseType:FullName
            CASE "System.ValueType"
               RETURN Kind.Structure
            CASE "System.MulticastDelegate"
               RETURN Kind.Delegate
            END SWITCH
         ENDIF
         DO CASE
         CASE typedef:IsEnum
            RETURN Kind.Enum
         CASE typedef:IsClass
            RETURN Kind.Class
         CASE typedef:IsInterface
            RETURN Kind.Interface
         ENDCASE
         RETURN Kind.Structure

      STATIC METHOD ConvertAttributes (attributes AS TypeAttributes) as Modifiers
         var modifiers := Modifiers.None
         var visattributes := _AND(attributes, TypeAttributes.VisibilityMask)
         SWITCH visattributes
         CASE TypeAttributes.Public
            modifiers :=  Modifiers.Public
         CASE TypeAttributes.NotPublic
            modifiers := Modifiers.Private
         CASE TypeAttributes.NestedFamily
            modifiers := Modifiers.Protected
         CASE TypeAttributes.NestedAssembly
            modifiers := Modifiers.Internal
         CASE TypeAttributes.NestedFamANDAssem
         CASE TypeAttributes.NestedFamORAssem
            modifiers := Modifiers.ProtectedInternal
         OTHERWISE
            modifiers := Modifiers.Public
         END SWITCH

         IF attributes:HasFlag(TypeAttributes.Abstract | TypeAttributes.Sealed)
            modifiers |= Modifiers.Static
         ELSEIF attributes:HasFlag(TypeAttributes.Abstract)
            modifiers |= Modifiers.Abstract
         ELSEIF attributes:HasFlag(TypeAttributes.Sealed)
            modifiers |= Modifiers.Sealed
         ENDIF
         IF attributes:HasFlag(TypeAttributes.Import)
            modifiers |= Modifiers.External
         ENDIF
         RETURN modifiers

      INTERNAL STATIC METHOD AddMembers(aMembers AS  List<XPEMemberSymbol>, typedef AS TypeDefinition, parent AS XPETypeSymbol) AS VOID

            IF typedef:HasMethods
               FOREACH VAR md IN typedef:Methods
                  // filter
                  IF md:IsPrivate
                     LOOP
                  ENDIF
                  VAR kind := Kind.Method
                  IF md:IsRuntimeSpecialName
                     VAR name := md:Name
                     IF name:StartsWith("set_")
                        LOOP
                     ELSEIF name:StartsWith("get_")
                        LOOP
                     ELSEIF name:StartsWith("op_")
                        kind := Kind.Operator
                     ELSEIF name:StartsWith(".ctor")
                        kind := Kind.Constructor
                     ENDIF
                  ENDIF
                  VAR xmember := XPEMethodSymbol{md,parent:Assembly}
                  IF xmember:Kind == Kind.Method      // this could have changed from Method to Function
                     xmember:Kind := kind
                  ENDIF
                  aMembers:Add(xmember)
                  xmember:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasProperties
               FOREACH VAR pd IN typedef:Properties
                  IF pd:GetMethod != NULL .AND. pd:GetMethod:IsPrivate
                     LOOP
                  ENDIF
                  VAR xprop := XPEPropertySymbol{pd,parent:Assembly}
                  aMembers:Add(xprop)
                  xprop:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasFields
               FOREACH VAR fd IN typedef:Fields
                  IF fd:IsPrivate
                     LOOP
                  ENDIF
                  VAR xField := XPEFieldSymbol{fd,parent:Assembly}
                  aMembers:Add(xField)
                  xField:Parent := parent
               NEXT
            ENDIF
            IF typedef:HasEvents
               FOREACH VAR ed IN typedef:Events
                  IF ed:AddMethod != NULL .AND. ed:AddMethod:IsPrivate
                     LOOP
                  ENDIF
                  VAR xEvent := XPEEventSymbol{ed,parent:Assembly}
                  aMembers:Add(xEvent)
                  xEvent:Parent := parent

               NEXT
            ENDIF

      INTERNAL METHOD Resolve() AS VOID
         IF ! SELF:_initialized .AND. SELF:_typeDef != NULL
               VAR aMembers := List<XPEMemberSymbol>{}
               AddMembers(aMembers, SELF:_typeDef, SELF)
              // Get methods from parent class(es), recursively
              if SELF:Assembly != NULL .and. ! String.IsNullOrEmpty(SELF:BaseType)
                  _baseType := SystemTypeController.FindType(SELF:BaseType, SELF:Assembly:FullName)
                  if _baseType != NULL
                     _baseType:Resolve()
                     VAR basemembers := _baseType:XMembers:Where( { m => m.Kind != Kind.Constructor .AND. m.Visibility != Modifiers.Private })
                     aMembers:AddRange( basemembers )
                  ENDIF
               ENDIF

              // nested children ?
              IF _typeDef:HasNestedTypes
                  var aChildren := List<XPETypeSymbol>{}
                  FOREACH var child in _typeDef:NestedTypes
                     aChildren:Add(XPETypeSymbol{child,SELF:Assembly})
                  NEXT
                  BEGIN LOCK SELF
                     SELF:_children := aChildren
                  END LOCK
               ENDIF
               IF _typeDef:HasInterfaces
                  FOREACH VAR @@interface IN _typeDef:Interfaces
                     VAR ifname := @@interface:InterfaceType:FullName
                     // cecil returns System.Collections.Generic.IList`1<T> for the FullName
                     var LtPos := ifname:IndexOf(c'<')
                     IF  LtPos > 0 .AND. ifname:Contains(c'`')
                          ifname := ifname:Substring(0, LtPos)
                     ENDIF
                     SELF:_signature:AddInterface(ifname)
                     VAR mod := _typeDef:Module
                     // see if we can find the type behind the interface in our assembly
                     // and if we do then update the member list
                     // this is especially needed with AdoDb where the Connection interface
                     // has no members but inherits all its members from 2 other interfaces
                     VAR ifType := mod:GetType(ifname)
                     IF ifType != NULL
                        AddMembers(aMembers, ifType, SELF)
                     ENDIF

                  NEXT
               ENDIF
              BEGIN LOCK SELF
                  // now add to
                  SELF:_members:Clear()
                  SELF:_members:AddRange(aMembers)
              END LOCK

              SELF:_initialized := TRUE
         ENDIF
         RETURN

      METHOD GetMembers(elementName AS STRING) AS IList<IXMemberSymbol>
         VAR tempMembers := List<IXMemberSymbol>{}
          IF elementName:StartsWith("@@")
                elementName := elementName:Substring(2)
          ENDIF
          SELF:Resolve()
          IF ! String.IsNullOrEmpty(elementName)
            tempMembers:AddRange(SELF:_members:Where ( {m => m.Name.StartsWith(elementName, StringComparison.OrdinalIgnoreCase) }))
          ELSE
            tempMembers:AddRange(SELF:_members)
          ENDIF
         RETURN tempMembers

      METHOD GetMembers(elementName AS STRING, lExact AS LOGIC) AS IList<IXMemberSymbol>
      IF elementName:StartsWith("@@")
            elementName := elementName:Substring(2)
      ENDIF
      IF lExact
         SELF:Resolve()
         var result := List<IXMemberSymbol>{}
         result:AddRange(SELF:_members:Where ( {m => m.Name.Equals(elementName, StringComparison.OrdinalIgnoreCase) }))
         RETURN result
      ELSE
         RETURN SELF:GetMembers(elementName)
      ENDIF

      PROPERTY Members AS IList<IXMemberSymbol>
         GET
            SELF:Resolve()
            VAR members := List<IXMemberSymbol>{}
            members:AddRange(SELF:_members)
            RETURN members
         END GET
      END PROPERTY

      PROPERTY XMembers AS IList<XPEMemberSymbol>
         GET
            SELF:Resolve()
            RETURN SELF:_members:ToArray()
         END GET
      END PROPERTY

      PROPERTY FullName AS STRING   GET SELF:GetFullName()

      PROPERTY Description AS STRING GET SELF:GetDescription()

      PROPERTY IsNested  AS LOGIC GET SELF:Parent IS XPETypeSymbol
      PROPERTY IsGeneric as LOGIC GET _typeDef:HasGenericParameters
      PROPERTY IsStatic  AS LOGIC GET _typeDef:Attributes:HasFlag(TypeAttributes.Abstract |TypeAttributes.Sealed)
      PROPERTY Location AS STRING GET SELF:Assembly:DisplayName

      PROPERTY Children   AS IList<IXTypeSymbol>
         GET
            return (IList<IXTypeSymbol> ) SELF:_children
         END GET
      END PROPERTY

      PROPERTY XChildren   AS IList<XPETypeSymbol>
         GET
            BEGIN LOCK SELF
               return SELF:_children
            END LOCK
         END GET
      END PROPERTY

      PROPERTY Interfaces  AS IList<STRING>
            GET
                SELF:Resolve()
                RETURN _signature:Interfaces:ToArray()
            END GET
      END PROPERTY

      PROPERTY BaseType AS STRING GET SELF:_signature:BaseType SET SELF:_signature:BaseType := @@value

      METHOD AddTypeParameter(name AS STRING) AS VOID
         SELF:_signature:AddTypeParameter(name)

      METHOD AddConstraints(name AS STRING) AS VOID
         SELF:_signature:AddConstraints(name)

      PROPERTY TypeParameters as IList<STRING> GET SELF:_signature:TypeParameters:ToArray()
      PROPERTY TypeParameterConstraints as IList<STRING> GET SELF:_signature:TypeParameterContraints:ToArray()

      PROPERTY XMLSignature   AS STRING GET SELF:GetXmlSignature()

   METHOD ToString() AS STRING
      var result := i"{Kind} {Name}"
      RETURN result

   END CLASS

END NAMESPACE


codegen/QtScriptTools: updated

codegen/QtScriptTools: updated

Modified:
codegen/QtScriptTools/QScriptEngineDebugger.prg

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

$project=Qt4xHb
$module=QtScriptTools

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=QObject

$addMethods

$addSignals

$endClass

$destructor

#pragma BEGINDUMP

$includes

#include <QtGui/QAction>
#include <QtGui/QMenu>
#include <QtGui/QToolBar>
#include <QtGui/QMainWindow>

$prototype=QScriptEngineDebugger ( QObject * parent = 0 )
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action ( DebuggerAction action ) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo ( QScriptEngine * engine )
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow () const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu ( QWidget * parent = 0 )
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar ( QWidget * parent = 0 )
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach ()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow ( bool autoShow )
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow () const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state () const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget ( DebuggerWidget widget ) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signal=|evaluationResumed()
$signal=|evaluationSuspended()
$endSignals

#pragma ENDDUMP

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

$project=Qt4xHb
$module=QtScriptTools

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=QObject

$addMethods

$addSignals

$endClass

$destructor

#pragma BEGINDUMP

$includes

#include <QAction>
#include <QMenu>
#include <QToolBar>
#include <QMainWindow>

$prototype=QScriptEngineDebugger ( QObject * parent = 0 )
$constructor=|new|QObject *=0

$deleteMethod

$prototype=QAction * action ( DebuggerAction action ) const
$method=|QAction *|action|QScriptEngineDebugger::DebuggerAction

$prototype=void attachTo ( QScriptEngine * engine )
$method=|void|attachTo|QScriptEngine *

$prototype=bool autoShowStandardWindow () const
$method=|bool|autoShowStandardWindow|

$prototype=QMenu * createStandardMenu ( QWidget * parent = 0 )
$method=|QMenu *|createStandardMenu|QWidget *=0

$prototype=QToolBar * createStandardToolBar ( QWidget * parent = 0 )
$method=|QToolBar *|createStandardToolBar|QWidget *=0

$prototype=void detach ()
$method=|void|detach|

$prototype=void setAutoShowStandardWindow ( bool autoShow )
$method=|void|setAutoShowStandardWindow|bool

$prototype=QMainWindow * standardWindow () const
$method=|QMainWindow *|standardWindow|

$prototype=DebuggerState state () const
$method=|QScriptEngineDebugger::DebuggerState|state|

$prototype=QWidget * widget ( DebuggerWidget widget ) const
$method=|QWidget *|widget|QScriptEngineDebugger::DebuggerWidget

$beginSignals
$signal=|evaluationResumed()
$signal=|evaluationSuspended()
$endSignals

#pragma ENDDUMP


QtSvg: data for code generation updated

QtSvg: data for code generation updated

Modified:
codegen/QtSvg/QSvgRenderer.prg

$header

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QRECTF
REQUEST QSIZE
REQUEST QMATRIX
REQUEST QRECT
#endif

CLASS QSvgRenderer INHERIT QObject

   METHOD new
   METHOD delete
   METHOD animated
   METHOD boundsOnElement
   METHOD defaultSize
   METHOD elementExists
   METHOD framesPerSecond
   METHOD isValid
   METHOD matrixForElement
   METHOD setFramesPerSecond
   METHOD setViewBox
   METHOD viewBox
   METHOD viewBoxF
   METHOD load
   METHOD render

   METHOD onRepaintNeeded

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

/*
QSvgRenderer ( QObject * parent = 0 )
*/
$internalConstructor=|new1|QObject *=0

/*
QSvgRenderer ( const QString & filename, QObject * parent = 0 )
*/
$internalConstructor=|new2|const QString &,QObject *=0

/*
QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
*/
$internalConstructor=|new3|const QByteArray &,QObject *=0

/*
QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )
*/
$internalConstructor=|new4|QXmlStreamReader *,QObject *=0

//[1]QSvgRenderer ( QObject * parent = 0 )
//[2]QSvgRenderer ( const QString & filename, QObject * parent = 0 )
//[3]QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
//[4]QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )

HB_FUNC_STATIC( QSVGRENDERER_NEW )
{
  if( ISBETWEEN(0,1) && ISOPTQOBJECT(1) )
  {
    QSvgRenderer_new1();
  }
  else if( ISBETWEEN(1,2) && ISCHAR(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new2();
  }
  else if( ISBETWEEN(1,2) && ISQBYTEARRAY(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new3();
  }
  else if( ISBETWEEN(1,2) && ISQXMLSTREAMREADER(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new4();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod

/*
bool animated () const
*/
$method=|bool|animated|

/*
QRectF boundsOnElement ( const QString & id ) const
*/
$method=|QRectF|boundsOnElement|const QString &

/*
QSize defaultSize () const
*/
$method=|QSize|defaultSize|

/*
bool elementExists ( const QString & id ) const
*/
$method=|bool|elementExists|const QString &

/*
int framesPerSecond () const
*/
$method=|int|framesPerSecond|

/*
bool isValid () const
*/
$method=|bool|isValid|

/*
QMatrix matrixForElement ( const QString & id ) const
*/
$method=|QMatrix|matrixForElement|const QString &

/*
void setFramesPerSecond ( int num )
*/
$method=|void|setFramesPerSecond|int

/*
void setViewBox ( const QRect & viewbox )
*/
$internalMethod=|void|setViewBox,setViewBox1|const QRect &

/*
void setViewBox ( const QRectF & viewbox )
*/
$internalMethod=|void|setViewBox,setViewBox2|const QRectF &

//[1]void setViewBox ( const QRect & viewbox )
//[2]void setViewBox ( const QRectF & viewbox )

HB_FUNC_STATIC( QSVGRENDERER_SETVIEWBOX )
{
  if( ISNUMPAR(1) && ISQRECT(1) )
  {
    QSvgRenderer_setViewBox1();
  }
  else if( ISNUMPAR(1) && ISQRECTF(1) )
  {
    QSvgRenderer_setViewBox2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
QRect viewBox () const
*/
$method=|QRect|viewBox|

/*
QRectF viewBoxF () const
*/
$method=|QRectF|viewBoxF|

/*
bool load ( const QString & filename )
*/
$internalMethod=|bool|load,load1|const QString &

/*
bool load ( const QByteArray & contents )
*/
$internalMethod=|bool|load,load2|const QByteArray &

/*
bool load ( QXmlStreamReader * contents )
*/
$internalMethod=|bool|load,load3|QXmlStreamReader *

//[1]bool load ( const QString & filename )
//[2]bool load ( const QByteArray & contents )
//[3]bool load ( QXmlStreamReader * contents )

HB_FUNC_STATIC( QSVGRENDERER_LOAD )
{
  if( ISNUMPAR(1) && ISCHAR(1) )
  {
    QSvgRenderer_load1();
  }
  else if( ISNUMPAR(1) && ISQBYTEARRAY(1) )
  {
    QSvgRenderer_load2();
  }
  else if( ISNUMPAR(1) && ISQXMLSTREAMREADER(1) )
  {
    QSvgRenderer_load3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void render ( QPainter * painter )
*/
$internalMethod=|void|render,render1|QPainter *

/*
void render ( QPainter * painter, const QRectF & bounds )
*/
$internalMethod=|void|render,render2|QPainter *,const QRectF &

/*
void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )
*/
$internalMethod=|void|render,render3|QPainter *,const QString &,const QRectF &=QRectF()

//[1]void render ( QPainter * painter )
//[2]void render ( QPainter * painter, const QRectF & bounds )
//[3]void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )

HB_FUNC_STATIC( QSVGRENDERER_RENDER )
{
  if( ISNUMPAR(1) && ISQPAINTER(1) )
  {
    QSvgRenderer_render1();
  }
  else if( ISNUMPAR(2) && ISQPAINTER(1) && ISQRECTF(2) )
  {
    QSvgRenderer_render2();
  }
  else if( ISBETWEEN(2,3) && ISQPAINTER(1) && ISCHAR(2) && (ISQRECTF(3)||ISNIL(3)) )
  {
    QSvgRenderer_render3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

#pragma ENDDUMP

$header

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QRECTF
REQUEST QSIZE
REQUEST QMATRIX
REQUEST QRECT
#endif

CLASS QSvgRenderer INHERIT QObject

   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD animated
   METHOD boundsOnElement
   METHOD defaultSize
   METHOD elementExists
   METHOD framesPerSecond
   METHOD isValid
   METHOD matrixForElement
   METHOD setFramesPerSecond
   METHOD setViewBox
   METHOD viewBox
   METHOD viewBoxF
   METHOD load
   METHOD render

   METHOD onRepaintNeeded

   DESTRUCTOR destroyObject

END CLASS

$destructor

#pragma BEGINDUMP

$includes

/*
QSvgRenderer ( QObject * parent = 0 )
*/
$internalConstructor=|new1|QObject *=0

/*
QSvgRenderer ( const QString & filename, QObject * parent = 0 )
*/
$internalConstructor=|new2|const QString &,QObject *=0

/*
QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
*/
$internalConstructor=|new3|const QByteArray &,QObject *=0

/*
QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )
*/
$internalConstructor=|new4|QXmlStreamReader *,QObject *=0

//[1]QSvgRenderer ( QObject * parent = 0 )
//[2]QSvgRenderer ( const QString & filename, QObject * parent = 0 )
//[3]QSvgRenderer ( const QByteArray & contents, QObject * parent = 0 )
//[4]QSvgRenderer ( QXmlStreamReader * contents, QObject * parent = 0 )

HB_FUNC_STATIC( QSVGRENDERER_NEW )
{
  if( ISBETWEEN(0,1) && ISOPTQOBJECT(1) )
  {
    QSvgRenderer_new1();
  }
  else if( ISBETWEEN(1,2) && ISCHAR(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new2();
  }
  else if( ISBETWEEN(1,2) && ISQBYTEARRAY(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new3();
  }
  else if( ISBETWEEN(1,2) && ISQXMLSTREAMREADER(1) && ISOPTQOBJECT(2) )
  {
    QSvgRenderer_new4();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod

/*
bool animated () const
*/
$method=|bool|animated|

/*
QRectF boundsOnElement ( const QString & id ) const
*/
$method=|QRectF|boundsOnElement|const QString &

/*
QSize defaultSize () const
*/
$method=|QSize|defaultSize|

/*
bool elementExists ( const QString & id ) const
*/
$method=|bool|elementExists|const QString &

/*
int framesPerSecond () const
*/
$method=|int|framesPerSecond|

/*
bool isValid () const
*/
$method=|bool|isValid|

/*
QMatrix matrixForElement ( const QString & id ) const
*/
$method=|QMatrix|matrixForElement|const QString &

/*
void setFramesPerSecond ( int num )
*/
$method=|void|setFramesPerSecond|int

/*
void setViewBox ( const QRect & viewbox )
*/
$internalMethod=|void|setViewBox,setViewBox1|const QRect &

/*
void setViewBox ( const QRectF & viewbox )
*/
$internalMethod=|void|setViewBox,setViewBox2|const QRectF &

//[1]void setViewBox ( const QRect & viewbox )
//[2]void setViewBox ( const QRectF & viewbox )

HB_FUNC_STATIC( QSVGRENDERER_SETVIEWBOX )
{
  if( ISNUMPAR(1) && ISQRECT(1) )
  {
    QSvgRenderer_setViewBox1();
  }
  else if( ISNUMPAR(1) && ISQRECTF(1) )
  {
    QSvgRenderer_setViewBox2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
QRect viewBox () const
*/
$method=|QRect|viewBox|

/*
QRectF viewBoxF () const
*/
$method=|QRectF|viewBoxF|

/*
bool load ( const QString & filename )
*/
$internalMethod=|bool|load,load1|const QString &

/*
bool load ( const QByteArray & contents )
*/
$internalMethod=|bool|load,load2|const QByteArray &

/*
bool load ( QXmlStreamReader * contents )
*/
$internalMethod=|bool|load,load3|QXmlStreamReader *

//[1]bool load ( const QString & filename )
//[2]bool load ( const QByteArray & contents )
//[3]bool load ( QXmlStreamReader * contents )

HB_FUNC_STATIC( QSVGRENDERER_LOAD )
{
  if( ISNUMPAR(1) && ISCHAR(1) )
  {
    QSvgRenderer_load1();
  }
  else if( ISNUMPAR(1) && ISQBYTEARRAY(1) )
  {
    QSvgRenderer_load2();
  }
  else if( ISNUMPAR(1) && ISQXMLSTREAMREADER(1) )
  {
    QSvgRenderer_load3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

/*
void render ( QPainter * painter )
*/
$internalMethod=|void|render,render1|QPainter *

/*
void render ( QPainter * painter, const QRectF & bounds )
*/
$internalMethod=|void|render,render2|QPainter *,const QRectF &

/*
void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )
*/
$internalMethod=|void|render,render3|QPainter *,const QString &,const QRectF &=QRectF()

//[1]void render ( QPainter * painter )
//[2]void render ( QPainter * painter, const QRectF & bounds )
//[3]void render ( QPainter * painter, const QString & elementId, const QRectF & bounds = QRectF() )

HB_FUNC_STATIC( QSVGRENDERER_RENDER )
{
  if( ISNUMPAR(1) && ISQPAINTER(1) )
  {
    QSvgRenderer_render1();
  }
  else if( ISNUMPAR(2) && ISQPAINTER(1) && ISQRECTF(2) )
  {
    QSvgRenderer_render2();
  }
  else if( ISBETWEEN(2,3) && ISQPAINTER(1) && ISCHAR(2) && (ISQRECTF(3)||ISNIL(3)) )
  {
    QSvgRenderer_render3();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

#pragma ENDDUMP


codegen/QtLocation: updated

codegen/QtLocation: updated

Modified:
codegen/QtLocation/QGeoRoute.prg

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

$project=Qt5xHb
$module=QtLocation

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=

$addMethods

$endClass

$destructor

#pragma BEGINDUMP

$includes=5,4,0

#include <QtPositioning/QGeoRectangle>
#include <QtLocation/QGeoRouteSegment>

$prototype=QGeoRoute()
$internalConstructor=5,4,0|new1|

$prototype=QGeoRoute(const QGeoRoute &other)
$internalConstructor=5,4,0|new2|const QGeoRoute &

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

HB_FUNC_STATIC( QGEOROUTE_NEW )
{
  if( ISNUMPAR(0) )
  {
    QGeoRoute_new1();
  }
  else if( ISNUMPAR(1) && ISQGEOMANEUVER(1) )
  {
    QGeoRoute_new2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod=5,4,0

$prototype=void setRouteId(const QString &id)
$method=5,4,0|void|setRouteId|const QString &

$prototype=QString routeId() const
$method=5,4,0|QString|routeId|

$prototype=void setRequest(const QGeoRouteRequest &request)
$method=5,4,0|void|setRequest|const QGeoRouteRequest &

$prototype=QGeoRouteRequest request() const
$method=5,4,0|QGeoRouteRequest|request|

$prototype=void setBounds(const QGeoRectangle &bounds)
$method=5,4,0|void|setBounds|const QGeoRectangle &

$prototype=QGeoRectangle bounds() const
$method=5,4,0|QGeoRectangle|bounds|

$prototype=void setFirstRouteSegment(const QGeoRouteSegment &routeSegment)
$method=5,4,0|void|setFirstRouteSegment|const QGeoRouteSegment &

$prototype=QGeoRouteSegment firstRouteSegment() const
$method=5,4,0|QGeoRouteSegment|firstRouteSegment|

$prototype=void setTravelTime(int secs)
$method=5,4,0|void|setTravelTime|int

$prototype=int travelTime() const
$method=5,4,0|int|travelTime|

$prototype=void setDistance(qreal distance)
$method=5,4,0|void|setDistance|qreal

$prototype=qreal distance() const
$method=5,4,0|qreal|distance|

$prototype=void setTravelMode(QGeoRouteRequest::TravelMode mode)
$method=5,4,0|void|setTravelMode|QGeoRouteRequest::TravelMode

$prototype=QGeoRouteRequest::TravelMode travelMode() const
$method=5,4,0|QGeoRouteRequest::TravelMode|travelMode|

$prototype=void setPath(const QList<QGeoCoordinate> &path)
$method=5,4,0|void|setPath|const QList<QGeoCoordinate> &

$prototype=QList<QGeoCoordinate> path() const
$method=5,4,0|QList<QGeoCoordinate>|path|

$prototype=QList<QGeoRouteLeg> QGeoRoute::routeLegs() const
%% TODO: $method=5,12,0|QList<QGeoRouteLeg>|routeLegs|

$prototype=void QGeoRoute::setRouteLegs(const QList<QGeoRouteLeg> &legs)
%% TODO: $method=5,12,0|void|setRouteLegs|const QList<QGeoRouteLeg> &

$extraMethods

#pragma ENDDUMP

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

$project=Qt5xHb
$module=QtLocation

$header

#include "hbclass.ch"

$addRequests

$beginClassFrom=

$addMethods

$endClass

$destructor

#pragma BEGINDUMP

$includes=5,4,0

#include <QtPositioning/QGeoRectangle>
#include <QtLocation/QGeoRouteSegment>

$prototype=QGeoRoute()
$internalConstructor=5,4,0|new1|

$prototype=QGeoRoute(const QGeoRoute &other)
$internalConstructor=5,4,0|new2|const QGeoRoute &

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

HB_FUNC_STATIC( QGEOROUTE_NEW )
{
  if( ISNUMPAR(0) )
  {
    QGeoRoute_new1();
  }
  else if( ISNUMPAR(1) && ISQGEOMANEUVER(1) )
  {
    QGeoRoute_new2();
  }
  else
  {
    hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
  }
}

$deleteMethod=5,4,0

$prototype=void setRouteId(const QString &id)
$method=5,4,0|void|setRouteId|const QString &

$prototype=QString routeId() const
$method=5,4,0|QString|routeId|

$prototype=void setRequest(const QGeoRouteRequest &request)
$method=5,4,0|void|setRequest|const QGeoRouteRequest &

$prototype=QGeoRouteRequest request() const
$method=5,4,0|QGeoRouteRequest|request|

$prototype=void setBounds(const QGeoRectangle &bounds)
$method=5,4,0|void|setBounds|const QGeoRectangle &

$prototype=QGeoRectangle bounds() const
$method=5,4,0|QGeoRectangle|bounds|

$prototype=void setFirstRouteSegment(const QGeoRouteSegment &routeSegment)
$method=5,4,0|void|setFirstRouteSegment|const QGeoRouteSegment &

$prototype=QGeoRouteSegment firstRouteSegment() const
$method=5,4,0|QGeoRouteSegment|firstRouteSegment|

$prototype=void setTravelTime(int secs)
$method=5,4,0|void|setTravelTime|int

$prototype=int travelTime() const
$method=5,4,0|int|travelTime|

$prototype=void setDistance(qreal distance)
$method=5,4,0|void|setDistance|qreal

$prototype=qreal distance() const
$method=5,4,0|qreal|distance|

$prototype=void setTravelMode(QGeoRouteRequest::TravelMode mode)
$method=5,4,0|void|setTravelMode|QGeoRouteRequest::TravelMode

$prototype=QGeoRouteRequest::TravelMode travelMode() const
$method=5,4,0|QGeoRouteRequest::TravelMode|travelMode|

$prototype=void setPath(const QList<QGeoCoordinate> &path)
$method=5,4,0|void|setPath|const QList<QGeoCoordinate> &

$prototype=QList<QGeoCoordinate> path() const
$method=5,4,0|QList<QGeoCoordinate>|path|

$prototype=QList<QGeoRouteLeg> QGeoRoute::routeLegs() const
$method=5,12,0|QList<QGeoRouteLeg>|routeLegs|

$prototype=void QGeoRoute::setRouteLegs(const QList<QGeoRouteLeg> &legs)
$method=5,12,0|void|setRouteLegs|const QList<QGeoRouteLeg> &

$extraMethods

#pragma ENDDUMP


[DBFNTX} small optimization

[DBFNTX} small optimization

//
// 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
USING System.Collections
USING System.Text
USING XSharp.Rdd.Support
USING XSharp.RDD.Enums
BEGIN NAMESPACE XSharp.RDD.NTX

    INTERNAL CLASS NtxSortCompare IMPLEMENTS IComparer
        PROTECTED _sortInfo AS DBSORTINFO
        PROTECTED _oRdd AS DBFNTX

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SELF:_oRdd := rdd
            SELF:_sortInfo := info

        PROTECTED VIRTUAL METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            RETURN 0

        PUBLIC METHOD Compare(x AS OBJECT , y AS OBJECT ) AS LONG
            RETURN XCompare( (SortRecord) x, (SortRecord) y)
    END CLASS

    INTERNAL CLASS NTXSortCompareDefault INHERIT NTXSortCompare

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SUPER(rdd, info)

        PROTECTED OVERRIDE METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            LOCAL dataBuffer AS BYTE[]
            LOCAL dataBuffer2 AS BYTE[]
            LOCAL diff AS LONG
            LOCAL iLen AS LONG
            //
            IF (x:Recno == y:Recno)
                RETURN 0
            ENDIF
            //
            dataBuffer  := x:data
            dataBuffer2 := y:data
            diff        := 0
            iLen        := SELF:_sortInfo:Items[0]:Length
            // comparison using string rules
            diff := RuntimeState.StringCompare(dataBuffer, dataBuffer2, iLen)
            IF diff != 0
                IF SELF:_sortInfo:Items[0]:Flags:HasFlag(DbSortFlags.Descending)
                    diff *= -1
                ENDIF
            ELSE
                IF x:Recno < y:Recno
                    diff := -1
                ELSE
                    diff := 1
                ENDIF
            ENDIF
            RETURN diff

    END CLASS

    INTERNAL CLASS NTXSortCompareAscii INHERIT NtxSortCompare

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SUPER(rdd, info)

        PROTECTED OVERRIDE METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            LOCAL dataBuffer AS BYTE[]
            LOCAL dataBuffer2 AS BYTE[]
            LOCAL diff AS LONG
            LOCAL i AS LONG
            LOCAL iLen AS LONG
            IF x:Recno == y:Recno
                RETURN 0
            ENDIF
            dataBuffer  := x:data
            dataBuffer2 := y:data
            diff        := 0
            iLen        := SELF:_sortInfo:Items[0]:Length -1
            FOR i := 0 TO iLen
                VAR b1 := dataBuffer[i]
                VAR b2 := dataBuffer2[i]
                IF b1 < b2
                    diff := -1
                ELSEIF b1 > b2
                    diff := 1
                ENDIF
                IF diff != 0
                    EXIT
                ENDIF
            NEXT
            IF diff != 0
                IF SELF:_sortInfo:Items[0]:Flags:HasFlag(DbSortFlags.Descending)
                    diff *= -1
                ENDIF
            ELSE
                IF x:Recno < y:Recno
                    diff := -1
                ELSE
                    diff := 1
                ENDIF
            ENDIF
            RETURN diff

    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
USING System.Collections
USING System.Text
USING XSharp.Rdd.Support
USING XSharp.RDD.Enums
BEGIN NAMESPACE XSharp.RDD.NTX

    INTERNAL CLASS NtxSortCompare IMPLEMENTS IComparer
        PROTECTED _sortInfo AS DBSORTINFO
        PROTECTED _oRdd AS DBFNTX

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SELF:_oRdd := rdd
            SELF:_sortInfo := info

        PROTECTED VIRTUAL METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            RETURN 0

        PUBLIC METHOD Compare(x AS OBJECT , y AS OBJECT ) AS LONG
            RETURN XCompare( (SortRecord) x, (SortRecord) y)
    END CLASS

    INTERNAL CLASS NTXSortCompareDefault INHERIT NTXSortCompare

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SUPER(rdd, info)

        PROTECTED OVERRIDE METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            LOCAL dataBuffer AS BYTE[]
            LOCAL dataBuffer2 AS BYTE[]
            LOCAL diff AS LONG
            LOCAL iLen AS LONG
            //
            IF (x:Recno == y:Recno)
                RETURN 0
            ENDIF
            //
            dataBuffer  := x:data
            dataBuffer2 := y:data
            diff        := 0
            iLen        := SELF:_sortInfo:Items[0]:Length
            // comparison using string rules
            diff := RuntimeState.StringCompare(dataBuffer, dataBuffer2, iLen)
            IF SELF:_sortInfo:Items[0]:Flags:HasFlag(DbSortFlags.Descending)
                diff *= -1
            ENDIF
            IF (diff == 0)
                IF x:Recno < y:Recno
                    diff := -1
                ELSE
                    diff := 1
                ENDIF
            ENDIF
            RETURN diff

    END CLASS

    INTERNAL CLASS NTXSortCompareAscii INHERIT NtxSortCompare

        INTERNAL CONSTRUCTOR( rdd AS DBFNTX , info AS DBSORTINFO )
            SUPER(rdd, info)

        PROTECTED OVERRIDE METHOD XCompare(x AS SortRecord , y AS SortRecord) AS LONG
            LOCAL dataBuffer AS BYTE[]
            LOCAL dataBuffer2 AS BYTE[]
            LOCAL diff AS LONG
            LOCAL i AS LONG
            LOCAL iLen AS LONG
            IF x:Recno == y:Recno
                RETURN 0
            ENDIF
            dataBuffer  := x:data
            dataBuffer2 := y:data
            diff        := 0
            iLen        := SELF:_sortInfo:Items[0]:Length -1
            FOR i := 0 TO iLen
                VAR b1 := dataBuffer[i]
                VAR b2 := dataBuffer2[i]
                IF b1 < b2
                    diff := -1
                ELSEIF b1 > b2
                    diff := 1
                ENDIF
                IF diff != 0
                    EXIT
                ENDIF
            NEXT
            IF SELF:_sortInfo:Items[0]:Flags:HasFlag(DbSortFlags.Descending)
                diff *= -1
            ENDIF
            IF (diff == 0)
                IF x:Recno < y:Recno
                    diff := -1
                ELSE
                    diff := 1
                ENDIF
            ENDIF
            RETURN diff

    END CLASS

END NAMESPACE