COIN-OR::LEMON - Graph Library

Changeset 1427:14c75970840e in lemon-0.x


Ignore:
Timestamp:
05/18/05 15:02:47 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1899
Message:

Two minor changes.

DefaultReader?<std::string>
comment lines

Location:
src/lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/bits/item_reader.h

    r1415 r1427  
    342342  };
    343343
    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> {
    372346  public:
    373347    typedef std::string Value;
     
    385359        break;
    386360      default:
    387         DefaultReader<std::string>().read(is, value);
     361        is >> value;
    388362        break;
    389363      }
    390364    }
    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> {};
    392396
    393397  /// \ingroup item_io 
  • src/lemon/lemon_reader.h

    r1424 r1427  
    100100  /// while it does not starts with \c \@ character. This line can start a
    101101  /// 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 comments
    103   /// 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.
    104104  ///
    105105  /// The framework provides an abstract LemonReader::SectionReader class
     
    109109  /// can be attached to an LemonReader and the first attached what can
    110110  /// process the section will be used. Its \c read() member will called
    111   /// with a stream contains the section. From this stream the empty lines
    112   /// and comments are filtered out.
     111  /// with a stream contains the section. From this stream the empty and
     112  /// comment lines are filtered out.
    113113  ///
    114114  /// \relates GraphReader
     
    134134      enum skip_state_type {
    135135        no_skip,
    136         after_comment,
    137136        after_endl,
    138         empty_line
     137        comment_line
    139138      };
    140139
     
    181180            skip_state = after_endl;
    182181            return true;
    183           case '#':
    184             skip_state = after_comment;
    185             return false;
    186182          default:
    187183            return true;
    188184          }
    189         case after_comment:
    190           switch (c) {
    191           case '\n':
    192             skip_state = after_endl;
    193             return true;
    194           default:
    195             return false;
    196           }       
    197185        case after_endl:
    198186          switch (c) {
     
    202190            return false;
    203191          case '#':
    204             skip_state = empty_line;
     192            skip_state = comment_line;
    205193            return false;
    206194          default:
     
    213201          }
    214202          break;
    215         case empty_line:
     203        case comment_line:
    216204          switch (c) {
    217205          case '\n':
Note: See TracChangeset for help on using the changeset viewer.