Changeset 1533:43c7b3085212 in lemon-0.x for lemon/bits/item_writer.h
- Timestamp:
- 07/04/05 18:11:00 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2025
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/item_writer.h
r1435 r1533 57 57 os << "\""; 58 58 if (escaped) { 59 std::ostringstream ls ;59 std::ostringstream ls(value); 60 60 for (int i = 0; i < (int)value.size(); ++i) { 61 61 writeEscape(ls, value[i]); … … 117 117 bool escaped; 118 118 }; 119 120 /// \ingroup item_io 121 /// \brief Writer class for quoted char array. 122 /// 123 /// Writer class for quoted char array. It can process the escape 124 /// sequences in the char array. 125 /// \author Balazs Dezso 126 class QuotedCharArrayWriter { 127 public: 128 typedef const char* Value; 129 130 /// \brief Constructor for the writer. 131 /// 132 /// Constructor for the writer. If the given parameter is true 133 /// the writer creates escape sequences from special characters. 134 QuotedCharArrayWriter(bool _escaped = true) : escaped(_escaped) {} 135 136 /// \brief Writes a quoted char array to the given stream. 137 /// 138 /// Writes a quoted char array to the given stream. 139 void write(std::ostream& os, const char* value) { 140 QuotedStringWriter(escaped).write(os, std::string(value)); 141 } 142 143 private: 144 bool escaped; 145 }; 146 119 147 120 148 /// \ingroup item_io … … 182 210 : public QuotedStringWriter {}; 183 211 212 template <int length> 213 class DefaultWriter<char[length]> 214 : public QuotedCharArrayWriter {}; 215 216 template <int length> 217 class DefaultWriter<const char[length]> 218 : public QuotedCharArrayWriter {}; 219 184 220 template <typename Item> 185 221 class DefaultWriter<std::vector<Item> > … … 211 247 212 248 template <typename _Value> 213 struct Writer : DefaultWriter<_Value> {}; 249 struct Writer : DefaultWriter<_Value> { 250 typedef DefaultWriter<_Value> Parent; 251 }; 214 252 215 253 };
Note: See TracChangeset
for help on using the changeset viewer.