Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "fosi.h"
00039
00040 #include "rtconversions.hpp"
00041 #include "rtstreambufs.hpp"
00042
00043 #ifndef RTSTREAMS_HPP
00044 #define RTSTREAMS_HPP
00045
00056 namespace RTT
00057 {
00058 namespace os
00059 {
00060
00076 class RTT_API basic_streams
00077 {
00078
00079 public:
00080 virtual ~basic_streams();
00081
00087
00088
00089
00090
00091
00092
00098
00099
00100
00101
00102
00103 };
00104
00113 class RTT_API basic_istreams
00114 : virtual public basic_streams
00115 {
00116
00117 public:
00118 typedef streambufs::streamsize streamsize;
00119
00120 basic_istreams( streambufs& s ) : buf(s) {}
00121 virtual ~basic_istreams();
00122
00123 int get();
00124 basic_istreams& get(char& c);
00125 basic_istreams& get(char* c, streamsize n, char delim);
00126 basic_istreams& get(char* c, char delim);
00127
00128 basic_istreams& read( char* c, streamsize n );
00129 streamsize readsome( char* c, streamsize n);
00130
00131
00132 basic_istreams& operator>>( int &i );
00133 basic_istreams& operator>>( char &c );
00134 basic_istreams& operator>>( double &f );
00135 basic_istreams& operator>>( std::string &s );
00136 basic_istreams& operator>>( unsigned int &u );
00137 private:
00138 streambufs& buf;
00139 };
00140
00145 class RTT_API basic_ostreams : virtual public basic_streams
00146 {
00147
00148 public:
00149 typedef streambufs::streamsize streamsize;
00150
00151 basic_ostreams( streambufs& s ) : buf(s) {}
00152 virtual ~basic_ostreams();
00153
00154 virtual basic_ostreams& put( char c );
00155 virtual basic_ostreams& write( const char * c, streamsize n );
00156
00161 basic_ostreams& operator<<( int i );
00162 basic_ostreams& operator<<( long i );
00163 basic_ostreams& operator<<( char c );
00164 basic_ostreams& operator<<( char * c );
00165 basic_ostreams& operator<<( double f );
00166 basic_ostreams& operator<<( std::string s );
00167 basic_ostreams& operator<<( unsigned int u );
00168 basic_ostreams& operator<<( basic_ostreams & ( *f ) ( basic_ostreams & ) );
00169 private:
00170 streambufs& buf;
00171 };
00172
00173
00174
00178 basic_ostreams& endl( basic_ostreams& );
00179
00180
00184 class RTT_API basic_iostreams
00185 : public basic_istreams, public basic_ostreams
00186 {
00187 public:
00188 basic_iostreams( streambufs& s)
00189 : basic_istreams(s), basic_ostreams(s) {}
00190 };
00191
00192
00193 struct RTT_API print_helper { printbufs printer; };
00194
00200 class RTT_API printstream
00201 : private print_helper, public basic_ostreams
00202 {
00203
00204 public:
00205 printstream() : basic_ostreams(printer) {}
00206 virtual ~printstream();
00207 };
00208
00212 extern printstream cout;
00213
00214 struct RTT_API string_helper { string_helper() : str() {}; string_helper(const std::string& _init) : str(_init) {}; stringbufs str; };
00215
00219 class RTT_API stringstreams
00220 : private string_helper, public basic_iostreams
00221 {
00222 public:
00223 stringstreams(const std::string& _init) : string_helper(_init), basic_iostreams(str) {}
00224 stringstreams() : string_helper(), basic_iostreams(str) {}
00225 virtual ~stringstreams();
00226 };
00227
00228 }
00229 }
00230 #endif