引数を解析するクラス本体
Option Explicit
Class Argument
Private argumentOptions
Private Sub Class_Initialize()
Set argumentOptions = Nothing
End Sub
Private Sub Class_Terminate()
Set argumentOptions = Nothing
End Sub
Function analyzeBy(ByVal validArguments)
Dim ret
ret = True
Set argumentOptions = CreateObject("Scripting.Dictionary")
Dim tempArg
For Each tempArg In validArguments
If WScript.Arguments.Named.Exists(tempArg) = True Then
Dim argumentOption
argumentOption = WScript.Arguments.Named.Item(tempArg)
If argumentOption <> "" Then
Dim optionList
optionList = Split(argumentOption, ",", -1, vbTextCompare)
argumentOptions.Add tempArg, optionList
End If
Else
ret = False
End If
Next
If ret = False Then
Set argumentOptions = Nothing
End If
analyzeBy = ret
End Function
Function getArgumentOption(ByVal arg)
Dim ret
ret = Null
If Not argumentOptions Is Nothing Then
If argumentOptions.Exists(arg) = True Then
ret = argumentOptions.Item(arg)
End If
End If
getArgumentOption = ret
End Function
End Class