9 #include <boost/lexical_cast.hpp>
10 #include <boost/thread/mutex.hpp>
43 if( tmp && !tmp->
ready() ) {
54 if( tmp && !tmp->
ready() ) {
83 if( c == delim ) { s = ss.
str();
return i; }
84 if( c !=
'\r' ) ss.
write(&c,1);
93 size_t cout_t::writesome(
const std::shared_ptr<const char>& buf,
size_t len,
size_t offset ) {
return writesome(buf.get() + offset, len); }
98 size_t cerr_t::writesome(
const std::shared_ptr<const char>& buf,
size_t len,
size_t offset ) {
return writesome(buf.get() + offset, len); }
106 avail = (std::min)(int64_t(len),avail);
109 if( !((avail>0) && (len>0)) ) {
116 while( (avail>0) && (len>0) ) {
126 size_t cin_t::readsome(
const std::shared_ptr<char>& buf,
size_t len,
size_t offset ) {
return readsome(buf.get() + offset, len); }
161 if( tmp && !tmp->ready() ) {
164 }
while( len > 0 && !b.
eof );
172 std::shared_ptr<cin_t>
cin_ptr = std::make_shared<cin_t>();
173 std::shared_ptr<cout_t>
cout_ptr = std::make_shared<cout_t>();
174 std::shared_ptr<cerr_t>
cerr_ptr = std::make_shared<cerr_t>();
187 o.
write( v, strlen(v) );
193 o.
write( v.c_str(), v.size() );
199 return o << boost::lexical_cast<std::string>(v).c_str();
204 return o << boost::lexical_cast<std::string>(v).c_str();
209 return o << boost::lexical_cast<std::string>(v).c_str();
214 return o << boost::lexical_cast<std::string>(v).c_str();
219 return o << boost::lexical_cast<std::string>(v).c_str();
224 return o << boost::lexical_cast<std::string>(v).c_str();
229 return o << boost::lexical_cast<std::string>(v).c_str();
234 return o << boost::lexical_cast<std::string>(v).c_str();
239 return o << boost::lexical_cast<std::string>(v).c_str();
244 return o << boost::lexical_cast<std::string>(v).c_str();
248 ostream&
operator<<( ostream& o,
const size_t& v )
250 return o << boost::lexical_cast<std::string>(v).c_str();
257 assert(
false &&
"not implemented");
277 while(
size_t(pos-buf) < len )
278 pos +=
readsome( pos, len - (pos - buf) );
284 size_t bytes_read = 0;
285 while( bytes_read < len )
286 bytes_read +=
readsome(buf, len - bytes_read, bytes_read + offset);
292 const char* pos = buf;
293 while(
size_t(pos-buf) < len )
294 pos +=
writesome( pos, len - (pos - buf) );
300 size_t bytes_written = 0;
301 while( bytes_written < len )
302 bytes_written +=
writesome(buf, len - bytes_written, bytes_written + offset);