[Lemon-commits] [lemon_svn] deba: r1899 - in hugo/trunk/src/lemon: . bits
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:48:34 CET 2006
Author: deba
Date: Wed May 18 15:02:47 2005
New Revision: 1899
Modified:
hugo/trunk/src/lemon/bits/item_reader.h
hugo/trunk/src/lemon/lemon_reader.h
Log:
Two minor changes.
DefaultReader<std::string>
comment lines
Modified: hugo/trunk/src/lemon/bits/item_reader.h
==============================================================================
--- hugo/trunk/src/lemon/bits/item_reader.h (original)
+++ hugo/trunk/src/lemon/bits/item_reader.h Wed May 18 15:02:47 2005
@@ -341,6 +341,30 @@
}
};
+ template <>
+ class DefaultReader<std::string> {
+ public:
+ typedef std::string Value;
+
+ void read(std::istream& is, Value& value) const {
+ char c;
+ if (!(is >> c)) return;
+ is.putback(c);
+ switch (c) {
+ case '\"':
+ QuotedStringReader().read(is, value);
+ break;
+ case '(':
+ ParsedStringReader().read(is, value);
+ break;
+ default:
+ is >> value;
+ break;
+ }
+ }
+
+ };
+
template <typename Item>
class DefaultReader<std::vector<Item> >
: public PushBackReader<std::vector<Item> > {};
@@ -368,27 +392,7 @@
/// The default item reader for skipping a value in the stream.
///
/// \author Balazs Dezso
- class DefaultSkipper {
- public:
- typedef std::string Value;
-
- void read(std::istream& is, Value& value) const {
- char c;
- if (!(is >> c)) return;
- is.putback(c);
- switch (c) {
- case '\"':
- QuotedStringReader().read(is, value);
- break;
- case '(':
- ParsedStringReader().read(is, value);
- break;
- default:
- DefaultReader<std::string>().read(is, value);
- break;
- }
- }
- };
+ class DefaultSkipper : public DefaultReader<std::string> {};
/// \ingroup item_io
/// \brief Standard ReaderTraits for the GraphReader class.
Modified: hugo/trunk/src/lemon/lemon_reader.h
==============================================================================
--- hugo/trunk/src/lemon/lemon_reader.h (original)
+++ hugo/trunk/src/lemon/lemon_reader.h Wed May 18 15:02:47 2005
@@ -99,8 +99,8 @@
/// header line of the section. Each next lines belong to this section
/// while it does not starts with \c \@ character. This line can start a
/// new section or if it can close the file with the \c \@end line.
- /// The file format ignore the empty lines and it may contain comments
- /// started with a \c # character to the end of the line.
+ /// The file format ignore the empty and comment lines. The line is
+ /// comment line if it starts with a \c # character.
///
/// The framework provides an abstract LemonReader::SectionReader class
/// what defines the interface of a SectionReader. The SectionReader
@@ -108,8 +108,8 @@
/// decides if it want to process the next section. Several SectionReaders
/// can be attached to an LemonReader and the first attached what can
/// process the section will be used. Its \c read() member will called
- /// with a stream contains the section. From this stream the empty lines
- /// and comments are filtered out.
+ /// with a stream contains the section. From this stream the empty and
+ /// comment lines are filtered out.
///
/// \relates GraphReader
/// \relates NodeSetReader
@@ -133,9 +133,8 @@
enum skip_state_type {
no_skip,
- after_comment,
after_endl,
- empty_line
+ comment_line
};
char_type small_buf[1];
@@ -180,20 +179,9 @@
case '\n':
skip_state = after_endl;
return true;
- case '#':
- skip_state = after_comment;
- return false;
default:
return true;
}
- case after_comment:
- switch (c) {
- case '\n':
- skip_state = after_endl;
- return true;
- default:
- return false;
- }
case after_endl:
switch (c) {
case '@':
@@ -201,7 +189,7 @@
case '\n':
return false;
case '#':
- skip_state = empty_line;
+ skip_state = comment_line;
return false;
default:
if (!isspace(c)) {
@@ -212,7 +200,7 @@
}
}
break;
- case empty_line:
+ case comment_line:
switch (c) {
case '\n':
skip_state = after_endl;
More information about the Lemon-commits
mailing list