'Classes/System/IO/TextWriter.ab

Namespace System
Namespace IO

/*
@brief テキスト書き込みの抽象基底クラス
@date 2007/03/05
@auther Egtra
*/
Class TextWriter
Public
	Virtual Sub ~TextWriter()
		Dispose(False)
	End Sub

'	Static Null = StreamWriter.Null As StreamWriter

Public
	Sub Close()
		Dispose(True)
	End Sub

	Sub Dispose()
		Dispose(True)
	End Sub

	Sub TextWriter()
		newLine = Environment.NewLine
	End Sub

	Virtual Sub Flush()
	End Sub

	Abstract Sub Write(s As String)
	Virtual Sub Write(x As Boolean)
		Write(Str$(x))
	End Sub
	
	Virtual Sub Write(x As Char)
		Write(Chr$(x))
	End Sub

	Virtual Sub Write(x As Byte)
		Write(Str$(x))
	End Sub
#ifdef UNICODE
	Virtual Sub Write(x As SByte)
		Write(Str$(x))
	End Sub
#else
	Virtual Sub Write(x As Word)
		Write(Str$(x))
	End Sub
#endif
	Virtual Sub Write(x As Integer)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As DWord)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As Long)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As QWord)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As Int64)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As Single)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As Double)
		Write(Str$(x))
	End Sub

	Virtual Sub Write(x As Object)
		Write(x.ToString)
	End Sub

	Sub WriteLine()
		Write(newLine)
	End Sub

	Sub WriteLine(s As String)
		Write(s)
		WriteLine()
	End Sub

	Sub WriteLine(x As Boolean)
		Write(Str$(x))
		WriteLine()
	End Sub
	
	Sub WriteLine(x As Char)
		Write(Chr$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Byte)
		Write(Str$(x))
		WriteLine()
	End Sub
#ifdef UNICODE
	Sub WriteLine(x As SByte)
		Write(Str$(x))
		WriteLine()
	End Sub
#else
	Sub WriteLine(x As Word)
		Write(Str$(x))
		WriteLine()
	End Sub
#endif
	Sub WriteLine(x As Integer)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As DWord)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Long)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As QWord)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Int64)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Single)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Double)
		Write(Str$(x))
		WriteLine()
	End Sub

	Sub WriteLine(x As Object)
		Write(x.ToString)
		WriteLine()
	End Sub

	/*
	@brief 改行文字の設定
	@date 2007/03/05
	@auther Egtra
	*/
	Sub NewLine(n As String)
		newLine = n
	End Sub
	/*
	@brief 改行文字の取得
	@date 2007/03/05
	@auther Egtra
	*/
	Function NewLine() As String
	End Function

Protected
	Virtual Sub Dispose(disposing As Boolean)
	End Sub

Private
	newLine As String
End Class

End Namespace
End Namespace