Fixes #1008

Fixes #1008

//
// 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 LanguageService.CodeAnalysis.Text
USING LanguageService.CodeAnalysis.XSharp
USING System.Diagnostics

BEGIN NAMESPACE XSharpModel
   /// <summary>
      /// Model for Namespace, Class, Interface, Structure, Enum
   /// </summary>
   [DebuggerDisplay("{ToString(),nq}")];
   CLASS XSourceTypeSymbol INHERIT XSourceEntity IMPLEMENTS IXTypeSymbol
      PRIVATE _isPartial      AS LOGIC
      PRIVATE _members        AS List<XSourceMemberSymbol>
      PRIVATE _basemembers    AS List<IXMemberSymbol>
      PRIVATE _baseType       AS IXTypeSymbol
      PRIVATE _children       AS List<XSourceTypeSymbol>
      PRIVATE _signature      AS XTypeSignature
      PRIVATE _isClone        AS LOGIC
      PROPERTY SourceCode     AS STRING AUTO
      PROPERTY ShortName      AS STRING GET IIF(!SELF:IsGeneric, SELF:Name, SELF:Name:Substring(0, SELF:Name:IndexOf("<")-1))
      PROPERTY GenericName    AS STRING AUTO
      PROPERTY TickedName     AS STRING
        GET
            IF SELF:IsGeneric
                RETURN SELF:Name+"`"+SELF:TypeParameters:Count:ToString()
            ENDIF
            RETURN SELF:Name
        END GET
      END PROPERTY

      CONSTRUCTOR(name AS STRING, kind AS Kind, attributes AS Modifiers, span AS TextRange, position AS TextInterval, oFile AS XFile)
         SUPER(name, kind, attributes, span, position)
         SELF:_members     := List<XSourceMemberSymbol>{}
         SELF:_basemembers := List<IXMemberSymbol>{}
         SELF:_children    := List<XSourceTypeSymbol>{}
         SELF:_signature   := XTypeSignature{""}
         SELF:ClassType    := XSharpDialect.Core
         SELF:Namespace    := ""
         IF attributes:HasFlag(Modifiers.Static)
            SELF:IsStatic := TRUE
         ENDIF
         IF attributes:HasFlag(Modifiers.Partial)
            SELF:_isPartial := TRUE
         ENDIF
         SELF:File := oFile

        CONSTRUCTOR(dbresult AS XDbResult, file AS XFile)
            SELF(dbresult:TypeName, dbresult:Kind, dbresult:Attributes, dbresult:TextRange, dbresult:TextInterval, file)
            SELF:CopyValuesFrom(dbresult)

         /// <summary>
            /// Duplicate the current Object, so we have the same properties in another object
            /// </summary>
         /// <returns></returns>
      CONSTRUCTOR( oOther AS XSourceTypeSymbol)
         SELF(oOther:Name, oOther:Kind, oOther:Attributes, oOther:Range, oOther:Interval, oOther:File)
         SELF:Parent    := oOther:Parent
         SELF:BaseTypeName  := oOther:BaseTypeName
         SELF:IsPartial := oOther:IsPartial
         SELF:IsStatic  := oOther:IsStatic
         SELF:Namespace := oOther:Namespace
         SELF:AddMembers(oOther:XMembers)
         SELF:_isClone  := TRUE
         RETURN

      METHOD AddChild(oChild AS XSourceTypeSymbol) AS VOID
         BEGIN LOCK SELF:_children
            SELF:_children:Add(oChild)
            oChild:Parent := SELF
         END LOCK

      METHOD AddMember(oMember AS XSourceMemberSymbol) AS VOID
         BEGIN LOCK SELF:_members
            SELF:_members:Add(oMember)
            oMember:Parent        := SELF
            oMember:DeclaringType := SELF:FullName
         END LOCK

      METHOD AddMembers(members AS IEnumerable<XSourceMemberSymbol>) AS VOID
         BEGIN LOCK SELF:_members
            FOREACH VAR oMember IN members
               SELF:_members:Add(oMember)
               oMember:Parent        := SELF
               oMember:DeclaringType := SELF:FullName
            NEXT
         END LOCK

      INTERNAL METHOD SetInterfaces (interfaces as IList<String>) AS VOID
         SELF:_signature:Interfaces:Clear()
         FOREACH var interf in interfaces
                SELF:_signature:Interfaces:Add(interf:Trim())
         NEXT

      METHOD AddInterface(sInterface AS STRING) AS VOID
         SELF:_signature:AddInterface(sInterface:Trim())

      METHOD AddTypeParameter(name AS STRING) AS VOID
         SELF:_signature:TypeParameters:Add(name:Trim())

      METHOD AddConstraints(name AS STRING) AS VOID
         SELF:_signature:TypeParameterContraints:Add(name:Trim())

      PROPERTY Interfaces  AS IList<STRING>              GET SELF:_signature:Interfaces:ToArray()
      PROPERTY InterfaceList AS STRING                   GET SELF:_signature:InterfaceList
      PROPERTY IsGlobal    AS LOGIC                      GET SELF:Name == XLiterals.GlobalName
      PROPERTY TypeParameters as IList<STRING>           GET SELF:_signature:TypeParameters:ToArray()
      PROPERTY TypeParameterList AS STRING               GET SELF:_signature:TypeParameterList
      PROPERTY TypeParameterConstraints as IList<STRING> GET SELF:_signature:TypeParameterContraints:ToArray()
      PROPERTY TypeParameterConstraintsList  AS STRING   GET SELF:_signature:TypeParameterConstraintsList
      PROPERTY Location                      AS STRING   GET SELF:File:FullPath
      PROPERTY OriginalTypeName              AS STRING   GET SELF:TypeName
      PROPERTY IsFunctionsClass              AS LOGIC    GET SELF:Name == XLiterals.GlobalName
      METHOD ClearMembers() AS VOID
         SELF:_members:Clear()

      PROPERTY Members AS IList<IXMemberSymbol>
         GET
            BEGIN LOCK SELF:_members
               RETURN SELF:_members:ToArray()
            END LOCK
         END GET
      END PROPERTY

        PROPERTY XMembers AS IList<XSourceMemberSymbol>
            GET
                BEGIN LOCK SELF:_members
                    RETURN SELF:_members:ToArray()
                END LOCK
            END GET
        END PROPERTY

      PROPERTY AllMembers AS IList<IXMemberSymbol>
         GET
            SELF:ForceComplete()
            BEGIN LOCK SELF:_members
               VAR members := List<IXMemberSymbol>{}
               members:AddRange(SELF:_members)
               members:AddRange(SELF:_basemembers)
               RETURN members:ToArray()
            END LOCK
         END GET
      END PROPERTY

      INTERNAL METHOD SetMembers( list AS  IList<XSourceMemberSymbol>) AS VOID
        SELF:_members:Clear()
        SELF:_members:AddRange(list)
        RETURN

      METHOD GetMembers(elementName AS STRING) AS IList<IXMemberSymbol>
         VAR tempMembers := List<IXMemberSymbol>{}
          IF elementName:StartsWith("@@")
                elementName := elementName:Substring(2)
         ENDIF
         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
            VAR result := List<IXMemberSymbol>{}
            result:AddRange(SELF:_members:Where ({ m => m.Name:Equals(elementName, StringComparison.OrdinalIgnoreCase)} ))
            RETURN result
         ELSE
            RETURN SELF:GetMembers(elementName)
         ENDIF

      METHOD ForceComplete as VOID
        IF SELF:Attributes:HasFlag(Modifiers.Partial)
             // Find all other parts to find the base typename
             var oClone := SELF:Clone
             SELF:_signature:BaseType := oClone:BaseTypeName
             var aIF := oClone:Interfaces:ToArray()
             SELF:SetInterfaces(aIF)
        ENDIF
        IF SELF:_baseType == NULL .and. SELF:BaseTypeName != NULL
            SELF:_baseType := SELF:File:Project:FindType(SELF:BaseTypeName, SELF:File:Usings)
            if self:_baseType != NULL
                self:_basemembers:Clear()
                self:_basemembers:AddRange(self:_baseType:AllMembers:Where( { m => m:IsMethodVisibleInSubclass() }) )
            endif
        ENDIF
        RETURN

      PROPERTY FullName  AS STRING
            GET
                IF SELF:IsGeneric .and. String.IsNullOrEmpty(SELF:GenericName)
                    SELF:GenericName :=  SELF:_GetGenericName()
                ENDIF
                RETURN SELF:GetFullName()
            END GET
      END PROPERTY
      PROPERTY IsGeneric as LOGIC    GET SELF:TypeParameters:Count > 0

      /// <summary>
         /// Merge two XSourceTypeSymbol Objects : Used to create the resulting  XSourceTypeSymbol from 2 or more partial classes
         /// </summary>
      /// <param name="otherType"></param>
      METHOD Merge(otherType AS XSourceTypeSymbol) AS XSourceTypeSymbol
         LOCAL clone AS XSourceTypeSymbol
         IF ! self:_isClone
            clone := XSourceTypeSymbol{SELF}
         ELSE
            clone := SELF
         ENDIF
         VAR otherFile := otherType:File:FullPath:ToLower()
         VAR thisFile  := SELF:File:FullPath:ToLower()
         IF otherFile != thisFile
            SELF:IsPartial := TRUE
            IF otherType != NULL
               clone:AddMembers(otherType:XMembers)
               IF clone:Parent == NULL .AND. otherType:Parent != NULL
                  clone:Parent := otherType:Parent
               ELSE
                  IF String.IsNullOrEmpty(clone:BaseTypeName) .AND. !String.IsNullOrEmpty(otherType:BaseTypeName)
                     clone:BaseTypeName := otherType:BaseTypeName
                  ENDIF
               ENDIF
            ENDIF
         ENDIF
         RETURN clone

     METHOD CopyValuesFrom(dbresult AS XDbResult) AS VOID
         SUPER:CopyValuesFrom(dbresult)
         SELF:Namespace  := dbresult:Namespace
         SELF:Id         := dbresult:IdType
         SELF:ClassType   := (XSharpDialect) dbresult:ClassType

      /// <summary>
      /// If this XSourceTypeSymbol is a Partial type, return a Copy of it, merged with all other informations
      /// coming from other files.
      /// </summary>

      PROPERTY Clone AS XSourceTypeSymbol
         GET
            IF SELF:IsPartial .AND. SELF:File != NULL
               RETURN SUPER:File:Project:Lookup(SELF:FullName, SELF:File:Usings:ToArray())
            ENDIF
            RETURN SELF
         END GET
      END PROPERTY

      PROPERTY BaseType          AS IXTypeSymbol GET SELF:_baseType
      PROPERTY BaseTypeName      AS STRING GET SELF:_signature:BaseType SET SELF:_signature:BaseType := @@value
      PROPERTY ComboPrototype    AS STRING GET SELF:FullName
      PROPERTY Description       AS STRING GET SELF:GetDescription()
      PROPERTY IsPartial         AS LOGIC  GET SELF:_isPartial SET SELF:_isPartial := VALUE
      PROPERTY IsNested          AS LOGIC  GET SELF:Parent IS XSourceTypeSymbol
      PROPERTY ClassType         AS XSharpDialect AUTO

      STATIC METHOD CreateGlobalType(xfile AS XFile) AS XSourceTypeSymbol
         VAR globalType := XSourceTypeSymbol{XLiterals.GlobalName, Kind.Class, Modifiers.Public+Modifiers.Static, TextRange{0, 0, 0, 0}, TextInterval{}, xfile}
         globalType:IsPartial:=TRUE
         RETURN globalType

      STATIC METHOD IsGlobalType(type AS IXSymbol) AS LOGIC
         RETURN type != NULL .AND. type is IXTypeSymbol .and. type:Name == XLiterals.GlobalName

      PROPERTY Children   AS IList<IXTypeSymbol>
         GET
            BEGIN LOCK SELF:_children
                var children := List<IXTypeSymbol>{}
                children:AddRange(SELF:_children)
                return children
            END LOCK
         END GET
      END PROPERTY

      PROPERTY XChildren   AS IList<XSourceTypeSymbol>
         GET
            BEGIN LOCK SELF:_children
               return SELF:_children:ToArray()
            END LOCK
         END GET
      END PROPERTY
      PROPERTY XMLSignature   AS STRING GET SELF:GetXmlSignature()

   METHOD ToString() AS STRING
      var result := i"{Kind} {Name}"
      if SELF:_signature != NULL .and. SELF:_signature:TypeParameters:Count > 0
         result += self:_signature:ToString()
      ENDIF
      RETURN result

    STATIC METHOD GetTypeSource(element AS XDbResult, members AS IList<XDbResult>, file as XFile) AS STRING
         VAR sb := System.Text.StringBuilder{}
         if file != NULL
            foreach var strusing in file:Usings
                sb:AppendLine("USING "+strusing)
             next
             foreach var strusing in file:StaticUsings
                sb:AppendLine("USING STATIC "+strusing)
            next
         ENDIF
         sb:AppendLine(element:SourceCode)
         FOREACH VAR xmember IN members
            var source := xmember:SourceCode
            // replace private with hidden to avoid confusion
            if source:ToLower():StartsWith("private")
               source := "HIDDEN "+source:Substring(7)
            endif
            if source:ToLower():StartsWith("public")
               source := "EXPORT "+source:Substring(6)
            endif
            sb:AppendLine(source)

            SWITCH xmember:Kind
            CASE Kind.Property
               source := xmember:SourceCode:ToLower():Replace('\t',' ')
               IF source:Contains(" get") .OR. ;
                  source:Contains(" set") .OR. ;
                  source:Contains(" auto") .or. ;
                  source:Contains("=>")
                  // single line
                  NOP
               ELSE
                   sb:AppendLine("END PROPERTY")
               ENDIF
            CASE Kind.Event
               source := xmember:SourceCode:ToLower():Replace('\t',' ')
               IF source:Contains(" add") .OR. ;
                  source:Contains(" remove")
                  // single line
                  NOP
               ELSE
                  sb:AppendLine("END EVENT")
               ENDIF
            END SWITCH
         NEXT
         SWITCH element:Kind
         CASE Kind.Class
            IF element:ClassType == (INT) XSharpDialect.XPP
               sb:AppendLine("ENDCLASS")
            ELSEIF element:ClassType == (INT) XSharpDialect.FoxPro
               sb:AppendLine("ENDDEFINE")
            ELSE
               sb:AppendLine("END CLASS")
            ENDIF
         CASE Kind.Structure
            sb:AppendLine("END STRUCTURE")
         CASE Kind.Interface
            sb:AppendLine("END INTERFACE")
         END SWITCH
         RETURN sb:ToString()

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 LanguageService.CodeAnalysis.Text
USING LanguageService.CodeAnalysis.XSharp
USING System.Diagnostics

BEGIN NAMESPACE XSharpModel
   /// <summary>
      /// Model for Namespace, Class, Interface, Structure, Enum
   /// </summary>
   [DebuggerDisplay("{ToString(),nq}")];
   CLASS XSourceTypeSymbol INHERIT XSourceEntity IMPLEMENTS IXTypeSymbol
      PRIVATE _isPartial      AS LOGIC
      PRIVATE _members        AS List<XSourceMemberSymbol>
      PRIVATE _basemembers    AS List<IXMemberSymbol>
      PRIVATE _baseType       AS IXTypeSymbol
      PRIVATE _children       AS List<XSourceTypeSymbol>
      PRIVATE _signature      AS XTypeSignature
      PRIVATE _isClone        AS LOGIC
      PROPERTY SourceCode     AS STRING AUTO
      PROPERTY ShortName      AS STRING GET IIF(!SELF:IsGeneric, SELF:Name, SELF:Name:Substring(0, SELF:Name:IndexOf("<")-1))
      PROPERTY GenericName    AS STRING AUTO
      PROPERTY TickedName     AS STRING
        GET
            IF SELF:IsGeneric
                RETURN SELF:Name+"`"+SELF:TypeParameters:Count:ToString()
            ENDIF
            RETURN SELF:Name
        END GET
      END PROPERTY

      CONSTRUCTOR(name AS STRING, kind AS Kind, attributes AS Modifiers, span AS TextRange, position AS TextInterval, oFile AS XFile)
         SUPER(name, kind, attributes, span, position)
         SELF:_members     := List<XSourceMemberSymbol>{}
         SELF:_basemembers := List<IXMemberSymbol>{}
         SELF:_children    := List<XSourceTypeSymbol>{}
         SELF:_signature   := XTypeSignature{""}
         SELF:ClassType    := XSharpDialect.Core
         SELF:Namespace    := ""
         IF attributes:HasFlag(Modifiers.Static)
            SELF:IsStatic := TRUE
         ENDIF
         IF attributes:HasFlag(Modifiers.Partial)
            SELF:_isPartial := TRUE
         ENDIF
         SELF:File := oFile

        CONSTRUCTOR(dbresult AS XDbResult, file AS XFile)
            SELF(dbresult:TypeName, dbresult:Kind, dbresult:Attributes, dbresult:TextRange, dbresult:TextInterval, file)
            SELF:CopyValuesFrom(dbresult)

         /// <summary>
            /// Duplicate the current Object, so we have the same properties in another object
            /// </summary>
         /// <returns></returns>
      CONSTRUCTOR( oOther AS XSourceTypeSymbol)
         SELF(oOther:Name, oOther:Kind, oOther:Attributes, oOther:Range, oOther:Interval, oOther:File)
         SELF:Parent    := oOther:Parent
         SELF:BaseTypeName  := oOther:BaseTypeName
         SELF:IsPartial := oOther:IsPartial
         SELF:IsStatic  := oOther:IsStatic
         SELF:Namespace := oOther:Namespace
         SELF:AddMembers(oOther:XMembers)
         SELF:_isClone  := TRUE
         RETURN

      METHOD AddChild(oChild AS XSourceTypeSymbol) AS VOID
         BEGIN LOCK SELF:_children
            SELF:_children:Add(oChild)
            oChild:Parent := SELF
         END LOCK

      METHOD AddMember(oMember AS XSourceMemberSymbol) AS VOID
         BEGIN LOCK SELF:_members
            SELF:_members:Add(oMember)
            oMember:Parent        := SELF
            oMember:DeclaringType := SELF:FullName
         END LOCK

      METHOD AddMembers(members AS IEnumerable<XSourceMemberSymbol>) AS VOID
         BEGIN LOCK SELF:_members
            FOREACH VAR oMember IN members
               SELF:_members:Add(oMember)
               oMember:Parent        := SELF
               oMember:DeclaringType := SELF:FullName
            NEXT
         END LOCK

      INTERNAL METHOD SetInterfaces (interfaces as IList<String>) AS VOID
         SELF:_signature:Interfaces:Clear()
         FOREACH var interf in interfaces
                SELF:_signature:Interfaces:Add(interf:Trim())
         NEXT

      METHOD AddInterface(sInterface AS STRING) AS VOID
         SELF:_signature:AddInterface(sInterface:Trim())

      METHOD AddTypeParameter(name AS STRING) AS VOID
         SELF:_signature:TypeParameters:Add(name:Trim())

      METHOD AddConstraints(name AS STRING) AS VOID
         SELF:_signature:TypeParameterContraints:Add(name:Trim())

      PROPERTY Interfaces  AS IList<STRING>              GET SELF:_signature:Interfaces:ToArray()
      PROPERTY InterfaceList AS STRING                   GET SELF:_signature:InterfaceList
      PROPERTY IsGlobal    AS LOGIC                      GET SELF:Name == XLiterals.GlobalName
      PROPERTY TypeParameters as IList<STRING>           GET SELF:_signature:TypeParameters:ToArray()
      PROPERTY TypeParameterList AS STRING               GET SELF:_signature:TypeParameterList
      PROPERTY TypeParameterConstraints as IList<STRING> GET SELF:_signature:TypeParameterContraints:ToArray()
      PROPERTY TypeParameterConstraintsList  AS STRING   GET SELF:_signature:TypeParameterConstraintsList
      PROPERTY Location                      AS STRING   GET SELF:File:FullPath
      PROPERTY OriginalTypeName              AS STRING   GET SELF:TypeName
      PROPERTY IsFunctionsClass              AS LOGIC    GET SELF:Name == XLiterals.GlobalName
      METHOD ClearMembers() AS VOID
         SELF:_members:Clear()

      PROPERTY Members AS IList<IXMemberSymbol>
         GET
            BEGIN LOCK SELF:_members
               RETURN SELF:_members:ToArray()
            END LOCK
         END GET
      END PROPERTY

        PROPERTY XMembers AS IList<XSourceMemberSymbol>
            GET
                BEGIN LOCK SELF:_members
                    RETURN SELF:_members:ToArray()
                END LOCK
            END GET
        END PROPERTY

      PROPERTY AllMembers AS IList<IXMemberSymbol>
         GET
            SELF:ForceComplete()
            BEGIN LOCK SELF:_members
               VAR members := List<IXMemberSymbol>{}
               members:AddRange(SELF:_members)
               members:AddRange(SELF:_basemembers)
               RETURN members:ToArray()
            END LOCK
         END GET
      END PROPERTY

      INTERNAL METHOD SetMembers( list AS  IList<XSourceMemberSymbol>) AS VOID
        SELF:_members:Clear()
        SELF:_members:AddRange(list)
        RETURN

      METHOD GetMembers(elementName AS STRING) AS IList<IXMemberSymbol>
         VAR tempMembers := List<IXMemberSymbol>{}
          IF elementName:StartsWith("@@")
                elementName := elementName:Substring(2)
         ENDIF
         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
            VAR result := List<IXMemberSymbol>{}
            result:AddRange(SELF:_members:Where ({ m => m.Name:Equals(elementName, StringComparison.OrdinalIgnoreCase)} ))
            RETURN result
         ELSE
            RETURN SELF:GetMembers(elementName)
         ENDIF

      METHOD ForceComplete as VOID
        IF SELF:Attributes:HasFlag(Modifiers.Partial)
             // Find all other parts to find the base typename
             var oClone := SELF:Clone
             SELF:_signature:BaseType := oClone:BaseTypeName
             var aIF := oClone:Interfaces:ToArray()
             SELF:SetInterfaces(aIF)
        ENDIF
        IF SELF:_baseType == NULL .and. SELF:BaseTypeName != NULL
            SELF:_baseType := SELF:File:Project:FindType(SELF:BaseTypeName, SELF:File:Usings)
            if self:_baseType != NULL
                self:_basemembers:Clear()
                self:_basemembers:AddRange(self:_baseType:AllMembers:Where( { m => m:IsMethodVisibleInSubclass() }) )
            endif
        ENDIF
        RETURN

      PROPERTY FullName  AS STRING
            GET
                IF SELF:IsGeneric .and. String.IsNullOrEmpty(SELF:GenericName)
                    SELF:GenericName :=  SELF:_GetGenericName()
                ENDIF
                RETURN SELF:GetFullName()
            END GET
      END PROPERTY
      PROPERTY IsGeneric as LOGIC    GET SELF:TypeParameters:Count > 0

      /// <summary>
         /// Merge two XSourceTypeSymbol Objects : Used to create the resulting  XSourceTypeSymbol from 2 or more partial classes
         /// </summary>
      /// <param name="otherType"></param>
      METHOD Merge(otherType AS XSourceTypeSymbol) AS XSourceTypeSymbol
         LOCAL clone AS XSourceTypeSymbol
         IF ! self:_isClone
            clone := XSourceTypeSymbol{SELF}
         ELSE
            clone := SELF
         ENDIF
         VAR otherFile := otherType:File:FullPath:ToLower()
         VAR thisFile  := SELF:File:FullPath:ToLower()
         IF otherFile != thisFile
            SELF:IsPartial := TRUE
            IF otherType != NULL
               clone:AddMembers(otherType:XMembers)
               IF clone:Parent == NULL .AND. otherType:Parent != NULL
                  clone:Parent := otherType:Parent
               ELSE
                  IF String.IsNullOrEmpty(clone:BaseTypeName) .AND. !String.IsNullOrEmpty(otherType:BaseTypeName)
                     clone:BaseTypeName := otherType:BaseTypeName
                  ENDIF
               ENDIF
            ENDIF
         ENDIF
         RETURN clone

     METHOD CopyValuesFrom(dbresult AS XDbResult) AS VOID
         SUPER:CopyValuesFrom(dbresult)
         SELF:Namespace  := dbresult:Namespace
         SELF:Id         := dbresult:IdType
         SELF:ClassType   := (XSharpDialect) dbresult:ClassType

      /// <summary>
      /// If this XSourceTypeSymbol is a Partial type, return a Copy of it, merged with all other informations
      /// coming from other files.
      /// </summary>

      PROPERTY Clone AS XSourceTypeSymbol
         GET
            IF SELF:IsPartial .AND. SELF:File != NULL
               RETURN SUPER:File:Project:Lookup(SELF:FullName, SELF:File:Usings:ToArray())
            ENDIF
            RETURN SELF
         END GET
      END PROPERTY

      PROPERTY BaseType          AS IXTypeSymbol GET SELF:_baseType
      PROPERTY BaseTypeName      AS STRING GET SELF:_signature:BaseType SET SELF:_signature:BaseType := @@value
      PROPERTY ComboPrototype    AS STRING GET SELF:FullName
      PROPERTY Description       AS STRING GET SELF:GetDescription()
      PROPERTY IsPartial         AS LOGIC  GET SELF:_isPartial SET SELF:_isPartial := VALUE
      PROPERTY IsNested          AS LOGIC  GET SELF:Parent IS XSourceTypeSymbol
      PROPERTY ClassType         AS XSharpDialect AUTO

      STATIC METHOD CreateGlobalType(xfile AS XFile) AS XSourceTypeSymbol
         VAR globalType := XSourceTypeSymbol{XLiterals.GlobalName, Kind.Class, Modifiers.Public+Modifiers.Static, TextRange{0, 0, 0, 0}, TextInterval{}, xfile}
         globalType:IsPartial:=TRUE
         RETURN globalType

      STATIC METHOD IsGlobalType(type AS IXSymbol) AS LOGIC
         RETURN type != NULL .AND. type is IXTypeSymbol .and. type:Name == XLiterals.GlobalName

      PROPERTY Children   AS IList<IXTypeSymbol>
         GET
            BEGIN LOCK SELF:_children
                var children := List<IXTypeSymbol>{}
                children:AddRange(SELF:_children)
                return children
            END LOCK
         END GET
      END PROPERTY

      PROPERTY XChildren   AS IList<XSourceTypeSymbol>
         GET
            BEGIN LOCK SELF:_children
               return SELF:_children:ToArray()
            END LOCK
         END GET
      END PROPERTY
      PROPERTY XMLSignature   AS STRING GET SELF:GetXmlSignature()

   METHOD ToString() AS STRING
      var result := i"{Kind} {Name}"
      if SELF:_signature != NULL .and. SELF:_signature:TypeParameters:Count > 0
         result += self:_signature:ToString()
      ENDIF
      RETURN result

    STATIC METHOD GetTypeSource(element AS XDbResult, members AS IList<XDbResult>, file as XFile) AS STRING
         VAR sb := System.Text.StringBuilder{}
         if file != NULL
            foreach var strusing in file:Usings
                sb:AppendLine("USING "+strusing)
             next
             foreach var strusing in file:StaticUsings
                sb:AppendLine("USING STATIC "+strusing)
            next
         ENDIF
         sb:AppendLine(element:SourceCode)
         FOREACH VAR xmember IN members
            var source := xmember:SourceCode
            // replace private with hidden to avoid confusion
            if source:ToLower():StartsWith("private")
               source := "HIDDEN "+source:Substring(7)
            endif
            if source:ToLower():StartsWith("public")
               source := "EXPORT "+source:Substring(6)
            endif
            sb:AppendLine(source)

            SWITCH xmember:Kind
            CASE Kind.Property
               source := xmember:SourceCode:ToLower():Replace('\t',' ')
               IF source:Contains(" get") .OR. ;
                  source:Contains(" set") .OR. ;
                  source:Contains(" auto")
                  // single line
                  NOP
               ELSE
                   sb:AppendLine("END PROPERTY")
               ENDIF
            CASE Kind.Event
               source := xmember:SourceCode:ToLower():Replace('\t',' ')
               IF source:Contains(" add") .OR. ;
                  source:Contains(" remove")
                  // single line
                  NOP
               ELSE
                  sb:AppendLine("END EVENT")
               ENDIF
            END SWITCH
         NEXT
         SWITCH element:Kind
         CASE Kind.Class
            IF element:ClassType == (INT) XSharpDialect.XPP
               sb:AppendLine("ENDCLASS")
            ELSEIF element:ClassType == (INT) XSharpDialect.FoxPro
               sb:AppendLine("ENDDEFINE")
            ELSE
               sb:AppendLine("END CLASS")
            ENDIF
         CASE Kind.Structure
            sb:AppendLine("END STRUCTURE")
         CASE Kind.Interface
            sb:AppendLine("END INTERFACE")
         END SWITCH
         RETURN sb:ToString()

END CLASS

END NAMESPACE


start over 'my way'

start over 'my way'

-- "Names Free For Polymorphic Views of Names and Binders"
-- by Jean-Philippe Bernardy, Nicolas Pouillard
-- http://www.cse.chalmers.se/~bernardy/NamesForFree.pdf

-- originally
--
type Succ a = a `Trunce` ()

data Trunce :: * ~> * ~> * where
  Old :: a -> Trunce a b
  New :: b -> Trunce a b

data Tri :: Nat ~> * ~> * where
  Born :: a -> Tri 0t a
  Reach :: Tri n a -> Tri (1+n)t a


QtUiTools: updated to use the macro PQSTRING

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

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

*/

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QACTIONGROUP
REQUEST QLAYOUT
REQUEST QWIDGET
REQUEST QDIR
#endif

CLASS QUiLoader INHERIT QObject

   DATA class_flags INIT 1
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD addPluginPath
   METHOD availableLayouts
   METHOD availableWidgets
   METHOD clearPluginPaths
   METHOD createAction
   METHOD createActionGroup
   METHOD createLayout
   METHOD createWidget
   METHOD isLanguageChangeEnabled
   METHOD load
   METHOD pluginPaths
   METHOD setLanguageChangeEnabled
   METHOD setWorkingDirectory
   METHOD workingDirectory

   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#include <QUiLoader>
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_clsid.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#include <QUiLoader>
#endif

#include <QStringList>
#include <QDir>

/*
QUiLoader ( QObject * parent = 0 )
*/
HB_FUNC_STATIC( QUILOADER_NEW )
{
  QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
  QUiLoader * o = new QUiLoader ( par1 );
  _qt5xhb_storePointerAndFlag( o, false );
}

HB_FUNC_STATIC( QUILOADER_DELETE )
{
  QUiLoader * obj = (QUiLoader *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addPluginPath ( const QString & path )
*/
HB_FUNC_STATIC( QUILOADER_ADDPLUGINPATH )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->addPluginPath ( PQSTRING(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QStringList availableLayouts () const
*/
HB_FUNC_STATIC( QUILOADER_AVAILABLELAYOUTS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->availableLayouts (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
QStringList availableWidgets () const
*/
HB_FUNC_STATIC( QUILOADER_AVAILABLEWIDGETS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->availableWidgets (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
void clearPluginPaths ()
*/
HB_FUNC_STATIC( QUILOADER_CLEARPLUGINPATHS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->clearPluginPaths (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual QAction * createAction ( QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEACTION )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
    QString par2 = ISNIL(2)? QString() : QLatin1String( hb_parc(2) );
    QAction * ptr = obj->createAction ( par1, par2 );
    _qt5xhb_createReturnClass ( ptr, "QACTION" );
  }
}

/*
virtual QActionGroup * createActionGroup ( QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEACTIONGROUP )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
    QString par2 = ISNIL(2)? QString() : QLatin1String( hb_parc(2) );
    QActionGroup * ptr = obj->createActionGroup ( par1, par2 );
    _qt5xhb_createReturnClass ( ptr, "QACTIONGROUP" );
  }
}

/*
virtual QLayout * createLayout ( const QString & className, QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATELAYOUT )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QObject * par2 = ISNIL(2)? 0 : (QObject *) _qt5xhb_itemGetPtr(2);
    QString par3 = ISNIL(3)? QString() : QLatin1String( hb_parc(3) );
    QLayout * ptr = obj->createLayout ( PQSTRING(1), par2, par3 );
    _qt5xhb_createReturnClass ( ptr, "QLAYOUT" );
  }
}

/*
virtual QWidget * createWidget ( const QString & className, QWidget * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEWIDGET )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QWidget * par2 = ISNIL(2)? 0 : (QWidget *) _qt5xhb_itemGetPtr(2);
    QString par3 = ISNIL(3)? QString() : QLatin1String( hb_parc(3) );
    QWidget * ptr = obj->createWidget ( PQSTRING(1), par2, par3 );
    _qt5xhb_createReturnQWidgetClass ( ptr, "QWIDGET" );
  }
}

/*
bool isLanguageChangeEnabled () const
*/
HB_FUNC_STATIC( QUILOADER_ISLANGUAGECHANGEENABLED )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    hb_retl( obj->isLanguageChangeEnabled (  ) );
  }
}

/*
QWidget * load ( QIODevice * device, QWidget * parentWidget = 0 )
*/
HB_FUNC_STATIC( QUILOADER_LOAD )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QIODevice * par1 = (QIODevice *) _qt5xhb_itemGetPtr(1);
    QWidget * par2 = ISNIL(2)? 0 : (QWidget *) _qt5xhb_itemGetPtr(2);
    QWidget * ptr = obj->load ( par1, par2 );
    _qt5xhb_createReturnQWidgetClass ( ptr, "QWIDGET" );
  }
}

/*
QStringList pluginPaths () const
*/
HB_FUNC_STATIC( QUILOADER_PLUGINPATHS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->pluginPaths (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
void setLanguageChangeEnabled ( bool enabled )
*/
HB_FUNC_STATIC( QUILOADER_SETLANGUAGECHANGEENABLED )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->setLanguageChangeEnabled ( (bool) hb_parl(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setWorkingDirectory ( const QDir & dir )
*/
HB_FUNC_STATIC( QUILOADER_SETWORKINGDIRECTORY )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QDir * par1 = (QDir *) _qt5xhb_itemGetPtr(1);
    obj->setWorkingDirectory ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QDir workingDirectory () const
*/
HB_FUNC_STATIC( QUILOADER_WORKINGDIRECTORY )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QDir * ptr = new QDir( obj->workingDirectory (  ) );
    _qt5xhb_createReturnClass ( ptr, "QDIR", true );
  }
}

#pragma ENDDUMP

/*

  Qt5xHb - bibliotecas de ligao entre Harbour/xHarbour e Qt Framework 5

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

*/

#include "hbclass.ch"

#ifndef QT5XHB_NO_REQUESTS
REQUEST QACTION
REQUEST QACTIONGROUP
REQUEST QLAYOUT
REQUEST QWIDGET
REQUEST QDIR
#endif

CLASS QUiLoader INHERIT QObject

   DATA class_flags INIT 1
   DATA self_destruction INIT .F.

   METHOD new
   METHOD delete
   METHOD addPluginPath
   METHOD availableLayouts
   METHOD availableWidgets
   METHOD clearPluginPaths
   METHOD createAction
   METHOD createActionGroup
   METHOD createLayout
   METHOD createWidget
   METHOD isLanguageChangeEnabled
   METHOD load
   METHOD pluginPaths
   METHOD setLanguageChangeEnabled
   METHOD setWorkingDirectory
   METHOD workingDirectory

   DESTRUCTOR destroyObject

END CLASS

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

#pragma BEGINDUMP

#include <Qt>

#ifndef __XHARBOUR__
#include <QUiLoader>
#endif

#include "qt5xhb_common.h"
#include "qt5xhb_clsid.h"
#include "qt5xhb_utils.h"

#ifdef __XHARBOUR__
#include <QUiLoader>
#endif

#include <QStringList>
#include <QDir>

/*
QUiLoader ( QObject * parent = 0 )
*/
HB_FUNC_STATIC( QUILOADER_NEW )
{
  QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
  QUiLoader * o = new QUiLoader ( par1 );
  _qt5xhb_storePointerAndFlag( o, false );
}

HB_FUNC_STATIC( QUILOADER_DELETE )
{
  QUiLoader * obj = (QUiLoader *) hb_itemGetPtr( hb_objSendMsg( hb_stackSelfItem(), "POINTER", 0 ) );
  if( obj )
  {
    delete obj;
    obj = NULL;
    PHB_ITEM self = hb_stackSelfItem();
    PHB_ITEM ptr = hb_itemPutPtr( NULL, NULL );
    hb_objSendMsg( self, "_pointer", 1, ptr );
    hb_itemRelease( ptr );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void addPluginPath ( const QString & path )
*/
HB_FUNC_STATIC( QUILOADER_ADDPLUGINPATH )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QString par1 = QLatin1String( hb_parc(1) );
    obj->addPluginPath ( par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QStringList availableLayouts () const
*/
HB_FUNC_STATIC( QUILOADER_AVAILABLELAYOUTS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->availableLayouts (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
QStringList availableWidgets () const
*/
HB_FUNC_STATIC( QUILOADER_AVAILABLEWIDGETS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->availableWidgets (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
void clearPluginPaths ()
*/
HB_FUNC_STATIC( QUILOADER_CLEARPLUGINPATHS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->clearPluginPaths (  );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
virtual QAction * createAction ( QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEACTION )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
    QString par2 = ISNIL(2)? QString() : QLatin1String( hb_parc(2) );
    QAction * ptr = obj->createAction ( par1, par2 );
    _qt5xhb_createReturnClass ( ptr, "QACTION" );
  }
}

/*
virtual QActionGroup * createActionGroup ( QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEACTIONGROUP )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QObject * par1 = ISNIL(1)? 0 : (QObject *) _qt5xhb_itemGetPtr(1);
    QString par2 = ISNIL(2)? QString() : QLatin1String( hb_parc(2) );
    QActionGroup * ptr = obj->createActionGroup ( par1, par2 );
    _qt5xhb_createReturnClass ( ptr, "QACTIONGROUP" );
  }
}

/*
virtual QLayout * createLayout ( const QString & className, QObject * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATELAYOUT )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QString par1 = QLatin1String( hb_parc(1) );
    QObject * par2 = ISNIL(2)? 0 : (QObject *) _qt5xhb_itemGetPtr(2);
    QString par3 = ISNIL(3)? QString() : QLatin1String( hb_parc(3) );
    QLayout * ptr = obj->createLayout ( par1, par2, par3 );
    _qt5xhb_createReturnClass ( ptr, "QLAYOUT" );
  }
}

/*
virtual QWidget * createWidget ( const QString & className, QWidget * parent = 0, const QString & name = QString() )
*/
HB_FUNC_STATIC( QUILOADER_CREATEWIDGET )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QString par1 = QLatin1String( hb_parc(1) );
    QWidget * par2 = ISNIL(2)? 0 : (QWidget *) _qt5xhb_itemGetPtr(2);
    QString par3 = ISNIL(3)? QString() : QLatin1String( hb_parc(3) );
    QWidget * ptr = obj->createWidget ( par1, par2, par3 );
    _qt5xhb_createReturnQWidgetClass ( ptr, "QWIDGET" );
  }
}

/*
bool isLanguageChangeEnabled () const
*/
HB_FUNC_STATIC( QUILOADER_ISLANGUAGECHANGEENABLED )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    hb_retl( obj->isLanguageChangeEnabled (  ) );
  }
}

/*
QWidget * load ( QIODevice * device, QWidget * parentWidget = 0 )
*/
HB_FUNC_STATIC( QUILOADER_LOAD )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QIODevice * par1 = (QIODevice *) _qt5xhb_itemGetPtr(1);
    QWidget * par2 = ISNIL(2)? 0 : (QWidget *) _qt5xhb_itemGetPtr(2);
    QWidget * ptr = obj->load ( par1, par2 );
    _qt5xhb_createReturnQWidgetClass ( ptr, "QWIDGET" );
  }
}

/*
QStringList pluginPaths () const
*/
HB_FUNC_STATIC( QUILOADER_PLUGINPATHS )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QStringList strl = obj->pluginPaths (  );
    _qt5xhb_convert_qstringlist_to_array ( strl );
  }
}

/*
void setLanguageChangeEnabled ( bool enabled )
*/
HB_FUNC_STATIC( QUILOADER_SETLANGUAGECHANGEENABLED )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    obj->setLanguageChangeEnabled ( (bool) hb_parl(1) );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
void setWorkingDirectory ( const QDir & dir )
*/
HB_FUNC_STATIC( QUILOADER_SETWORKINGDIRECTORY )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QDir * par1 = (QDir *) _qt5xhb_itemGetPtr(1);
    obj->setWorkingDirectory ( *par1 );
  }
  hb_itemReturn( hb_stackSelfItem() );
}

/*
QDir workingDirectory () const
*/
HB_FUNC_STATIC( QUILOADER_WORKINGDIRECTORY )
{
  QUiLoader * obj = (QUiLoader *) _qt5xhb_itemGetPtrStackSelfItem();
  if( obj )
  {
    QDir * ptr = new QDir( obj->workingDirectory (  ) );
    _qt5xhb_createReturnClass ( ptr, "QDIR", true );
  }
}

#pragma ENDDUMP