shape_doc 0.1
|
00001 #ifndef mmx_shape_xml_hpp 00002 #define mmx_shape_xml_hpp 00003 //==================================================================== 00004 #include <string.h> 00005 #include <cstdio> 00006 #include <iostream> 00007 //==================================================================== 00008 namespace mmx { 00009 00010 namespace xml { 00011 template<class ISTREAM> 00012 bool skip(ISTREAM& is, const char* s) { 00013 char c=(*s); const char* t=s; 00014 unsigned n= strlen(s),i=0; 00015 while(c != EOF) { 00016 for(i=0; i<n && (c !=EOF) && (c=is.get()) == (*t); i++,t++); 00017 if(i==n) { 00018 while((c=is.get()) != EOF && c != '>') ; 00019 return true; 00020 } 00021 else 00022 t=s; 00023 } 00024 00025 return false; 00026 } 00027 00029 template<class ISTREAM, typename STRING> bool 00030 read(ISTREAM& is, STRING& s, const char* mark) { 00031 if(skip(is,mark)) { 00032 char c; 00033 while((c=is.get()) != EOF && c != '<') { 00034 s+=c; 00035 } 00036 s+='\0'; 00037 return true; 00038 } else { 00039 return false; 00040 } 00041 } 00042 00043 } //namespace xml 00044 } //namespace mmx 00045 //==================================================================== 00046 #endif //realroot_polynom_xml_hpp