VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsFI_Function"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private m_nNumberOfLines As Long
Private m_saLines() As String

Private m_sGUID As String



Public Property Get GUID() As String
    GUID = m_sGUID
End Property
Public Property Let GUID(sNewGUID As String)
    m_sGUID = sNewGUID
End Property

Public Property Get Name() As String
    Dim sDeclLine As String
    Dim nWhere As Long
    sDeclLine = Trim(GetLine(1))
    nWhere = InStr(1, sDeclLine, "(")
    If nWhere > 0 Then
        Name = UCase(Trim(Left(sDeclLine, nWhere - 1)))
    Else
        Call Err.Raise(-1, sDeclLine, "Error: Can't find function name")
    End If
End Property

Public Property Get ReturnType() As String
    Dim sDeclLine As String
    sDeclLine = Trim(GetLine(1))
    ReturnType = Trim(Left(sDeclLine, InStr(1, sDeclLine, " ")))
End Property

Public Property Get Params() As String
    Dim sDeclLine As String
    sDeclLine = Trim(GetLine(1))
    Params = Trim(Mid(sDeclLine, InStr(1, sDeclLine, "(") + 1, InStr(1, sDeclLine, ")") - InStr(1, sDeclLine, "(") - 1))
End Property

Private Sub Class_Initialize()

    GUID = GetGUID("Function")
    
    ReDim m_saLines(0 To m_nNumberOfLines) As String
    m_nNumberOfLines = 0

End Sub

Public Function GetLine(nLine As Long) As String

    If nLine > 0 And nLine <= m_nNumberOfLines Then
        GetLine = m_saLines(nLine)
    Else
        GetLine = ""
    End If

End Function

Public Property Get Count() As Long
    Count = m_nNumberOfLines
End Property

Public Sub AddLine(sLine As String)

    m_nNumberOfLines = m_nNumberOfLines + 1
    ReDim Preserve m_saLines(0 To m_nNumberOfLines) As String
    m_saLines(m_nNumberOfLines) = sLine

End Sub

