00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Stream.h"
00021 #include <string.h>
00022
00023 namespace mdw
00024 {
00025 Endl endl;
00026
00027 Stream::Stream()
00028 {
00029 }
00030
00031 Stream::~Stream()
00032 {
00033 }
00034
00035 Stream & Stream::operator << (bool b)
00036 {
00037 if (b)
00038 {
00039 output ("true", 4);
00040 }
00041 else
00042 {
00043 output ("false", 5);
00044 }
00045 return *this;
00046 }
00047 Stream & Stream::operator << (char c)
00048 {
00049 output (&c, 1);
00050 return *this;
00051 }
00052 Stream & Stream::operator << (short s)
00053 {
00054 char buff[32];
00055 output (buff, sprintf (buff, "%d", s));
00056 return *this;
00057 }
00058 Stream & Stream::operator << (int i)
00059 {
00060 char buff[32];
00061 output (buff, sprintf (buff, "%d", i));
00062 return *this;
00063 }
00064 Stream & Stream::operator << (long l)
00065 {
00066 char buff[32];
00067 output (buff, sprintf (buff, "%l", l));
00068 return *this;
00069 }
00070 Stream & Stream::operator << (double d)
00071 {
00072 char buff[32];
00073 output (buff, sprintf (buff, "%e", d));
00074 return *this;
00075 }
00076 Stream & Stream::operator << (const std::string &s)
00077 {
00078 output (s.data(), s.size());
00079 return *this;
00080 }
00081 Stream & Stream::operator << (const char *s)
00082 {
00083 output (s, strlen (s));
00084 return *this;
00085 }
00086 Stream & Stream::operator << (const std::vector<char> &v)
00087 {
00088 output (&*v.begin(), v.size());
00089 return *this;
00090 }
00091 Stream & Stream::operator << (Endl &e)
00092 {
00093 output ("\n", 1);
00094 return *this;
00095 }
00096 }