Changeset 1427:14c75970840e in lemon-0.x
- Timestamp:
- 05/18/05 15:02:47 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1899
- Location:
- src/lemon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/bits/item_reader.h
r1415 r1427 342 342 }; 343 343 344 template <typename Item> 345 class DefaultReader<std::vector<Item> > 346 : public PushBackReader<std::vector<Item> > {}; 347 348 template <typename Item> 349 class DefaultReader<std::deque<Item> > 350 : public PushBackReader<std::deque<Item> > {}; 351 352 template <typename Item> 353 class DefaultReader<std::list<Item> > 354 : public PushBackReader<std::list<Item> > {}; 355 356 template <typename Item> 357 class DefaultReader<std::set<Item> > 358 : public InsertReader<std::set<Item> > {}; 359 360 template <typename Item> 361 class DefaultReader<std::multiset<Item> > 362 : public InsertReader<std::multiset<Item> > {}; 363 364 /// \ingroup item_io 365 /// 366 /// \brief The default item reader for skipping a value in the stream. 367 /// 368 /// The default item reader for skipping a value in the stream. 369 /// 370 /// \author Balazs Dezso 371 class DefaultSkipper { 344 template <> 345 class DefaultReader<std::string> { 372 346 public: 373 347 typedef std::string Value; … … 385 359 break; 386 360 default: 387 DefaultReader<std::string>().read(is, value);361 is >> value; 388 362 break; 389 363 } 390 364 } 391 }; 365 366 }; 367 368 template <typename Item> 369 class DefaultReader<std::vector<Item> > 370 : public PushBackReader<std::vector<Item> > {}; 371 372 template <typename Item> 373 class DefaultReader<std::deque<Item> > 374 : public PushBackReader<std::deque<Item> > {}; 375 376 template <typename Item> 377 class DefaultReader<std::list<Item> > 378 : public PushBackReader<std::list<Item> > {}; 379 380 template <typename Item> 381 class DefaultReader<std::set<Item> > 382 : public InsertReader<std::set<Item> > {}; 383 384 template <typename Item> 385 class DefaultReader<std::multiset<Item> > 386 : public InsertReader<std::multiset<Item> > {}; 387 388 /// \ingroup item_io 389 /// 390 /// \brief The default item reader for skipping a value in the stream. 391 /// 392 /// The default item reader for skipping a value in the stream. 393 /// 394 /// \author Balazs Dezso 395 class DefaultSkipper : public DefaultReader<std::string> {}; 392 396 393 397 /// \ingroup item_io -
src/lemon/lemon_reader.h
r1424 r1427 100 100 /// while it does not starts with \c \@ character. This line can start a 101 101 /// new section or if it can close the file with the \c \@end line. 102 /// The file format ignore the empty lines and it may contain comments103 /// started with a \c # character to the end of the line.102 /// The file format ignore the empty and comment lines. The line is 103 /// comment line if it starts with a \c # character. 104 104 /// 105 105 /// The framework provides an abstract LemonReader::SectionReader class … … 109 109 /// can be attached to an LemonReader and the first attached what can 110 110 /// process the section will be used. Its \c read() member will called 111 /// with a stream contains the section. From this stream the empty lines112 /// and comments are filtered out.111 /// with a stream contains the section. From this stream the empty and 112 /// comment lines are filtered out. 113 113 /// 114 114 /// \relates GraphReader … … 134 134 enum skip_state_type { 135 135 no_skip, 136 after_comment,137 136 after_endl, 138 empty_line137 comment_line 139 138 }; 140 139 … … 181 180 skip_state = after_endl; 182 181 return true; 183 case '#':184 skip_state = after_comment;185 return false;186 182 default: 187 183 return true; 188 184 } 189 case after_comment:190 switch (c) {191 case '\n':192 skip_state = after_endl;193 return true;194 default:195 return false;196 }197 185 case after_endl: 198 186 switch (c) { … … 202 190 return false; 203 191 case '#': 204 skip_state = empty_line;192 skip_state = comment_line; 205 193 return false; 206 194 default: … … 213 201 } 214 202 break; 215 case empty_line:203 case comment_line: 216 204 switch (c) { 217 205 case '\n':
Note: See TracChangeset
for help on using the changeset viewer.