lemon/bits/item_reader.h
changeset 2552 5f711e4668f5
parent 2391 14a343be7a5a
child 2553 bfced05fa852
equal deleted inserted replaced
10:529b78fa4645 11:1a4df56d617a
    28 
    28 
    29 #include <vector>
    29 #include <vector>
    30 #include <deque>
    30 #include <deque>
    31 #include <list>
    31 #include <list>
    32 #include <set>
    32 #include <set>
       
    33 #include <map>
       
    34 
       
    35 #include <lemon/error.h>
    33 
    36 
    34 namespace lemon {
    37 namespace lemon {
    35   
    38   
    36   template <typename Value>
    39   template <typename Value>
    37   class DefaultReader;
    40   class DefaultReader;
   170     /// Reads a quoted string from the given stream.
   173     /// Reads a quoted string from the given stream.
   171     void read(std::istream& is, std::string& value) const {
   174     void read(std::istream& is, std::string& value) const {
   172       char c;
   175       char c;
   173       value.clear();
   176       value.clear();
   174       is >> std::ws;
   177       is >> std::ws;
   175       if (!is.get(c) || c != '\"') 
   178       if (!is.get(c) || (c != '\"' && c != '\'')) 
   176 	throw DataFormatError("Quoted format error");
   179 	throw DataFormatError("Quoted format error");
   177       while (is.get(c) && c != '\"') {
   180       char quote = c;
       
   181       while (is.get(c) && c != quote) {
   178 	if (escaped && c == '\\') {
   182 	if (escaped && c == '\\') {
   179 	  value += readEscape(is);
   183 	  value += readEscape(is);
   180 	} else {
   184 	} else {
   181 	  value += c;
   185 	  value += c;
   182 	}
   186 	}