lemon/bits/item_reader.h
changeset 1829 183b4cbf9733
parent 1435 8e85e6bbefdf
child 1852 ffa7c6e96330
equal deleted inserted replaced
0:99fbec7c26a1 1:b1584baeb800
   243   };
   243   };
   244 
   244 
   245   /// \ingroup item_io
   245   /// \ingroup item_io
   246   /// \brief Reader for parsed string.
   246   /// \brief Reader for parsed string.
   247   ///
   247   ///
   248   /// Reader for parsed strings. You can give the open and close
   248   /// Reader for parsed strings. You can define the open and close
   249   /// parse characters.
   249   /// parse characters. It reads from the input a character sequence
       
   250   /// which is right parsed.
   250   ///
   251   ///
   251   /// \author Balazs Dezso
   252   /// \author Balazs Dezso
   252   class ParsedStringReader {
   253   class ParsedStringReader {
   253   public:
   254   public:
   254     typedef std::string Value;
   255     typedef std::string Value;
   355 	QuotedStringReader().read(is, value);
   356 	QuotedStringReader().read(is, value);
   356 	break;
   357 	break;
   357       case '(':
   358       case '(':
   358 	ParsedStringReader().read(is, value);
   359 	ParsedStringReader().read(is, value);
   359 	break;
   360 	break;
       
   361       case '[':
       
   362 	ParsedStringReader('[', ']').read(is, value);
       
   363 	break;
       
   364       case '/':
       
   365 	ParsedStringReader('/', '/').read(is, value);
       
   366 	break;
   360       default:
   367       default:
   361 	is >> value; 
   368 	if (!(is >> value)) 
       
   369 	  throw DataFormatError("DefaultReader format error");
   362 	break;
   370 	break;
   363       }
   371       }
   364     }
   372     }
   365     
   373     
   366   };
   374   };