Public Member Functions

Binary_Stream_To_Text Class Reference

This class provides methods to operate with configuration stream containing textual data as if it was binary data stream. More...

#include <Binary_Stream_To_Text.h>

Inheritance diagram for Binary_Stream_To_Text:
Inheritance graph
[legend]
Collaboration diagram for Binary_Stream_To_Text:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual int Read (char *buf, size_t count, size_t *read)
 Reads a number of T values from stream.
virtual int Write (char *buf, size_t count, size_t *written)
 Writes a number of T values to stream.
virtual int Flush ()
 Flushes the internal buffer, useful when you need to make sure the data is passed to the Stream backend (could be some file) from Stream internal buffer.
void Set_Underlying_Stream (Simple_Stream< char > *text_stream)
 Attaches this binary stream converter to a stream of textually represented data.

Detailed Description

This class provides methods to operate with configuration stream containing textual data as if it was binary data stream.

An example would be text configuration file opened as File_Stream. Set_Underlying_Stream method should be used to attach Binary_Stream_To_Text to the created file stream. Afterwards any int or double numbers will be converted to/from text during write/read operations performed on Binary_Stream_To_Text object. Binary data that is not of sizeof(int) or sizeof(double) will be written "as is" without conversion. Textual data that does not represent a number must not be exactly sizeof(int) or sizeof(double) characters long (1-byte characters) because it will be misinterpreted by parser and converted to a number. Configuration_Stream_Converter is used internally by this class.

MCPN Logo
kr0st © 2010