MStreamUtils Class Reference

#include <MStreamUtils.h>

Class Description

Stream functionality.

This class provides some standard stream functionality for developers working in C++ or script. Write methods are provided for writing to ASCII or binary. Read methods are only binary.

Static Public Member Functions

static std::ostream & stdErrorStream ()
 This method returns the cerr ostream.
 
static std::ostream & stdOutStream ()
 This method returns the cout ostream.
 
static MStatus writeChar (std::ostream &out, const char value, bool binary=false)
 This method is used to write out a "char" value to an ostream. More...
 
static MStatus writeCharBuffer (std::ostream &out, const char *value, bool binary=false)
 This method is used to write out a mull-terminated string (const char*) to an ostream. More...
 
static MStatus writeInt (std::ostream &out, const int value, bool binary=false)
 This method is used to write out a "int" value to an ostream. More...
 
static MStatus writeFloat (std::ostream &out, const float value, bool binary=false)
 This method is used to write out a "float" value to an ostream. More...
 
static MStatus writeDouble (std::ostream &out, const double value, bool binary=false)
 This method is used to write out a "double" value to an ostream. More...
 
static MStatus readChar (std::istream &in, char &value, bool binary=false)
 This method is used to read a "char" binary value from an istream. More...
 
static MStatus readCharBuffer (std::istream &in, char *&value, unsigned int length, bool binary=false)
 This method is used to read a character string (char*) from an istream. More...
 
static MStatus readInt (std::istream &in, int &value, bool binary=false)
 This method is used to read a "int" binary value from an istream. More...
 
static MStatus readFloat (std::istream &in, float &value, bool binary=false)
 This method is used to read a "float" binary value from an istream. More...
 
static MStatus readDouble (std::istream &in, double &value, bool binary=false)
 This method is used to read a "double" binary value from an istream. More...
 

Member Function Documentation

MStatus writeChar ( std::ostream &  out,
const char  value,
bool  binary = false 
)
static

This method is used to write out a "char" value to an ostream.

Parameters
[in]outthe output ostream
[in]valuevalue to write out
[in]binaryIf true, the byte(s) of value are written out. If false, the string representation is written out.
Returns
  • MS::kSuccess write worked
  • MS::kFailure stream failed to write value
MStatus writeCharBuffer ( std::ostream &  out,
const char *  value,
bool  binary = false 
)
static

This method is used to write out a mull-terminated string (const char*) to an ostream.

Parameters
[in]outthe output ostream
[in]valuestring to write out
[in]binaryIf true, the byte(s) of the value string are written out. If false, the string representation is written out.
Returns
  • MS::kSuccess write worked
  • MS::kFailure value is NULL or stream failed to write value
MStatus writeInt ( std::ostream &  out,
const int  value,
bool  binary = false 
)
static

This method is used to write out a "int" value to an ostream.

Parameters
[in]outthe output ostream
[in]valuevalue to write out
[in]binaryIf true, the byte(s) of value are written out. If false, the string representation is written out.
Returns
  • MS::kSuccess write worked
  • MS::kFailure stream failed to write value
MStatus writeFloat ( std::ostream &  out,
const float  value,
bool  binary = false 
)
static

This method is used to write out a "float" value to an ostream.

Parameters
[in]outthe output ostream
[in]valuevalue to write out
[in]binaryIf true, the byte(s) of value are written out. If false, the string representation is written out.
Returns
  • MS::kSuccess write worked
  • MS::kFailure stream failed to write value
MStatus writeDouble ( std::ostream &  out,
const double  value,
bool  binary = false 
)
static

This method is used to write out a "double" value to an ostream.

Parameters
[in]outthe output ostream
[in]valuevalue to write out
[in]binaryIf true, the byte(s) of value are written out. If false, the string representation is written out.
Returns
  • MS::kSuccess write worked
  • MS::kFailure stream failed to write value
MStatus readChar ( std::istream &  in,
char &  value,
bool  binary = false 
)
static

This method is used to read a "char" binary value from an istream.

Parameters
[in]inthe input istream
[out]valuewhere the input is stored
[in]binaryif true the value appears in the input stream in binary form, otherwise it is in string form
Returns
  • MS::kSuccess read worked
  • MS::kFailure stream failed to read value
MStatus readCharBuffer ( std::istream &  in,
char *&  value,
unsigned int  length,
bool  binary = false 
)
static

This method is used to read a character string (char*) from an istream.

Parameters
[in]inthe input istream
[out]valuewhere the input is stored
[in]lengthnumber of characters to read
[in]binaryif true the value appears in the input stream in binary form, otherwise it is in string form
Returns
  • MS::kSuccess read worked
  • MS::kFailure value is NULL or stream failed to read value
MStatus readInt ( std::istream &  in,
int &  value,
bool  binary = false 
)
static

This method is used to read a "int" binary value from an istream.

Parameters
[in]inthe input istream
[out]valuewhere the input is stored
[in]binaryif true the value appears in the input stream in binary form, otherwise it is in string form
Returns
  • MS::kSuccess read worked
  • MS::kFailure stream failed to read value
MStatus readFloat ( std::istream &  in,
float &  value,
bool  binary = false 
)
static

This method is used to read a "float" binary value from an istream.

Parameters
[in]inthe input istream
[out]valuewhere the input is stored
[in]binaryif true the value appears in the input stream in binary form, otherwise it is in string form
Returns
  • MS::kSuccess read worked
  • MS::kFailure stream failed to read value
MStatus readDouble ( std::istream &  in,
double &  value,
bool  binary = false 
)
static

This method is used to read a "double" binary value from an istream.

Parameters
[in]inthe input istream
[out]valuewhere the input is stored
[in]binaryif true the value appears in the input stream in binary form, otherwise it is in string form
Returns
  • MS::kSuccess read worked
  • MS::kFailure stream failed to read value

The documentation for this class was generated from the following files:
  • MStreamUtils.h
  • MStreamUtils.cpp