lemon/bits/item_writer.h
changeset 2388 c6d537888fe5
parent 2255 4a9cc8c800ae
child 2391 14a343be7a5a
equal deleted inserted replaced
9:5c7654d7f0c6 10:6e86948782a3
   153     /// Writes a quoted string to the given stream.
   153     /// Writes a quoted string to the given stream.
   154     void write(std::ostream& os, const std::string& value) const {
   154     void write(std::ostream& os, const std::string& value) const {
   155       os << "\"";
   155       os << "\"";
   156       if (escaped) {
   156       if (escaped) {
   157 	std::ostringstream ls;
   157 	std::ostringstream ls;
   158 	for (int i = 0; i < (int)value.size(); ++i) {
   158 	for (int i = 0; i < int(value.size()); ++i) {
   159 	  writeEscape(ls, value[i]);
   159 	  writeEscape(ls, value[i]);
   160 	}
   160 	}
   161 	os << ls.str();
   161 	os << ls.str();
   162       } else {
   162       } else {
   163 	os << value;
   163 	os << value;
   202       case '\v':
   202       case '\v':
   203 	os << "\\v";
   203 	os << "\\v";
   204 	return;
   204 	return;
   205       default:
   205       default:
   206 	if (c < 0x20) {
   206 	if (c < 0x20) {
   207 	  os << '\\' << std::oct << (int)c;
   207 	  os << '\\' << std::oct << static_cast<int>(c);
   208 	} else {
   208 	} else {
   209 	  os << c;
   209 	  os << c;
   210 	}
   210 	}
   211 	return;
   211 	return;
   212       }     
   212       }