diff --git a/tmpl/parser.cc b/tmpl/parser.cc index 994fd9e..6d632cd 100644 --- a/tmpl/parser.cc +++ b/tmpl/parser.cc @@ -1,5 +1,6 @@ #include +#include #include I_HEADER_NAME @@ -9,11 +10,33 @@ using namespace std; namespace I_NAMESPACE { #endif +static void read_istream(istream & i, vector & buff, int & size) +{ + size = 0; + int bytes_read; + char read_buff[1000]; + while (!i.eof()) + { + i.read(&read_buff[0], sizeof(read_buff)); + bytes_read = i.gcount(); + size += bytes_read; + for (int j = 0; j < bytes_read; j++) + buff.push_back(read_buff[j]); + } +} + bool I_CLASSNAME::parse(istream & i) { struct { char * name; char * definition; } tokens[] = { I_TOKENLIST }; + + vector buff; + int size; + read_istream(i, buff, size); + + if (size <= 0) + return false; } #ifdef I_NAMESPACE