Changeset 2426:6e1027a05d73 in lemon-0.x for lemon/bits
- Timestamp:
- 04/19/07 17:14:34 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3262
- Location:
- lemon/bits
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/item_reader.h
r2391 r2426 31 31 #include <list> 32 32 #include <set> 33 #include <map> 34 35 #include <lemon/error.h> 33 36 34 37 namespace lemon { … … 173 176 value.clear(); 174 177 is >> std::ws; 175 if (!is.get(c) || c != '\"')178 if (!is.get(c) || (c != '\"' && c != '\'')) 176 179 throw DataFormatError("Quoted format error"); 177 while (is.get(c) && c != '\"') { 180 char quote = c; 181 while (is.get(c) && c != quote) { 178 182 if (escaped && c == '\\') { 179 183 value += readEscape(is); -
lemon/bits/item_writer.h
r2391 r2426 32 32 #include <list> 33 33 #include <set> 34 #include <map> 35 36 #include <lemon/error.h> 34 37 35 38 namespace lemon { … … 147 150 /// Constructor for the writer. If the given parameter is true 148 151 /// the writer creates escape sequences from special characters. 149 QuotedStringWriter(bool _escaped = true) : escaped(_escaped) {} 152 QuotedStringWriter(bool _escaped = true, char _quote = '\"') 153 : escaped(_escaped), quote(_quote) {} 150 154 151 155 /// \brief Writes a quoted string to the given stream. … … 153 157 /// Writes a quoted string to the given stream. 154 158 void write(std::ostream& os, const std::string& value) const { 155 os << "\"";159 os << quote; 156 160 if (escaped) { 157 161 std::ostringstream ls; … … 163 167 os << value; 164 168 } 165 os << "\"";169 os << quote; 166 170 } 167 171 … … 214 218 private: 215 219 bool escaped; 220 char quote; 216 221 }; 217 222
Note: See TracChangeset
for help on using the changeset viewer.