339 if (!(is >> value)) |
339 if (!(is >> value)) |
340 throw DataFormatError("DefaultReader format error"); |
340 throw DataFormatError("DefaultReader format error"); |
341 } |
341 } |
342 }; |
342 }; |
343 |
343 |
344 template <typename Item> |
344 template <> |
345 class DefaultReader<std::vector<Item> > |
345 class DefaultReader<std::string> { |
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 { |
|
372 public: |
346 public: |
373 typedef std::string Value; |
347 typedef std::string Value; |
374 |
348 |
375 void read(std::istream& is, Value& value) const { |
349 void read(std::istream& is, Value& value) const { |
376 char c; |
350 char c; |
382 break; |
356 break; |
383 case '(': |
357 case '(': |
384 ParsedStringReader().read(is, value); |
358 ParsedStringReader().read(is, value); |
385 break; |
359 break; |
386 default: |
360 default: |
387 DefaultReader<std::string>().read(is, value); |
361 is >> value; |
388 break; |
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 /// \ingroup item_io |
397 /// \ingroup item_io |
394 /// \brief Standard ReaderTraits for the GraphReader class. |
398 /// \brief Standard ReaderTraits for the GraphReader class. |
395 /// |
399 /// |
396 /// Standard ReaderTraits for the GraphReader class. |
400 /// Standard ReaderTraits for the GraphReader class. |