2012年8月11日土曜日

サクラエディタ用Grep結果処理Strategy


サクラエディタのGrep結果を基に各種の処理をするStrategyのサンプルです。
これに処理を実装していけばサクラエディタ用Grep結果処理マクロを使用して、
Grep結果に対していろいろな処理を行うことができます。

Class Strategy

  'コンストラクタ
 Private Sub Class_Initialize()
 End Sub
 
 'デストラクタ
 Private Sub Class_Terminate()
 End Sub
 
 '開始処理
 Public Function execStartProc()
     MsgBox "開始処理"
     execStartProc = True
 End Function
 
 '前処理
 Public Function execPreProc(ByRef objGrepResults)
     MsgBox "前処理:" & UBound(objGrepResults)
     execPreProc = True
 End Function
 
 '本処理
 Public Function execProc(ByRef objGrepResult)
     With objGrepResult
          MsgBox "本処理:" & vbCrLf & "Path='" & .strFilePath & "'" & vbCrLf & "Row='" & .lngRow & "'" & vbCrLf & "Col='" & .lngCol & "'" & vbCrLf & "Text='" & .strText & "'"
     End With
     execProc = True
 End Function

  '後処理
 Public Function execPostProc(ByRef objGrepResults)
     MsgBox "後処理:" & UBound(objGrepResults)
     execPostProc = True
 End Function
 
 '終了処理
 Public Sub execEndProc()
     MsgBox "終了処理"
 End Sub
 
 'エラー処理
 Public Sub execErrProc(ByRef lngErrCode)
     MsgBox "エラー処理"
 End Sub

End Class

Call main(New Strategy)

0 件のコメント:

コメントを投稿