00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #include "Text.hxx"
00023 
00024 #include <sstream>
00025 #include <iterator>
00026 
00027 namespace CLAM
00028 {
00029 
00030         std::istream & operator >> (std::istream & stream, Text & text)
00031         {
00032 #if 0
00033                 stream.unsetf(std::ios::skipws);
00034                 text assign(
00035                         (std::istream_iterator<char>(stream)),
00036                         std::istream_iterator<char>());
00037 #elif 0
00038                 text.assign(
00039                         (std::istreambuf_iterator<char>(stream)),
00040                         std::istreambuf_iterator<char>());
00041 #elif 1
00042                 text = "";
00043                 char buffer[1024];
00044                 stream.read( buffer, 1023 );
00045                 do 
00046                 {
00047                         text.append( buffer, stream.gcount() );
00048                 }
00049                 while( stream.read( buffer, 1023 ) );
00050 #endif
00051                 return stream;
00052 
00053         }
00054 
00055 }
00056 
00057