Version: 3.0.2
wxTextOutputStream Class Reference

#include <wx/txtstrm.h>

Detailed Description

This class provides functions that write text data using an output stream, allowing you to write text, floats, and integers.

You can also simulate the C++ std::cout class:

wxFFileOutputStream output( stderr );
wxTextOutputStream cout( output );
cout << "This is a text line" << endl;
cout << 1234;
cout << 1.23456;

The wxTextOutputStream writes text files (or streams) on DOS, Macintosh and Unix in their native formats (concerning the line ending).

Library:  wxBase
Category:  Streams
See Also
wxTextInputStream

Public Member Functions

 wxTextOutputStream (wxOutputStream &stream, wxEOL mode=wxEOL_NATIVE, const wxMBConv &conv=wxConvAuto())
 Constructs a text stream object associated to the given output stream.
 
virtual ~wxTextOutputStream ()
 Destroys the wxTextOutputStream object.
 
void Flush ()
 Flushes the stream.
 
const wxOutputStreamGetOutputStream () const
 Returns a pointer to the underlying output stream object.
 
wxEOL GetMode ()
 Returns the end-of-line mode.
 
wxTextOutputStreamPutChar (wxChar c)
 Writes a character to the stream.
 
void SetMode (wxEOL mode=wxEOL_NATIVE)
 Set the end-of-line mode.
 
void Write16 (wxUint16 i16)
 Writes the 16 bit integer i16 to the stream.
 
void Write32 (wxUint32 i32)
 Writes the 32 bit integer i32 to the stream.
 
void Write8 (wxUint8 i8)
 Writes the single byte i8 to the stream.
 
virtual void WriteDouble (double f)
 Writes the double f to the stream using the IEEE format.
 
virtual void WriteString (const wxString &string)
 Writes string as a line.
 

Constructor & Destructor Documentation

wxTextOutputStream::wxTextOutputStream ( wxOutputStream stream,
wxEOL  mode = wxEOL_NATIVE,
const wxMBConv conv = wxConvAuto() 
)

Constructs a text stream object associated to the given output stream.

Parameters
streamThe output stream.
modeThe end-of-line mode. One of wxEOL_NATIVE, wxEOL_DOS, wxEOL_MAC and wxEOL_UNIX.
convIn Unicode build only: The object used to convert Unicode text into ASCII characters written to the output stream.
virtual wxTextOutputStream::~wxTextOutputStream ( )
virtual

Destroys the wxTextOutputStream object.

Also calls Flush().

Member Function Documentation

void wxTextOutputStream::Flush ( )

Flushes the stream.

This method should be called when using stateful encodings (currently the only example of such encoding in wxWidgets is wxMBConvUTF7) to write the end of the encoded data to the stream.

Since
2.9.0
wxEOL wxTextOutputStream::GetMode ( )

Returns the end-of-line mode.

One of wxEOL_DOS, wxEOL_MAC and wxEOL_UNIX.

const wxOutputStream& wxTextOutputStream::GetOutputStream ( ) const

Returns a pointer to the underlying output stream object.

Since
2.9.2
wxTextOutputStream& wxTextOutputStream::PutChar ( wxChar  c)

Writes a character to the stream.

void wxTextOutputStream::SetMode ( wxEOL  mode = wxEOL_NATIVE)

Set the end-of-line mode.

One of wxEOL_NATIVE, wxEOL_DOS, wxEOL_MAC and wxEOL_UNIX.

void wxTextOutputStream::Write16 ( wxUint16  i16)

Writes the 16 bit integer i16 to the stream.

void wxTextOutputStream::Write32 ( wxUint32  i32)

Writes the 32 bit integer i32 to the stream.

void wxTextOutputStream::Write8 ( wxUint8  i8)

Writes the single byte i8 to the stream.

virtual void wxTextOutputStream::WriteDouble ( double  f)
virtual

Writes the double f to the stream using the IEEE format.

virtual void wxTextOutputStream::WriteString ( const wxString string)
virtual

Writes string as a line.

Depending on the end-of-line mode the end of line ('\n') characters in the string are converted to the correct line ending terminator.