Files Classes Functions Hierarchy
00001 #ifndef STREAMCONVERSION_H 00002 #define STREAMCONVERSION_H 00003 00004 #include <iostream> 00005 #include <string> 00006 #include <vector> 00007 using namespace std; 00008 00009 #include <print.h> 00010 00014 class asciitodig 00015 { 00016 public: 00017 00019 static void forward( string & os, istream & is ); 00021 static void reverse( ostream & os, string const & in ); 00022 }; 00023 00024 00036 class digdiv 00037 { 00039 uint pad; 00040 public: 00041 00043 uint blksz; 00045 vector<string> vi; 00046 00048 void forward(string const & in); 00050 void reverse(string & os); 00051 00053 void save(ostream & os) const; 00055 void restore(istream & in); 00056 00058 template< typename T > 00059 void eval( T & fn ); 00060 00061 }; 00062 00063 /* 00064 *--------------------------------------------------------------- 00065 * Implementation 00066 */ 00067 00068 template< typename T > 00069 void digdiv::eval( T & fn ) 00070 { 00071 if (vi.empty()) 00072 return; 00073 00074 uintc sz = vi.size(); 00075 for (uint i=0; i<sz; ++i) 00076 { 00077 fn(vi[i],vi[i]); 00078 } 00079 00080 } 00081 00082 00083 #endif 00084 00085
1.5.8