lemon/lgf_reader.h
changeset 209 765619b7cbb2
parent 201 9757e3d9bfeb
child 210 81cfc04531e8
     1.1 --- a/lemon/lgf_reader.h	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/lemon/lgf_reader.h	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -46,26 +46,26 @@
    1.13      template <typename Value>
    1.14      struct DefaultConverter {
    1.15        Value operator()(const std::string& str) {
    1.16 -	std::istringstream is(str);
    1.17 -	Value value;
    1.18 -	is >> value;
    1.19 -
    1.20 -	char c;
    1.21 -	if (is >> std::ws >> c) {
    1.22 -	  throw DataFormatError("Remaining characters in token");
    1.23 -	}
    1.24 -	return value;
    1.25 +        std::istringstream is(str);
    1.26 +        Value value;
    1.27 +        is >> value;
    1.28 +
    1.29 +        char c;
    1.30 +        if (is >> std::ws >> c) {
    1.31 +          throw DataFormatError("Remaining characters in token");
    1.32 +        }
    1.33 +        return value;
    1.34        }
    1.35      };
    1.36  
    1.37      template <>
    1.38      struct DefaultConverter<std::string> {
    1.39        std::string operator()(const std::string& str) {
    1.40 -	return str;
    1.41 +        return str;
    1.42        }
    1.43      };
    1.44  
    1.45 -    template <typename _Item>    
    1.46 +    template <typename _Item>
    1.47      class MapStorageBase {
    1.48      public:
    1.49        typedef _Item Item;
    1.50 @@ -78,30 +78,30 @@
    1.51  
    1.52      };
    1.53  
    1.54 -    template <typename _Item, typename _Map, 
    1.55 -	      typename _Converter = DefaultConverter<typename _Map::Value> >
    1.56 +    template <typename _Item, typename _Map,
    1.57 +              typename _Converter = DefaultConverter<typename _Map::Value> >
    1.58      class MapStorage : public MapStorageBase<_Item> {
    1.59      public:
    1.60        typedef _Map Map;
    1.61        typedef _Converter Converter;
    1.62        typedef _Item Item;
    1.63 -      
    1.64 +
    1.65      private:
    1.66        Map& _map;
    1.67        Converter _converter;
    1.68  
    1.69      public:
    1.70 -      MapStorage(Map& map, const Converter& converter = Converter()) 
    1.71 -	: _map(map), _converter(converter) {}
    1.72 +      MapStorage(Map& map, const Converter& converter = Converter())
    1.73 +        : _map(map), _converter(converter) {}
    1.74        virtual ~MapStorage() {}
    1.75  
    1.76        virtual void set(const Item& item ,const std::string& value) {
    1.77 -	_map.set(item, _converter(value));
    1.78 +        _map.set(item, _converter(value));
    1.79        }
    1.80      };
    1.81  
    1.82 -    template <typename _Graph, bool _dir, typename _Map, 
    1.83 -	      typename _Converter = DefaultConverter<typename _Map::Value> >
    1.84 +    template <typename _Graph, bool _dir, typename _Map,
    1.85 +              typename _Converter = DefaultConverter<typename _Map::Value> >
    1.86      class GraphArcMapStorage : public MapStorageBase<typename _Graph::Edge> {
    1.87      public:
    1.88        typedef _Map Map;
    1.89 @@ -109,20 +109,20 @@
    1.90        typedef _Graph Graph;
    1.91        typedef typename Graph::Edge Item;
    1.92        static const bool dir = _dir;
    1.93 -      
    1.94 +
    1.95      private:
    1.96        const Graph& _graph;
    1.97        Map& _map;
    1.98        Converter _converter;
    1.99  
   1.100      public:
   1.101 -      GraphArcMapStorage(const Graph& graph, Map& map, 
   1.102 -			 const Converter& converter = Converter()) 
   1.103 -	: _graph(graph), _map(map), _converter(converter) {}
   1.104 +      GraphArcMapStorage(const Graph& graph, Map& map,
   1.105 +                         const Converter& converter = Converter())
   1.106 +        : _graph(graph), _map(map), _converter(converter) {}
   1.107        virtual ~GraphArcMapStorage() {}
   1.108  
   1.109        virtual void set(const Item& item ,const std::string& value) {
   1.110 -	_map.set(_graph.direct(item, dir), _converter(value));
   1.111 +        _map.set(_graph.direct(item, dir), _converter(value));
   1.112        }
   1.113      };
   1.114  
   1.115 @@ -146,10 +146,10 @@
   1.116  
   1.117      public:
   1.118        ValueStorage(Value& value, const Converter& converter = Converter())
   1.119 - 	: _value(value), _converter(converter) {}
   1.120 +         : _value(value), _converter(converter) {}
   1.121  
   1.122        virtual void set(const std::string& value) {
   1.123 -	_value = _converter(value);
   1.124 +        _value = _converter(value);
   1.125        }
   1.126      };
   1.127  
   1.128 @@ -176,45 +176,45 @@
   1.129      struct GraphArcLookUpConverter {
   1.130        const Graph& _graph;
   1.131        const std::map<std::string, typename Graph::Edge>& _map;
   1.132 -      
   1.133 -      GraphArcLookUpConverter(const Graph& graph, 
   1.134 -			      const std::map<std::string,
   1.135 -			                     typename Graph::Edge>& map) 
   1.136 -	: _graph(graph), _map(map) {}
   1.137 -      
   1.138 +
   1.139 +      GraphArcLookUpConverter(const Graph& graph,
   1.140 +                              const std::map<std::string,
   1.141 +                                             typename Graph::Edge>& map)
   1.142 +        : _graph(graph), _map(map) {}
   1.143 +
   1.144        typename Graph::Arc operator()(const std::string& str) {
   1.145 -	if (str.empty() || (str[0] != '+' && str[0] != '-')) {
   1.146 -	  throw DataFormatError("Item must start with '+' or '-'");
   1.147 -	}
   1.148 -	typename std::map<std::string, typename Graph::Edge>
   1.149 -	  ::const_iterator it = _map.find(str.substr(1));
   1.150 -	if (it == _map.end()) {
   1.151 -	  throw DataFormatError("Item not found");
   1.152 -	}
   1.153 -	return _graph.direct(it->second, str[0] == '+');
   1.154 +        if (str.empty() || (str[0] != '+' && str[0] != '-')) {
   1.155 +          throw DataFormatError("Item must start with '+' or '-'");
   1.156 +        }
   1.157 +        typename std::map<std::string, typename Graph::Edge>
   1.158 +          ::const_iterator it = _map.find(str.substr(1));
   1.159 +        if (it == _map.end()) {
   1.160 +          throw DataFormatError("Item not found");
   1.161 +        }
   1.162 +        return _graph.direct(it->second, str[0] == '+');
   1.163        }
   1.164      };
   1.165  
   1.166      inline bool isWhiteSpace(char c) {
   1.167 -      return c == ' ' || c == '\t' || c == '\v' || 
   1.168 -        c == '\n' || c == '\r' || c == '\f'; 
   1.169 +      return c == ' ' || c == '\t' || c == '\v' ||
   1.170 +        c == '\n' || c == '\r' || c == '\f';
   1.171      }
   1.172 -    
   1.173 +
   1.174      inline bool isOct(char c) {
   1.175 -      return '0' <= c && c <='7'; 
   1.176 +      return '0' <= c && c <='7';
   1.177      }
   1.178 -    
   1.179 +
   1.180      inline int valueOct(char c) {
   1.181        LEMON_ASSERT(isOct(c), "The character is not octal.");
   1.182        return c - '0';
   1.183      }
   1.184  
   1.185      inline bool isHex(char c) {
   1.186 -      return ('0' <= c && c <= '9') || 
   1.187 -	('a' <= c && c <= 'z') || 
   1.188 -	('A' <= c && c <= 'Z'); 
   1.189 +      return ('0' <= c && c <= '9') ||
   1.190 +        ('a' <= c && c <= 'z') ||
   1.191 +        ('A' <= c && c <= 'Z');
   1.192      }
   1.193 -    
   1.194 +
   1.195      inline int valueHex(char c) {
   1.196        LEMON_ASSERT(isHex(c), "The character is not hexadecimal.");
   1.197        if ('0' <= c && c <= '9') return c - '0';
   1.198 @@ -224,95 +224,95 @@
   1.199  
   1.200      inline bool isIdentifierFirstChar(char c) {
   1.201        return ('a' <= c && c <= 'z') ||
   1.202 -	('A' <= c && c <= 'Z') || c == '_';
   1.203 +        ('A' <= c && c <= 'Z') || c == '_';
   1.204      }
   1.205  
   1.206      inline bool isIdentifierChar(char c) {
   1.207        return isIdentifierFirstChar(c) ||
   1.208 -	('0' <= c && c <= '9');
   1.209 +        ('0' <= c && c <= '9');
   1.210      }
   1.211  
   1.212      inline char readEscape(std::istream& is) {
   1.213        char c;
   1.214        if (!is.get(c))
   1.215 -	throw DataFormatError("Escape format error");
   1.216 +        throw DataFormatError("Escape format error");
   1.217  
   1.218        switch (c) {
   1.219        case '\\':
   1.220 -	return '\\';
   1.221 +        return '\\';
   1.222        case '\"':
   1.223 -	return '\"';
   1.224 +        return '\"';
   1.225        case '\'':
   1.226 -	return '\'';
   1.227 +        return '\'';
   1.228        case '\?':
   1.229 -	return '\?';
   1.230 +        return '\?';
   1.231        case 'a':
   1.232 -	return '\a';
   1.233 +        return '\a';
   1.234        case 'b':
   1.235 -	return '\b';
   1.236 +        return '\b';
   1.237        case 'f':
   1.238 -	return '\f';
   1.239 +        return '\f';
   1.240        case 'n':
   1.241 -	return '\n';
   1.242 +        return '\n';
   1.243        case 'r':
   1.244 -	return '\r';
   1.245 +        return '\r';
   1.246        case 't':
   1.247 -	return '\t';
   1.248 +        return '\t';
   1.249        case 'v':
   1.250 -	return '\v';
   1.251 +        return '\v';
   1.252        case 'x':
   1.253 -	{
   1.254 -	  int code;
   1.255 -	  if (!is.get(c) || !isHex(c)) 
   1.256 -	    throw DataFormatError("Escape format error");
   1.257 -	  else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
   1.258 -	  else code = code * 16 + valueHex(c);
   1.259 -	  return code;
   1.260 -	}
   1.261 +        {
   1.262 +          int code;
   1.263 +          if (!is.get(c) || !isHex(c))
   1.264 +            throw DataFormatError("Escape format error");
   1.265 +          else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
   1.266 +          else code = code * 16 + valueHex(c);
   1.267 +          return code;
   1.268 +        }
   1.269        default:
   1.270 -	{
   1.271 -	  int code;
   1.272 -	  if (!isOct(c)) 
   1.273 -	    throw DataFormatError("Escape format error");
   1.274 -	  else if (code = valueOct(c), !is.get(c) || !isOct(c)) 
   1.275 -	    is.putback(c);
   1.276 -	  else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c)) 
   1.277 -	    is.putback(c);
   1.278 -	  else code = code * 8 + valueOct(c);
   1.279 -	  return code;
   1.280 -	}	      
   1.281 -      } 
   1.282 +        {
   1.283 +          int code;
   1.284 +          if (!isOct(c))
   1.285 +            throw DataFormatError("Escape format error");
   1.286 +          else if (code = valueOct(c), !is.get(c) || !isOct(c))
   1.287 +            is.putback(c);
   1.288 +          else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c))
   1.289 +            is.putback(c);
   1.290 +          else code = code * 8 + valueOct(c);
   1.291 +          return code;
   1.292 +        }
   1.293 +      }
   1.294      }
   1.295 -    
   1.296 +
   1.297      inline std::istream& readToken(std::istream& is, std::string& str) {
   1.298        std::ostringstream os;
   1.299  
   1.300        char c;
   1.301        is >> std::ws;
   1.302 -      
   1.303 -      if (!is.get(c)) 
   1.304 -	return is;
   1.305 +
   1.306 +      if (!is.get(c))
   1.307 +        return is;
   1.308  
   1.309        if (c == '\"') {
   1.310 -	while (is.get(c) && c != '\"') {
   1.311 -	  if (c == '\\') 
   1.312 -	    c = readEscape(is);
   1.313 -	  os << c;
   1.314 -	}
   1.315 -	if (!is) 
   1.316 -	  throw DataFormatError("Quoted format error");
   1.317 +        while (is.get(c) && c != '\"') {
   1.318 +          if (c == '\\')
   1.319 +            c = readEscape(is);
   1.320 +          os << c;
   1.321 +        }
   1.322 +        if (!is)
   1.323 +          throw DataFormatError("Quoted format error");
   1.324        } else {
   1.325 -	is.putback(c);
   1.326 -	while (is.get(c) && !isWhiteSpace(c)) {
   1.327 -	  if (c == '\\') 
   1.328 -	    c = readEscape(is);
   1.329 -	  os << c;
   1.330 -	}
   1.331 -	if (!is) {
   1.332 -	  is.clear();
   1.333 -	} else {
   1.334 -	  is.putback(c);
   1.335 -	}
   1.336 +        is.putback(c);
   1.337 +        while (is.get(c) && !isWhiteSpace(c)) {
   1.338 +          if (c == '\\')
   1.339 +            c = readEscape(is);
   1.340 +          os << c;
   1.341 +        }
   1.342 +        if (!is) {
   1.343 +          is.clear();
   1.344 +        } else {
   1.345 +          is.putback(c);
   1.346 +        }
   1.347        }
   1.348        str = os.str();
   1.349        return is;
   1.350 @@ -331,28 +331,28 @@
   1.351        Functor _functor;
   1.352  
   1.353      public:
   1.354 -      
   1.355 +
   1.356        LineSection(const Functor& functor) : _functor(functor) {}
   1.357        virtual ~LineSection() {}
   1.358  
   1.359        virtual void process(std::istream& is, int& line_num) {
   1.360 -	char c;
   1.361 -	std::string line;
   1.362 -	while (is.get(c) && c != '@') {
   1.363 -	  if (c == '\n') {
   1.364 -	    ++line_num;
   1.365 -	  } else if (c == '#') {
   1.366 -	    getline(is, line);
   1.367 -	    ++line_num;
   1.368 -	  } else if (!isWhiteSpace(c)) {
   1.369 -	    is.putback(c);
   1.370 -	    getline(is, line);
   1.371 -	    _functor(line);
   1.372 -	    ++line_num;
   1.373 -	  }
   1.374 -	}
   1.375 -	if (is) is.putback(c);
   1.376 -	else if (is.eof()) is.clear();
   1.377 +        char c;
   1.378 +        std::string line;
   1.379 +        while (is.get(c) && c != '@') {
   1.380 +          if (c == '\n') {
   1.381 +            ++line_num;
   1.382 +          } else if (c == '#') {
   1.383 +            getline(is, line);
   1.384 +            ++line_num;
   1.385 +          } else if (!isWhiteSpace(c)) {
   1.386 +            is.putback(c);
   1.387 +            getline(is, line);
   1.388 +            _functor(line);
   1.389 +            ++line_num;
   1.390 +          }
   1.391 +        }
   1.392 +        if (is) is.putback(c);
   1.393 +        else if (is.eof()) is.clear();
   1.394        }
   1.395      };
   1.396  
   1.397 @@ -363,27 +363,27 @@
   1.398        Functor _functor;
   1.399  
   1.400      public:
   1.401 -      
   1.402 +
   1.403        StreamSection(const Functor& functor) : _functor(functor) {}
   1.404 -      virtual ~StreamSection() {} 
   1.405 +      virtual ~StreamSection() {}
   1.406  
   1.407        virtual void process(std::istream& is, int& line_num) {
   1.408 -	_functor(is, line_num);
   1.409 -	char c;
   1.410 -	std::string line;
   1.411 -	while (is.get(c) && c != '@') {
   1.412 -	  if (c == '\n') {
   1.413 -	    ++line_num;
   1.414 -	  } else if (!isWhiteSpace(c)) {
   1.415 -	    getline(is, line);
   1.416 -	    ++line_num;
   1.417 -	  }
   1.418 -	}
   1.419 -	if (is) is.putback(c);
   1.420 -	else if (is.eof()) is.clear();	
   1.421 +        _functor(is, line_num);
   1.422 +        char c;
   1.423 +        std::string line;
   1.424 +        while (is.get(c) && c != '@') {
   1.425 +          if (c == '\n') {
   1.426 +            ++line_num;
   1.427 +          } else if (!isWhiteSpace(c)) {
   1.428 +            getline(is, line);
   1.429 +            ++line_num;
   1.430 +          }
   1.431 +        }
   1.432 +        if (is) is.putback(c);
   1.433 +        else if (is.eof()) is.clear();
   1.434        }
   1.435      };
   1.436 -    
   1.437 +
   1.438    }
   1.439  
   1.440    template <typename Digraph>
   1.441 @@ -399,7 +399,7 @@
   1.442    DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph);
   1.443  
   1.444    /// \ingroup lemon_io
   1.445 -  ///  
   1.446 +  ///
   1.447    /// \brief \ref lgf-format "LGF" reader for directed graphs
   1.448    ///
   1.449    /// This utility reads an \ref lgf-format "LGF" file.
   1.450 @@ -453,7 +453,7 @@
   1.451  
   1.452      typedef _Digraph Digraph;
   1.453      TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   1.454 -    
   1.455 +
   1.456    private:
   1.457  
   1.458  
   1.459 @@ -470,16 +470,16 @@
   1.460      NodeIndex _node_index;
   1.461      typedef std::map<std::string, Arc> ArcIndex;
   1.462      ArcIndex _arc_index;
   1.463 -    
   1.464 -    typedef std::vector<std::pair<std::string, 
   1.465 -      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
   1.466 -    NodeMaps _node_maps; 
   1.467 +
   1.468 +    typedef std::vector<std::pair<std::string,
   1.469 +      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
   1.470 +    NodeMaps _node_maps;
   1.471  
   1.472      typedef std::vector<std::pair<std::string,
   1.473        _reader_bits::MapStorageBase<Arc>*> >ArcMaps;
   1.474      ArcMaps _arc_maps;
   1.475  
   1.476 -    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
   1.477 +    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
   1.478        Attributes;
   1.479      Attributes _attributes;
   1.480  
   1.481 @@ -498,69 +498,69 @@
   1.482      ///
   1.483      /// Construct a directed graph reader, which reads from the given
   1.484      /// input stream.
   1.485 -    DigraphReader(std::istream& is, Digraph& digraph) 
   1.486 +    DigraphReader(std::istream& is, Digraph& digraph)
   1.487        : _is(&is), local_is(false), _digraph(digraph),
   1.488 -	_use_nodes(false), _use_arcs(false),
   1.489 -	_skip_nodes(false), _skip_arcs(false) {}
   1.490 +        _use_nodes(false), _use_arcs(false),
   1.491 +        _skip_nodes(false), _skip_arcs(false) {}
   1.492  
   1.493      /// \brief Constructor
   1.494      ///
   1.495      /// Construct a directed graph reader, which reads from the given
   1.496      /// file.
   1.497 -    DigraphReader(const std::string& fn, Digraph& digraph) 
   1.498 +    DigraphReader(const std::string& fn, Digraph& digraph)
   1.499        : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
   1.500 -    	_use_nodes(false), _use_arcs(false),
   1.501 -	_skip_nodes(false), _skip_arcs(false) {}
   1.502 -    
   1.503 +            _use_nodes(false), _use_arcs(false),
   1.504 +        _skip_nodes(false), _skip_arcs(false) {}
   1.505 +
   1.506      /// \brief Constructor
   1.507      ///
   1.508      /// Construct a directed graph reader, which reads from the given
   1.509      /// file.
   1.510 -    DigraphReader(const char* fn, Digraph& digraph) 
   1.511 +    DigraphReader(const char* fn, Digraph& digraph)
   1.512        : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
   1.513 -    	_use_nodes(false), _use_arcs(false),
   1.514 -	_skip_nodes(false), _skip_arcs(false) {}
   1.515 +            _use_nodes(false), _use_arcs(false),
   1.516 +        _skip_nodes(false), _skip_arcs(false) {}
   1.517  
   1.518      /// \brief Destructor
   1.519      ~DigraphReader() {
   1.520 -      for (typename NodeMaps::iterator it = _node_maps.begin(); 
   1.521 -	   it != _node_maps.end(); ++it) {
   1.522 -	delete it->second;
   1.523 +      for (typename NodeMaps::iterator it = _node_maps.begin();
   1.524 +           it != _node_maps.end(); ++it) {
   1.525 +        delete it->second;
   1.526        }
   1.527  
   1.528 -      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
   1.529 -	   it != _arc_maps.end(); ++it) {
   1.530 -	delete it->second;
   1.531 +      for (typename ArcMaps::iterator it = _arc_maps.begin();
   1.532 +           it != _arc_maps.end(); ++it) {
   1.533 +        delete it->second;
   1.534        }
   1.535  
   1.536 -      for (typename Attributes::iterator it = _attributes.begin(); 
   1.537 -	   it != _attributes.end(); ++it) {
   1.538 -	delete it->second;
   1.539 +      for (typename Attributes::iterator it = _attributes.begin();
   1.540 +           it != _attributes.end(); ++it) {
   1.541 +        delete it->second;
   1.542        }
   1.543  
   1.544        if (local_is) {
   1.545 -	delete _is;
   1.546 +        delete _is;
   1.547        }
   1.548  
   1.549      }
   1.550  
   1.551    private:
   1.552  
   1.553 -    friend DigraphReader<Digraph> digraphReader<>(std::istream& is, 
   1.554 -						  Digraph& digraph);    
   1.555 -    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn, 
   1.556 -						  Digraph& digraph);   
   1.557 -    friend DigraphReader<Digraph> digraphReader<>(const char *fn, 
   1.558 -						  Digraph& digraph);    
   1.559 -
   1.560 -    DigraphReader(DigraphReader& other) 
   1.561 +    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
   1.562 +                                                  Digraph& digraph);
   1.563 +    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
   1.564 +                                                  Digraph& digraph);
   1.565 +    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
   1.566 +                                                  Digraph& digraph);
   1.567 +
   1.568 +    DigraphReader(DigraphReader& other)
   1.569        : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
   1.570 -	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
   1.571 -	_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
   1.572 +        _use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
   1.573 +        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
   1.574  
   1.575        other._is = 0;
   1.576        other.local_is = false;
   1.577 -      
   1.578 +
   1.579        _node_index.swap(other._node_index);
   1.580        _arc_index.swap(other._arc_index);
   1.581  
   1.582 @@ -580,15 +580,15 @@
   1.583  
   1.584      /// \name Reading rules
   1.585      /// @{
   1.586 -    
   1.587 +
   1.588      /// \brief Node map reading rule
   1.589      ///
   1.590      /// Add a node map reading rule to the reader.
   1.591      template <typename Map>
   1.592      DigraphReader& nodeMap(const std::string& caption, Map& map) {
   1.593        checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
   1.594 -      _reader_bits::MapStorageBase<Node>* storage = 
   1.595 -	new _reader_bits::MapStorage<Node, Map>(map);
   1.596 +      _reader_bits::MapStorageBase<Node>* storage =
   1.597 +        new _reader_bits::MapStorage<Node, Map>(map);
   1.598        _node_maps.push_back(std::make_pair(caption, storage));
   1.599        return *this;
   1.600      }
   1.601 @@ -598,11 +598,11 @@
   1.602      /// Add a node map reading rule with specialized converter to the
   1.603      /// reader.
   1.604      template <typename Map, typename Converter>
   1.605 -    DigraphReader& nodeMap(const std::string& caption, Map& map, 
   1.606 -			   const Converter& converter = Converter()) {
   1.607 +    DigraphReader& nodeMap(const std::string& caption, Map& map,
   1.608 +                           const Converter& converter = Converter()) {
   1.609        checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
   1.610 -      _reader_bits::MapStorageBase<Node>* storage = 
   1.611 -	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
   1.612 +      _reader_bits::MapStorageBase<Node>* storage =
   1.613 +        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
   1.614        _node_maps.push_back(std::make_pair(caption, storage));
   1.615        return *this;
   1.616      }
   1.617 @@ -613,8 +613,8 @@
   1.618      template <typename Map>
   1.619      DigraphReader& arcMap(const std::string& caption, Map& map) {
   1.620        checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
   1.621 -      _reader_bits::MapStorageBase<Arc>* storage = 
   1.622 -	new _reader_bits::MapStorage<Arc, Map>(map);
   1.623 +      _reader_bits::MapStorageBase<Arc>* storage =
   1.624 +        new _reader_bits::MapStorage<Arc, Map>(map);
   1.625        _arc_maps.push_back(std::make_pair(caption, storage));
   1.626        return *this;
   1.627      }
   1.628 @@ -624,11 +624,11 @@
   1.629      /// Add an arc map reading rule with specialized converter to the
   1.630      /// reader.
   1.631      template <typename Map, typename Converter>
   1.632 -    DigraphReader& arcMap(const std::string& caption, Map& map, 
   1.633 -			  const Converter& converter = Converter()) {
   1.634 +    DigraphReader& arcMap(const std::string& caption, Map& map,
   1.635 +                          const Converter& converter = Converter()) {
   1.636        checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
   1.637 -      _reader_bits::MapStorageBase<Arc>* storage = 
   1.638 -	new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
   1.639 +      _reader_bits::MapStorageBase<Arc>* storage =
   1.640 +        new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
   1.641        _arc_maps.push_back(std::make_pair(caption, storage));
   1.642        return *this;
   1.643      }
   1.644 @@ -638,8 +638,8 @@
   1.645      /// Add an attribute reading rule to the reader.
   1.646      template <typename Value>
   1.647      DigraphReader& attribute(const std::string& caption, Value& value) {
   1.648 -      _reader_bits::ValueStorageBase* storage = 
   1.649 -	new _reader_bits::ValueStorage<Value>(value);
   1.650 +      _reader_bits::ValueStorageBase* storage =
   1.651 +        new _reader_bits::ValueStorage<Value>(value);
   1.652        _attributes.insert(std::make_pair(caption, storage));
   1.653        return *this;
   1.654      }
   1.655 @@ -649,10 +649,10 @@
   1.656      /// Add an attribute reading rule with specialized converter to the
   1.657      /// reader.
   1.658      template <typename Value, typename Converter>
   1.659 -    DigraphReader& attribute(const std::string& caption, Value& value, 
   1.660 -			     const Converter& converter = Converter()) {
   1.661 -      _reader_bits::ValueStorageBase* storage = 
   1.662 -	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
   1.663 +    DigraphReader& attribute(const std::string& caption, Value& value,
   1.664 +                             const Converter& converter = Converter()) {
   1.665 +      _reader_bits::ValueStorageBase* storage =
   1.666 +        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
   1.667        _attributes.insert(std::make_pair(caption, storage));
   1.668        return *this;
   1.669      }
   1.670 @@ -663,8 +663,8 @@
   1.671      DigraphReader& node(const std::string& caption, Node& node) {
   1.672        typedef _reader_bits::MapLookUpConverter<Node> Converter;
   1.673        Converter converter(_node_index);
   1.674 -      _reader_bits::ValueStorageBase* storage = 
   1.675 -	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
   1.676 +      _reader_bits::ValueStorageBase* storage =
   1.677 +        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
   1.678        _attributes.insert(std::make_pair(caption, storage));
   1.679        return *this;
   1.680      }
   1.681 @@ -675,8 +675,8 @@
   1.682      DigraphReader& arc(const std::string& caption, Arc& arc) {
   1.683        typedef _reader_bits::MapLookUpConverter<Arc> Converter;
   1.684        Converter converter(_arc_index);
   1.685 -      _reader_bits::ValueStorageBase* storage = 
   1.686 -	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
   1.687 +      _reader_bits::ValueStorageBase* storage =
   1.688 +        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
   1.689        _attributes.insert(std::make_pair(caption, storage));
   1.690        return *this;
   1.691      }
   1.692 @@ -722,11 +722,11 @@
   1.693      template <typename Map>
   1.694      DigraphReader& useNodes(const Map& map) {
   1.695        checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
   1.696 -      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
   1.697 +      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
   1.698        _use_nodes = true;
   1.699        _writer_bits::DefaultConverter<typename Map::Value> converter;
   1.700        for (NodeIt n(_digraph); n != INVALID; ++n) {
   1.701 -	_node_index.insert(std::make_pair(converter(map[n]), n));
   1.702 +        _node_index.insert(std::make_pair(converter(map[n]), n));
   1.703        }
   1.704        return *this;
   1.705      }
   1.706 @@ -737,13 +737,13 @@
   1.707      /// label map and a functor which converts the label map values to
   1.708      /// \c std::string.
   1.709      template <typename Map, typename Converter>
   1.710 -    DigraphReader& useNodes(const Map& map, 
   1.711 -			    const Converter& converter = Converter()) {
   1.712 +    DigraphReader& useNodes(const Map& map,
   1.713 +                            const Converter& converter = Converter()) {
   1.714        checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
   1.715 -      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
   1.716 +      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
   1.717        _use_nodes = true;
   1.718        for (NodeIt n(_digraph); n != INVALID; ++n) {
   1.719 -	_node_index.insert(std::make_pair(converter(map[n]), n));
   1.720 +        _node_index.insert(std::make_pair(converter(map[n]), n));
   1.721        }
   1.722        return *this;
   1.723      }
   1.724 @@ -759,7 +759,7 @@
   1.725        _use_arcs = true;
   1.726        _writer_bits::DefaultConverter<typename Map::Value> converter;
   1.727        for (ArcIt a(_digraph); a != INVALID; ++a) {
   1.728 -	_arc_index.insert(std::make_pair(converter(map[a]), a));
   1.729 +        _arc_index.insert(std::make_pair(converter(map[a]), a));
   1.730        }
   1.731        return *this;
   1.732      }
   1.733 @@ -770,13 +770,13 @@
   1.734      /// label map and a functor which converts the label map values to
   1.735      /// \c std::string.
   1.736      template <typename Map, typename Converter>
   1.737 -    DigraphReader& useArcs(const Map& map, 
   1.738 -			   const Converter& converter = Converter()) {
   1.739 +    DigraphReader& useArcs(const Map& map,
   1.740 +                           const Converter& converter = Converter()) {
   1.741        checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
   1.742 -      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member"); 
   1.743 +      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member");
   1.744        _use_arcs = true;
   1.745        for (ArcIt a(_digraph); a != INVALID; ++a) {
   1.746 -	_arc_index.insert(std::make_pair(converter(map[a]), a));
   1.747 +        _arc_index.insert(std::make_pair(converter(map[a]), a));
   1.748        }
   1.749        return *this;
   1.750      }
   1.751 @@ -790,7 +790,7 @@
   1.752      /// Therefore \c skipArcs() function should also be used, or
   1.753      /// \c useNodes() should be used to specify the label of the nodes.
   1.754      DigraphReader& skipNodes() {
   1.755 -      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
   1.756 +      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
   1.757        _skip_nodes = true;
   1.758        return *this;
   1.759      }
   1.760 @@ -801,7 +801,7 @@
   1.761      /// map reading rule will be abandoned, and the arcs of the graph
   1.762      /// will not be constructed.
   1.763      DigraphReader& skipArcs() {
   1.764 -      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set"); 
   1.765 +      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set");
   1.766        _skip_arcs = true;
   1.767        return *this;
   1.768      }
   1.769 @@ -813,12 +813,12 @@
   1.770      bool readLine() {
   1.771        std::string str;
   1.772        while(++line_num, std::getline(*_is, str)) {
   1.773 -	line.clear(); line.str(str);
   1.774 -	char c;
   1.775 -	if (line >> std::ws >> c && c != '#') {
   1.776 -	  line.putback(c);
   1.777 -	  return true;
   1.778 -	}
   1.779 +        line.clear(); line.str(str);
   1.780 +        char c;
   1.781 +        if (line >> std::ws >> c && c != '#') {
   1.782 +          line.putback(c);
   1.783 +          return true;
   1.784 +        }
   1.785        }
   1.786        return false;
   1.787      }
   1.788 @@ -826,11 +826,11 @@
   1.789      bool readSuccess() {
   1.790        return static_cast<bool>(*_is);
   1.791      }
   1.792 -    
   1.793 +
   1.794      void skipSection() {
   1.795        char c;
   1.796        while (readSuccess() && line >> c && c != '@') {
   1.797 -	readLine();
   1.798 +        readLine();
   1.799        }
   1.800        line.putback(c);
   1.801      }
   1.802 @@ -842,89 +842,89 @@
   1.803  
   1.804        char c;
   1.805        if (!readLine() || !(line >> c) || c == '@') {
   1.806 -	if (readSuccess() && line) line.putback(c);
   1.807 -	if (!_node_maps.empty()) 
   1.808 -	  throw DataFormatError("Cannot find map names");
   1.809 -	return;
   1.810 +        if (readSuccess() && line) line.putback(c);
   1.811 +        if (!_node_maps.empty())
   1.812 +          throw DataFormatError("Cannot find map names");
   1.813 +        return;
   1.814        }
   1.815        line.putback(c);
   1.816  
   1.817        {
   1.818 -	std::map<std::string, int> maps;
   1.819 -	
   1.820 -	std::string map;
   1.821 -	int index = 0;
   1.822 -	while (_reader_bits::readToken(line, map)) {
   1.823 -	  if (maps.find(map) != maps.end()) {
   1.824 -	    std::ostringstream msg;
   1.825 -	    msg << "Multiple occurence of node map: " << map;
   1.826 -	    throw DataFormatError(msg.str().c_str());
   1.827 -	  }
   1.828 -	  maps.insert(std::make_pair(map, index));
   1.829 -	  ++index;
   1.830 -	}
   1.831 -	
   1.832 -	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
   1.833 -	  std::map<std::string, int>::iterator jt = 
   1.834 -	    maps.find(_node_maps[i].first);
   1.835 -	  if (jt == maps.end()) {
   1.836 -	    std::ostringstream msg;
   1.837 -	    msg << "Map not found in file: " << _node_maps[i].first;
   1.838 -	    throw DataFormatError(msg.str().c_str());
   1.839 -	  }
   1.840 -	  map_index[i] = jt->second;
   1.841 -	}
   1.842 -
   1.843 -	{
   1.844 -	  std::map<std::string, int>::iterator jt = maps.find("label");
   1.845 -	  if (jt != maps.end()) {
   1.846 -	    label_index = jt->second;
   1.847 -	  } else {
   1.848 -	    label_index = -1;
   1.849 -	  }
   1.850 -	}
   1.851 -	map_num = maps.size();
   1.852 +        std::map<std::string, int> maps;
   1.853 +
   1.854 +        std::string map;
   1.855 +        int index = 0;
   1.856 +        while (_reader_bits::readToken(line, map)) {
   1.857 +          if (maps.find(map) != maps.end()) {
   1.858 +            std::ostringstream msg;
   1.859 +            msg << "Multiple occurence of node map: " << map;
   1.860 +            throw DataFormatError(msg.str().c_str());
   1.861 +          }
   1.862 +          maps.insert(std::make_pair(map, index));
   1.863 +          ++index;
   1.864 +        }
   1.865 +
   1.866 +        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
   1.867 +          std::map<std::string, int>::iterator jt =
   1.868 +            maps.find(_node_maps[i].first);
   1.869 +          if (jt == maps.end()) {
   1.870 +            std::ostringstream msg;
   1.871 +            msg << "Map not found in file: " << _node_maps[i].first;
   1.872 +            throw DataFormatError(msg.str().c_str());
   1.873 +          }
   1.874 +          map_index[i] = jt->second;
   1.875 +        }
   1.876 +
   1.877 +        {
   1.878 +          std::map<std::string, int>::iterator jt = maps.find("label");
   1.879 +          if (jt != maps.end()) {
   1.880 +            label_index = jt->second;
   1.881 +          } else {
   1.882 +            label_index = -1;
   1.883 +          }
   1.884 +        }
   1.885 +        map_num = maps.size();
   1.886        }
   1.887  
   1.888        while (readLine() && line >> c && c != '@') {
   1.889 -	line.putback(c);
   1.890 -
   1.891 -	std::vector<std::string> tokens(map_num);
   1.892 -	for (int i = 0; i < map_num; ++i) {
   1.893 -	  if (!_reader_bits::readToken(line, tokens[i])) {
   1.894 -	    std::ostringstream msg;
   1.895 -	    msg << "Column not found (" << i + 1 << ")";
   1.896 -	    throw DataFormatError(msg.str().c_str());
   1.897 -	  }
   1.898 -	}
   1.899 -	if (line >> std::ws >> c)
   1.900 -	  throw DataFormatError("Extra character on the end of line");
   1.901 -	
   1.902 -	Node n;
   1.903 -	if (!_use_nodes) {
   1.904 -	  n = _digraph.addNode();
   1.905 -	  if (label_index != -1)
   1.906 -	    _node_index.insert(std::make_pair(tokens[label_index], n));
   1.907 -	} else {
   1.908 -	  if (label_index == -1) 
   1.909 -	    throw DataFormatError("Label map not found in file");
   1.910 -	  typename std::map<std::string, Node>::iterator it =
   1.911 -	    _node_index.find(tokens[label_index]);
   1.912 -	  if (it == _node_index.end()) {
   1.913 -	    std::ostringstream msg;
   1.914 -	    msg << "Node with label not found: " << tokens[label_index];
   1.915 -	    throw DataFormatError(msg.str().c_str());	    
   1.916 -	  }
   1.917 -	  n = it->second;
   1.918 -	}
   1.919 -
   1.920 -	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
   1.921 -	  _node_maps[i].second->set(n, tokens[map_index[i]]);
   1.922 -	}
   1.923 +        line.putback(c);
   1.924 +
   1.925 +        std::vector<std::string> tokens(map_num);
   1.926 +        for (int i = 0; i < map_num; ++i) {
   1.927 +          if (!_reader_bits::readToken(line, tokens[i])) {
   1.928 +            std::ostringstream msg;
   1.929 +            msg << "Column not found (" << i + 1 << ")";
   1.930 +            throw DataFormatError(msg.str().c_str());
   1.931 +          }
   1.932 +        }
   1.933 +        if (line >> std::ws >> c)
   1.934 +          throw DataFormatError("Extra character on the end of line");
   1.935 +
   1.936 +        Node n;
   1.937 +        if (!_use_nodes) {
   1.938 +          n = _digraph.addNode();
   1.939 +          if (label_index != -1)
   1.940 +            _node_index.insert(std::make_pair(tokens[label_index], n));
   1.941 +        } else {
   1.942 +          if (label_index == -1)
   1.943 +            throw DataFormatError("Label map not found in file");
   1.944 +          typename std::map<std::string, Node>::iterator it =
   1.945 +            _node_index.find(tokens[label_index]);
   1.946 +          if (it == _node_index.end()) {
   1.947 +            std::ostringstream msg;
   1.948 +            msg << "Node with label not found: " << tokens[label_index];
   1.949 +            throw DataFormatError(msg.str().c_str());
   1.950 +          }
   1.951 +          n = it->second;
   1.952 +        }
   1.953 +
   1.954 +        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
   1.955 +          _node_maps[i].second->set(n, tokens[map_index[i]]);
   1.956 +        }
   1.957  
   1.958        }
   1.959        if (readSuccess()) {
   1.960 -	line.putback(c);
   1.961 +        line.putback(c);
   1.962        }
   1.963      }
   1.964  
   1.965 @@ -935,78 +935,78 @@
   1.966  
   1.967        char c;
   1.968        if (!readLine() || !(line >> c) || c == '@') {
   1.969 -	if (readSuccess() && line) line.putback(c);
   1.970 -	if (!_arc_maps.empty()) 
   1.971 -	  throw DataFormatError("Cannot find map names");
   1.972 -	return;
   1.973 +        if (readSuccess() && line) line.putback(c);
   1.974 +        if (!_arc_maps.empty())
   1.975 +          throw DataFormatError("Cannot find map names");
   1.976 +        return;
   1.977        }
   1.978        line.putback(c);
   1.979 -      
   1.980 +
   1.981        {
   1.982 -	std::map<std::string, int> maps;
   1.983 -	
   1.984 -	std::string map;
   1.985 -	int index = 0;
   1.986 -	while (_reader_bits::readToken(line, map)) {
   1.987 -	  if (maps.find(map) != maps.end()) {
   1.988 -	    std::ostringstream msg;
   1.989 -	    msg << "Multiple occurence of arc map: " << map;
   1.990 -	    throw DataFormatError(msg.str().c_str());
   1.991 -	  }
   1.992 -	  maps.insert(std::make_pair(map, index));
   1.993 -	  ++index;
   1.994 -	}
   1.995 -	
   1.996 -	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
   1.997 -	  std::map<std::string, int>::iterator jt = 
   1.998 -	    maps.find(_arc_maps[i].first);
   1.999 -	  if (jt == maps.end()) {
  1.1000 -	    std::ostringstream msg;
  1.1001 -	    msg << "Map not found in file: " << _arc_maps[i].first;
  1.1002 -	    throw DataFormatError(msg.str().c_str());
  1.1003 -	  }
  1.1004 -	  map_index[i] = jt->second;
  1.1005 -	}
  1.1006 -
  1.1007 -	{
  1.1008 -	  std::map<std::string, int>::iterator jt = maps.find("label");
  1.1009 -	  if (jt != maps.end()) {
  1.1010 -	    label_index = jt->second;
  1.1011 -	  } else {
  1.1012 -	    label_index = -1;
  1.1013 -	  }
  1.1014 -	}
  1.1015 -	map_num = maps.size();
  1.1016 +        std::map<std::string, int> maps;
  1.1017 +
  1.1018 +        std::string map;
  1.1019 +        int index = 0;
  1.1020 +        while (_reader_bits::readToken(line, map)) {
  1.1021 +          if (maps.find(map) != maps.end()) {
  1.1022 +            std::ostringstream msg;
  1.1023 +            msg << "Multiple occurence of arc map: " << map;
  1.1024 +            throw DataFormatError(msg.str().c_str());
  1.1025 +          }
  1.1026 +          maps.insert(std::make_pair(map, index));
  1.1027 +          ++index;
  1.1028 +        }
  1.1029 +
  1.1030 +        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
  1.1031 +          std::map<std::string, int>::iterator jt =
  1.1032 +            maps.find(_arc_maps[i].first);
  1.1033 +          if (jt == maps.end()) {
  1.1034 +            std::ostringstream msg;
  1.1035 +            msg << "Map not found in file: " << _arc_maps[i].first;
  1.1036 +            throw DataFormatError(msg.str().c_str());
  1.1037 +          }
  1.1038 +          map_index[i] = jt->second;
  1.1039 +        }
  1.1040 +
  1.1041 +        {
  1.1042 +          std::map<std::string, int>::iterator jt = maps.find("label");
  1.1043 +          if (jt != maps.end()) {
  1.1044 +            label_index = jt->second;
  1.1045 +          } else {
  1.1046 +            label_index = -1;
  1.1047 +          }
  1.1048 +        }
  1.1049 +        map_num = maps.size();
  1.1050        }
  1.1051  
  1.1052        while (readLine() && line >> c && c != '@') {
  1.1053 -	line.putback(c);
  1.1054 -
  1.1055 -	std::string source_token;
  1.1056 -	std::string target_token;
  1.1057 -
  1.1058 -	if (!_reader_bits::readToken(line, source_token))
  1.1059 -	  throw DataFormatError("Source not found");
  1.1060 -
  1.1061 -	if (!_reader_bits::readToken(line, target_token))
  1.1062 -	  throw DataFormatError("Target not found");
  1.1063 -	
  1.1064 -	std::vector<std::string> tokens(map_num);
  1.1065 -	for (int i = 0; i < map_num; ++i) {
  1.1066 -	  if (!_reader_bits::readToken(line, tokens[i])) {
  1.1067 -	    std::ostringstream msg;
  1.1068 -	    msg << "Column not found (" << i + 1 << ")";
  1.1069 -	    throw DataFormatError(msg.str().c_str());
  1.1070 -	  }
  1.1071 -	}
  1.1072 -	if (line >> std::ws >> c)
  1.1073 -	  throw DataFormatError("Extra character on the end of line");
  1.1074 -	
  1.1075 -	Arc a;
  1.1076 -	if (!_use_arcs) {
  1.1077 +        line.putback(c);
  1.1078 +
  1.1079 +        std::string source_token;
  1.1080 +        std::string target_token;
  1.1081 +
  1.1082 +        if (!_reader_bits::readToken(line, source_token))
  1.1083 +          throw DataFormatError("Source not found");
  1.1084 +
  1.1085 +        if (!_reader_bits::readToken(line, target_token))
  1.1086 +          throw DataFormatError("Target not found");
  1.1087 +
  1.1088 +        std::vector<std::string> tokens(map_num);
  1.1089 +        for (int i = 0; i < map_num; ++i) {
  1.1090 +          if (!_reader_bits::readToken(line, tokens[i])) {
  1.1091 +            std::ostringstream msg;
  1.1092 +            msg << "Column not found (" << i + 1 << ")";
  1.1093 +            throw DataFormatError(msg.str().c_str());
  1.1094 +          }
  1.1095 +        }
  1.1096 +        if (line >> std::ws >> c)
  1.1097 +          throw DataFormatError("Extra character on the end of line");
  1.1098 +
  1.1099 +        Arc a;
  1.1100 +        if (!_use_arcs) {
  1.1101  
  1.1102            typename NodeIndex::iterator it;
  1.1103 - 
  1.1104 +
  1.1105            it = _node_index.find(source_token);
  1.1106            if (it == _node_index.end()) {
  1.1107              std::ostringstream msg;
  1.1108 @@ -1016,36 +1016,36 @@
  1.1109            Node source = it->second;
  1.1110  
  1.1111            it = _node_index.find(target_token);
  1.1112 -          if (it == _node_index.end()) {       
  1.1113 -            std::ostringstream msg;            
  1.1114 +          if (it == _node_index.end()) {
  1.1115 +            std::ostringstream msg;
  1.1116              msg << "Item not found: " << target_token;
  1.1117              throw DataFormatError(msg.str().c_str());
  1.1118 -          }                                          
  1.1119 -          Node target = it->second;                            
  1.1120 -
  1.1121 -	  a = _digraph.addArc(source, target);
  1.1122 -	  if (label_index != -1) 
  1.1123 -	    _arc_index.insert(std::make_pair(tokens[label_index], a));
  1.1124 -	} else {
  1.1125 -	  if (label_index == -1) 
  1.1126 -	    throw DataFormatError("Label map not found in file");
  1.1127 -	  typename std::map<std::string, Arc>::iterator it =
  1.1128 -	    _arc_index.find(tokens[label_index]);
  1.1129 -	  if (it == _arc_index.end()) {
  1.1130 -	    std::ostringstream msg;
  1.1131 -	    msg << "Arc with label not found: " << tokens[label_index];
  1.1132 -	    throw DataFormatError(msg.str().c_str());	    
  1.1133 -	  }
  1.1134 -	  a = it->second;
  1.1135 -	}
  1.1136 -
  1.1137 -	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
  1.1138 -	  _arc_maps[i].second->set(a, tokens[map_index[i]]);
  1.1139 -	}
  1.1140 +          }
  1.1141 +          Node target = it->second;
  1.1142 +
  1.1143 +          a = _digraph.addArc(source, target);
  1.1144 +          if (label_index != -1)
  1.1145 +            _arc_index.insert(std::make_pair(tokens[label_index], a));
  1.1146 +        } else {
  1.1147 +          if (label_index == -1)
  1.1148 +            throw DataFormatError("Label map not found in file");
  1.1149 +          typename std::map<std::string, Arc>::iterator it =
  1.1150 +            _arc_index.find(tokens[label_index]);
  1.1151 +          if (it == _arc_index.end()) {
  1.1152 +            std::ostringstream msg;
  1.1153 +            msg << "Arc with label not found: " << tokens[label_index];
  1.1154 +            throw DataFormatError(msg.str().c_str());
  1.1155 +          }
  1.1156 +          a = it->second;
  1.1157 +        }
  1.1158 +
  1.1159 +        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
  1.1160 +          _arc_maps[i].second->set(a, tokens[map_index[i]]);
  1.1161 +        }
  1.1162  
  1.1163        }
  1.1164        if (readSuccess()) {
  1.1165 -	line.putback(c);
  1.1166 +        line.putback(c);
  1.1167        }
  1.1168      }
  1.1169  
  1.1170 @@ -1055,51 +1055,51 @@
  1.1171  
  1.1172        char c;
  1.1173        while (readLine() && line >> c && c != '@') {
  1.1174 -	line.putback(c);
  1.1175 -	
  1.1176 -	std::string attr, token;
  1.1177 -	if (!_reader_bits::readToken(line, attr))
  1.1178 -	  throw DataFormatError("Attribute name not found");
  1.1179 -	if (!_reader_bits::readToken(line, token))
  1.1180 -	  throw DataFormatError("Attribute value not found");
  1.1181 -	if (line >> c)
  1.1182 -	  throw DataFormatError("Extra character on the end of line");	  
  1.1183 -
  1.1184 -	{
  1.1185 -	  std::set<std::string>::iterator it = read_attr.find(attr);
  1.1186 -	  if (it != read_attr.end()) {
  1.1187 -	    std::ostringstream msg;
  1.1188 -	    msg << "Multiple occurence of attribute " << attr;
  1.1189 -	    throw DataFormatError(msg.str().c_str());
  1.1190 -	  }
  1.1191 -	  read_attr.insert(attr);
  1.1192 -	}
  1.1193 -	
  1.1194 -	{
  1.1195 -	  typename Attributes::iterator it = _attributes.lower_bound(attr);
  1.1196 -	  while (it != _attributes.end() && it->first == attr) {
  1.1197 -	    it->second->set(token);
  1.1198 -	    ++it;
  1.1199 -	  }
  1.1200 -	}
  1.1201 +        line.putback(c);
  1.1202 +
  1.1203 +        std::string attr, token;
  1.1204 +        if (!_reader_bits::readToken(line, attr))
  1.1205 +          throw DataFormatError("Attribute name not found");
  1.1206 +        if (!_reader_bits::readToken(line, token))
  1.1207 +          throw DataFormatError("Attribute value not found");
  1.1208 +        if (line >> c)
  1.1209 +          throw DataFormatError("Extra character on the end of line");
  1.1210 +
  1.1211 +        {
  1.1212 +          std::set<std::string>::iterator it = read_attr.find(attr);
  1.1213 +          if (it != read_attr.end()) {
  1.1214 +            std::ostringstream msg;
  1.1215 +            msg << "Multiple occurence of attribute " << attr;
  1.1216 +            throw DataFormatError(msg.str().c_str());
  1.1217 +          }
  1.1218 +          read_attr.insert(attr);
  1.1219 +        }
  1.1220 +
  1.1221 +        {
  1.1222 +          typename Attributes::iterator it = _attributes.lower_bound(attr);
  1.1223 +          while (it != _attributes.end() && it->first == attr) {
  1.1224 +            it->second->set(token);
  1.1225 +            ++it;
  1.1226 +          }
  1.1227 +        }
  1.1228  
  1.1229        }
  1.1230        if (readSuccess()) {
  1.1231 -	line.putback(c);
  1.1232 +        line.putback(c);
  1.1233        }
  1.1234        for (typename Attributes::iterator it = _attributes.begin();
  1.1235 -	   it != _attributes.end(); ++it) {
  1.1236 -	if (read_attr.find(it->first) == read_attr.end()) {
  1.1237 -	  std::ostringstream msg;
  1.1238 -	  msg << "Attribute not found in file: " << it->first;
  1.1239 -	  throw DataFormatError(msg.str().c_str());
  1.1240 -	}	
  1.1241 +           it != _attributes.end(); ++it) {
  1.1242 +        if (read_attr.find(it->first) == read_attr.end()) {
  1.1243 +          std::ostringstream msg;
  1.1244 +          msg << "Attribute not found in file: " << it->first;
  1.1245 +          throw DataFormatError(msg.str().c_str());
  1.1246 +        }
  1.1247        }
  1.1248      }
  1.1249  
  1.1250    public:
  1.1251  
  1.1252 -    /// \name Execution of the reader    
  1.1253 +    /// \name Execution of the reader
  1.1254      /// @{
  1.1255  
  1.1256      /// \brief Start the batch processing
  1.1257 @@ -1108,74 +1108,74 @@
  1.1258      void run() {
  1.1259        LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
  1.1260        if (!*_is) {
  1.1261 -	throw DataFormatError("Cannot find file");
  1.1262 +        throw DataFormatError("Cannot find file");
  1.1263        }
  1.1264 -      
  1.1265 +
  1.1266        bool nodes_done = _skip_nodes;
  1.1267        bool arcs_done = _skip_arcs;
  1.1268        bool attributes_done = false;
  1.1269  
  1.1270 -      line_num = 0;      
  1.1271 +      line_num = 0;
  1.1272        readLine();
  1.1273        skipSection();
  1.1274  
  1.1275        while (readSuccess()) {
  1.1276 -	try {
  1.1277 -	  char c;
  1.1278 -	  std::string section, caption;
  1.1279 -	  line >> c;
  1.1280 -	  _reader_bits::readToken(line, section);
  1.1281 -	  _reader_bits::readToken(line, caption);
  1.1282 -
  1.1283 -	  if (line >> c) 
  1.1284 -	    throw DataFormatError("Extra character on the end of line");
  1.1285 -
  1.1286 -	  if (section == "nodes" && !nodes_done) {
  1.1287 -	    if (_nodes_caption.empty() || _nodes_caption == caption) {
  1.1288 -	      readNodes();
  1.1289 -	      nodes_done = true;
  1.1290 -	    }
  1.1291 -	  } else if ((section == "arcs" || section == "edges") && 
  1.1292 -		     !arcs_done) {
  1.1293 -	    if (_arcs_caption.empty() || _arcs_caption == caption) {
  1.1294 -	      readArcs();
  1.1295 -	      arcs_done = true;
  1.1296 -	    }
  1.1297 -	  } else if (section == "attributes" && !attributes_done) {
  1.1298 -	    if (_attributes_caption.empty() || _attributes_caption == caption) {
  1.1299 -	      readAttributes();
  1.1300 -	      attributes_done = true;
  1.1301 -	    }
  1.1302 -	  } else {
  1.1303 -	    readLine();
  1.1304 -	    skipSection();
  1.1305 -	  }
  1.1306 -	} catch (DataFormatError& error) {
  1.1307 -	  error.line(line_num);
  1.1308 -	  throw;
  1.1309 -	}	
  1.1310 +        try {
  1.1311 +          char c;
  1.1312 +          std::string section, caption;
  1.1313 +          line >> c;
  1.1314 +          _reader_bits::readToken(line, section);
  1.1315 +          _reader_bits::readToken(line, caption);
  1.1316 +
  1.1317 +          if (line >> c)
  1.1318 +            throw DataFormatError("Extra character on the end of line");
  1.1319 +
  1.1320 +          if (section == "nodes" && !nodes_done) {
  1.1321 +            if (_nodes_caption.empty() || _nodes_caption == caption) {
  1.1322 +              readNodes();
  1.1323 +              nodes_done = true;
  1.1324 +            }
  1.1325 +          } else if ((section == "arcs" || section == "edges") &&
  1.1326 +                     !arcs_done) {
  1.1327 +            if (_arcs_caption.empty() || _arcs_caption == caption) {
  1.1328 +              readArcs();
  1.1329 +              arcs_done = true;
  1.1330 +            }
  1.1331 +          } else if (section == "attributes" && !attributes_done) {
  1.1332 +            if (_attributes_caption.empty() || _attributes_caption == caption) {
  1.1333 +              readAttributes();
  1.1334 +              attributes_done = true;
  1.1335 +            }
  1.1336 +          } else {
  1.1337 +            readLine();
  1.1338 +            skipSection();
  1.1339 +          }
  1.1340 +        } catch (DataFormatError& error) {
  1.1341 +          error.line(line_num);
  1.1342 +          throw;
  1.1343 +        }
  1.1344        }
  1.1345  
  1.1346        if (!nodes_done) {
  1.1347 -	throw DataFormatError("Section @nodes not found");
  1.1348 +        throw DataFormatError("Section @nodes not found");
  1.1349        }
  1.1350  
  1.1351        if (!arcs_done) {
  1.1352 -	throw DataFormatError("Section @arcs not found");
  1.1353 +        throw DataFormatError("Section @arcs not found");
  1.1354        }
  1.1355  
  1.1356        if (!attributes_done && !_attributes.empty()) {
  1.1357 -	throw DataFormatError("Section @attributes not found");
  1.1358 +        throw DataFormatError("Section @attributes not found");
  1.1359        }
  1.1360  
  1.1361      }
  1.1362  
  1.1363      /// @}
  1.1364 -    
  1.1365 +
  1.1366    };
  1.1367  
  1.1368    /// \brief Return a \ref DigraphReader class
  1.1369 -  /// 
  1.1370 +  ///
  1.1371    /// This function just returns a \ref DigraphReader class.
  1.1372    /// \relates DigraphReader
  1.1373    template <typename Digraph>
  1.1374 @@ -1185,18 +1185,18 @@
  1.1375    }
  1.1376  
  1.1377    /// \brief Return a \ref DigraphReader class
  1.1378 -  /// 
  1.1379 +  ///
  1.1380    /// This function just returns a \ref DigraphReader class.
  1.1381    /// \relates DigraphReader
  1.1382    template <typename Digraph>
  1.1383 -  DigraphReader<Digraph> digraphReader(const std::string& fn, 
  1.1384 -				       Digraph& digraph) {
  1.1385 +  DigraphReader<Digraph> digraphReader(const std::string& fn,
  1.1386 +                                       Digraph& digraph) {
  1.1387      DigraphReader<Digraph> tmp(fn, digraph);
  1.1388      return tmp;
  1.1389    }
  1.1390  
  1.1391    /// \brief Return a \ref DigraphReader class
  1.1392 -  /// 
  1.1393 +  ///
  1.1394    /// This function just returns a \ref DigraphReader class.
  1.1395    /// \relates DigraphReader
  1.1396    template <typename Digraph>
  1.1397 @@ -1209,16 +1209,16 @@
  1.1398    class GraphReader;
  1.1399  
  1.1400    template <typename Graph>
  1.1401 -  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);    
  1.1402 +  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
  1.1403  
  1.1404    template <typename Graph>
  1.1405 -  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);   
  1.1406 +  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
  1.1407  
  1.1408    template <typename Graph>
  1.1409 -  GraphReader<Graph> graphReader(const char *fn, Graph& graph);    
  1.1410 +  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
  1.1411  
  1.1412    /// \ingroup lemon_io
  1.1413 -  ///  
  1.1414 +  ///
  1.1415    /// \brief \ref lgf-format "LGF" reader for undirected graphs
  1.1416    ///
  1.1417    /// This utility reads an \ref lgf-format "LGF" file.
  1.1418 @@ -1238,7 +1238,7 @@
  1.1419  
  1.1420      typedef _Graph Graph;
  1.1421      TEMPLATE_GRAPH_TYPEDEFS(Graph);
  1.1422 -    
  1.1423 +
  1.1424    private:
  1.1425  
  1.1426      std::istream* _is;
  1.1427 @@ -1254,16 +1254,16 @@
  1.1428      NodeIndex _node_index;
  1.1429      typedef std::map<std::string, Edge> EdgeIndex;
  1.1430      EdgeIndex _edge_index;
  1.1431 -    
  1.1432 -    typedef std::vector<std::pair<std::string, 
  1.1433 -      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
  1.1434 -    NodeMaps _node_maps; 
  1.1435 +
  1.1436 +    typedef std::vector<std::pair<std::string,
  1.1437 +      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
  1.1438 +    NodeMaps _node_maps;
  1.1439  
  1.1440      typedef std::vector<std::pair<std::string,
  1.1441        _reader_bits::MapStorageBase<Edge>*> > EdgeMaps;
  1.1442      EdgeMaps _edge_maps;
  1.1443  
  1.1444 -    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
  1.1445 +    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
  1.1446        Attributes;
  1.1447      Attributes _attributes;
  1.1448  
  1.1449 @@ -1282,66 +1282,66 @@
  1.1450      ///
  1.1451      /// Construct an undirected graph reader, which reads from the given
  1.1452      /// input stream.
  1.1453 -    GraphReader(std::istream& is, Graph& graph) 
  1.1454 +    GraphReader(std::istream& is, Graph& graph)
  1.1455        : _is(&is), local_is(false), _graph(graph),
  1.1456 -	_use_nodes(false), _use_edges(false),
  1.1457 -	_skip_nodes(false), _skip_edges(false) {}
  1.1458 +        _use_nodes(false), _use_edges(false),
  1.1459 +        _skip_nodes(false), _skip_edges(false) {}
  1.1460  
  1.1461      /// \brief Constructor
  1.1462      ///
  1.1463      /// Construct an undirected graph reader, which reads from the given
  1.1464      /// file.
  1.1465 -    GraphReader(const std::string& fn, Graph& graph) 
  1.1466 +    GraphReader(const std::string& fn, Graph& graph)
  1.1467        : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
  1.1468 -    	_use_nodes(false), _use_edges(false),
  1.1469 -	_skip_nodes(false), _skip_edges(false) {}
  1.1470 -    
  1.1471 +            _use_nodes(false), _use_edges(false),
  1.1472 +        _skip_nodes(false), _skip_edges(false) {}
  1.1473 +
  1.1474      /// \brief Constructor
  1.1475      ///
  1.1476      /// Construct an undirected graph reader, which reads from the given
  1.1477      /// file.
  1.1478 -    GraphReader(const char* fn, Graph& graph) 
  1.1479 +    GraphReader(const char* fn, Graph& graph)
  1.1480        : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
  1.1481 -    	_use_nodes(false), _use_edges(false),
  1.1482 -	_skip_nodes(false), _skip_edges(false) {}
  1.1483 +            _use_nodes(false), _use_edges(false),
  1.1484 +        _skip_nodes(false), _skip_edges(false) {}
  1.1485  
  1.1486      /// \brief Destructor
  1.1487      ~GraphReader() {
  1.1488 -      for (typename NodeMaps::iterator it = _node_maps.begin(); 
  1.1489 -	   it != _node_maps.end(); ++it) {
  1.1490 -	delete it->second;
  1.1491 +      for (typename NodeMaps::iterator it = _node_maps.begin();
  1.1492 +           it != _node_maps.end(); ++it) {
  1.1493 +        delete it->second;
  1.1494        }
  1.1495  
  1.1496 -      for (typename EdgeMaps::iterator it = _edge_maps.begin(); 
  1.1497 -	   it != _edge_maps.end(); ++it) {
  1.1498 -	delete it->second;
  1.1499 +      for (typename EdgeMaps::iterator it = _edge_maps.begin();
  1.1500 +           it != _edge_maps.end(); ++it) {
  1.1501 +        delete it->second;
  1.1502        }
  1.1503  
  1.1504 -      for (typename Attributes::iterator it = _attributes.begin(); 
  1.1505 -	   it != _attributes.end(); ++it) {
  1.1506 -	delete it->second;
  1.1507 +      for (typename Attributes::iterator it = _attributes.begin();
  1.1508 +           it != _attributes.end(); ++it) {
  1.1509 +        delete it->second;
  1.1510        }
  1.1511  
  1.1512        if (local_is) {
  1.1513 -	delete _is;
  1.1514 +        delete _is;
  1.1515        }
  1.1516  
  1.1517      }
  1.1518  
  1.1519    private:
  1.1520 -    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);    
  1.1521 -    friend GraphReader<Graph> graphReader<>(const std::string& fn, 
  1.1522 -					    Graph& graph);   
  1.1523 -    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);    
  1.1524 -
  1.1525 -    GraphReader(GraphReader& other) 
  1.1526 +    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
  1.1527 +    friend GraphReader<Graph> graphReader<>(const std::string& fn,
  1.1528 +                                            Graph& graph);
  1.1529 +    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
  1.1530 +
  1.1531 +    GraphReader(GraphReader& other)
  1.1532        : _is(other._is), local_is(other.local_is), _graph(other._graph),
  1.1533 -	_use_nodes(other._use_nodes), _use_edges(other._use_edges),
  1.1534 -	_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
  1.1535 +        _use_nodes(other._use_nodes), _use_edges(other._use_edges),
  1.1536 +        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
  1.1537  
  1.1538        other._is = 0;
  1.1539        other.local_is = false;
  1.1540 -      
  1.1541 +
  1.1542        _node_index.swap(other._node_index);
  1.1543        _edge_index.swap(other._edge_index);
  1.1544  
  1.1545 @@ -1361,15 +1361,15 @@
  1.1546  
  1.1547      /// \name Reading rules
  1.1548      /// @{
  1.1549 -    
  1.1550 +
  1.1551      /// \brief Node map reading rule
  1.1552      ///
  1.1553      /// Add a node map reading rule to the reader.
  1.1554      template <typename Map>
  1.1555      GraphReader& nodeMap(const std::string& caption, Map& map) {
  1.1556        checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
  1.1557 -      _reader_bits::MapStorageBase<Node>* storage = 
  1.1558 -	new _reader_bits::MapStorage<Node, Map>(map);
  1.1559 +      _reader_bits::MapStorageBase<Node>* storage =
  1.1560 +        new _reader_bits::MapStorage<Node, Map>(map);
  1.1561        _node_maps.push_back(std::make_pair(caption, storage));
  1.1562        return *this;
  1.1563      }
  1.1564 @@ -1379,11 +1379,11 @@
  1.1565      /// Add a node map reading rule with specialized converter to the
  1.1566      /// reader.
  1.1567      template <typename Map, typename Converter>
  1.1568 -    GraphReader& nodeMap(const std::string& caption, Map& map, 
  1.1569 -			   const Converter& converter = Converter()) {
  1.1570 +    GraphReader& nodeMap(const std::string& caption, Map& map,
  1.1571 +                           const Converter& converter = Converter()) {
  1.1572        checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
  1.1573 -      _reader_bits::MapStorageBase<Node>* storage = 
  1.1574 -	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
  1.1575 +      _reader_bits::MapStorageBase<Node>* storage =
  1.1576 +        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
  1.1577        _node_maps.push_back(std::make_pair(caption, storage));
  1.1578        return *this;
  1.1579      }
  1.1580 @@ -1394,8 +1394,8 @@
  1.1581      template <typename Map>
  1.1582      GraphReader& edgeMap(const std::string& caption, Map& map) {
  1.1583        checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
  1.1584 -      _reader_bits::MapStorageBase<Edge>* storage = 
  1.1585 -	new _reader_bits::MapStorage<Edge, Map>(map);
  1.1586 +      _reader_bits::MapStorageBase<Edge>* storage =
  1.1587 +        new _reader_bits::MapStorage<Edge, Map>(map);
  1.1588        _edge_maps.push_back(std::make_pair(caption, storage));
  1.1589        return *this;
  1.1590      }
  1.1591 @@ -1405,11 +1405,11 @@
  1.1592      /// Add an edge map reading rule with specialized converter to the
  1.1593      /// reader.
  1.1594      template <typename Map, typename Converter>
  1.1595 -    GraphReader& edgeMap(const std::string& caption, Map& map, 
  1.1596 -			  const Converter& converter = Converter()) {
  1.1597 +    GraphReader& edgeMap(const std::string& caption, Map& map,
  1.1598 +                          const Converter& converter = Converter()) {
  1.1599        checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
  1.1600 -      _reader_bits::MapStorageBase<Edge>* storage = 
  1.1601 -	new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
  1.1602 +      _reader_bits::MapStorageBase<Edge>* storage =
  1.1603 +        new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
  1.1604        _edge_maps.push_back(std::make_pair(caption, storage));
  1.1605        return *this;
  1.1606      }
  1.1607 @@ -1420,11 +1420,11 @@
  1.1608      template <typename Map>
  1.1609      GraphReader& arcMap(const std::string& caption, Map& map) {
  1.1610        checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
  1.1611 -      _reader_bits::MapStorageBase<Edge>* forward_storage = 
  1.1612 -	new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
  1.1613 +      _reader_bits::MapStorageBase<Edge>* forward_storage =
  1.1614 +        new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
  1.1615        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
  1.1616 -      _reader_bits::MapStorageBase<Edge>* backward_storage = 
  1.1617 -	new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
  1.1618 +      _reader_bits::MapStorageBase<Edge>* backward_storage =
  1.1619 +        new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
  1.1620        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
  1.1621        return *this;
  1.1622      }
  1.1623 @@ -1434,16 +1434,16 @@
  1.1624      /// Add an arc map reading rule with specialized converter to the
  1.1625      /// reader.
  1.1626      template <typename Map, typename Converter>
  1.1627 -    GraphReader& arcMap(const std::string& caption, Map& map, 
  1.1628 -			  const Converter& converter = Converter()) {
  1.1629 +    GraphReader& arcMap(const std::string& caption, Map& map,
  1.1630 +                          const Converter& converter = Converter()) {
  1.1631        checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
  1.1632 -      _reader_bits::MapStorageBase<Edge>* forward_storage = 
  1.1633 -	new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
  1.1634 -	(_graph, map, converter);
  1.1635 +      _reader_bits::MapStorageBase<Edge>* forward_storage =
  1.1636 +        new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
  1.1637 +        (_graph, map, converter);
  1.1638        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
  1.1639 -      _reader_bits::MapStorageBase<Edge>* backward_storage = 
  1.1640 -	new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
  1.1641 -	(_graph, map, converter);
  1.1642 +      _reader_bits::MapStorageBase<Edge>* backward_storage =
  1.1643 +        new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
  1.1644 +        (_graph, map, converter);
  1.1645        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
  1.1646        return *this;
  1.1647      }
  1.1648 @@ -1453,8 +1453,8 @@
  1.1649      /// Add an attribute reading rule to the reader.
  1.1650      template <typename Value>
  1.1651      GraphReader& attribute(const std::string& caption, Value& value) {
  1.1652 -      _reader_bits::ValueStorageBase* storage = 
  1.1653 -	new _reader_bits::ValueStorage<Value>(value);
  1.1654 +      _reader_bits::ValueStorageBase* storage =
  1.1655 +        new _reader_bits::ValueStorage<Value>(value);
  1.1656        _attributes.insert(std::make_pair(caption, storage));
  1.1657        return *this;
  1.1658      }
  1.1659 @@ -1464,10 +1464,10 @@
  1.1660      /// Add an attribute reading rule with specialized converter to the
  1.1661      /// reader.
  1.1662      template <typename Value, typename Converter>
  1.1663 -    GraphReader& attribute(const std::string& caption, Value& value, 
  1.1664 -			     const Converter& converter = Converter()) {
  1.1665 -      _reader_bits::ValueStorageBase* storage = 
  1.1666 -	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
  1.1667 +    GraphReader& attribute(const std::string& caption, Value& value,
  1.1668 +                             const Converter& converter = Converter()) {
  1.1669 +      _reader_bits::ValueStorageBase* storage =
  1.1670 +        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
  1.1671        _attributes.insert(std::make_pair(caption, storage));
  1.1672        return *this;
  1.1673      }
  1.1674 @@ -1478,8 +1478,8 @@
  1.1675      GraphReader& node(const std::string& caption, Node& node) {
  1.1676        typedef _reader_bits::MapLookUpConverter<Node> Converter;
  1.1677        Converter converter(_node_index);
  1.1678 -      _reader_bits::ValueStorageBase* storage = 
  1.1679 -	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
  1.1680 +      _reader_bits::ValueStorageBase* storage =
  1.1681 +        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
  1.1682        _attributes.insert(std::make_pair(caption, storage));
  1.1683        return *this;
  1.1684      }
  1.1685 @@ -1490,8 +1490,8 @@
  1.1686      GraphReader& edge(const std::string& caption, Edge& edge) {
  1.1687        typedef _reader_bits::MapLookUpConverter<Edge> Converter;
  1.1688        Converter converter(_edge_index);
  1.1689 -      _reader_bits::ValueStorageBase* storage = 
  1.1690 -	new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
  1.1691 +      _reader_bits::ValueStorageBase* storage =
  1.1692 +        new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
  1.1693        _attributes.insert(std::make_pair(caption, storage));
  1.1694        return *this;
  1.1695      }
  1.1696 @@ -1502,8 +1502,8 @@
  1.1697      GraphReader& arc(const std::string& caption, Arc& arc) {
  1.1698        typedef _reader_bits::GraphArcLookUpConverter<Graph> Converter;
  1.1699        Converter converter(_graph, _edge_index);
  1.1700 -      _reader_bits::ValueStorageBase* storage = 
  1.1701 -	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
  1.1702 +      _reader_bits::ValueStorageBase* storage =
  1.1703 +        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
  1.1704        _attributes.insert(std::make_pair(caption, storage));
  1.1705        return *this;
  1.1706      }
  1.1707 @@ -1549,11 +1549,11 @@
  1.1708      template <typename Map>
  1.1709      GraphReader& useNodes(const Map& map) {
  1.1710        checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
  1.1711 -      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
  1.1712 +      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
  1.1713        _use_nodes = true;
  1.1714        _writer_bits::DefaultConverter<typename Map::Value> converter;
  1.1715        for (NodeIt n(_graph); n != INVALID; ++n) {
  1.1716 -	_node_index.insert(std::make_pair(converter(map[n]), n));
  1.1717 +        _node_index.insert(std::make_pair(converter(map[n]), n));
  1.1718        }
  1.1719        return *this;
  1.1720      }
  1.1721 @@ -1564,13 +1564,13 @@
  1.1722      /// label map and a functor which converts the label map values to
  1.1723      /// \c std::string.
  1.1724      template <typename Map, typename Converter>
  1.1725 -    GraphReader& useNodes(const Map& map, 
  1.1726 -			    const Converter& converter = Converter()) {
  1.1727 +    GraphReader& useNodes(const Map& map,
  1.1728 +                            const Converter& converter = Converter()) {
  1.1729        checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
  1.1730 -      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
  1.1731 +      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
  1.1732        _use_nodes = true;
  1.1733        for (NodeIt n(_graph); n != INVALID; ++n) {
  1.1734 -	_node_index.insert(std::make_pair(converter(map[n]), n));
  1.1735 +        _node_index.insert(std::make_pair(converter(map[n]), n));
  1.1736        }
  1.1737        return *this;
  1.1738      }
  1.1739 @@ -1586,7 +1586,7 @@
  1.1740        _use_edges = true;
  1.1741        _writer_bits::DefaultConverter<typename Map::Value> converter;
  1.1742        for (EdgeIt a(_graph); a != INVALID; ++a) {
  1.1743 -	_edge_index.insert(std::make_pair(converter(map[a]), a));
  1.1744 +        _edge_index.insert(std::make_pair(converter(map[a]), a));
  1.1745        }
  1.1746        return *this;
  1.1747      }
  1.1748 @@ -1597,13 +1597,13 @@
  1.1749      /// label map and a functor which converts the label map values to
  1.1750      /// \c std::string.
  1.1751      template <typename Map, typename Converter>
  1.1752 -    GraphReader& useEdges(const Map& map, 
  1.1753 -			    const Converter& converter = Converter()) {
  1.1754 +    GraphReader& useEdges(const Map& map,
  1.1755 +                            const Converter& converter = Converter()) {
  1.1756        checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
  1.1757 -      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member"); 
  1.1758 +      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member");
  1.1759        _use_edges = true;
  1.1760        for (EdgeIt a(_graph); a != INVALID; ++a) {
  1.1761 -	_edge_index.insert(std::make_pair(converter(map[a]), a));
  1.1762 +        _edge_index.insert(std::make_pair(converter(map[a]), a));
  1.1763        }
  1.1764        return *this;
  1.1765      }
  1.1766 @@ -1618,7 +1618,7 @@
  1.1767      /// Therefore \c skipEdges() function should also be used, or
  1.1768      /// \c useNodes() should be used to specify the label of the nodes.
  1.1769      GraphReader& skipNodes() {
  1.1770 -      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
  1.1771 +      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
  1.1772        _skip_nodes = true;
  1.1773        return *this;
  1.1774      }
  1.1775 @@ -1629,7 +1629,7 @@
  1.1776      /// map reading rule will be abandoned, and the edges of the graph
  1.1777      /// will not be constructed.
  1.1778      GraphReader& skipEdges() {
  1.1779 -      LEMON_ASSERT(!_skip_edges, "Skip edges already set"); 
  1.1780 +      LEMON_ASSERT(!_skip_edges, "Skip edges already set");
  1.1781        _skip_edges = true;
  1.1782        return *this;
  1.1783      }
  1.1784 @@ -1641,12 +1641,12 @@
  1.1785      bool readLine() {
  1.1786        std::string str;
  1.1787        while(++line_num, std::getline(*_is, str)) {
  1.1788 -	line.clear(); line.str(str);
  1.1789 -	char c;
  1.1790 -	if (line >> std::ws >> c && c != '#') {
  1.1791 -	  line.putback(c);
  1.1792 -	  return true;
  1.1793 -	}
  1.1794 +        line.clear(); line.str(str);
  1.1795 +        char c;
  1.1796 +        if (line >> std::ws >> c && c != '#') {
  1.1797 +          line.putback(c);
  1.1798 +          return true;
  1.1799 +        }
  1.1800        }
  1.1801        return false;
  1.1802      }
  1.1803 @@ -1654,11 +1654,11 @@
  1.1804      bool readSuccess() {
  1.1805        return static_cast<bool>(*_is);
  1.1806      }
  1.1807 -    
  1.1808 +
  1.1809      void skipSection() {
  1.1810        char c;
  1.1811        while (readSuccess() && line >> c && c != '@') {
  1.1812 -	readLine();
  1.1813 +        readLine();
  1.1814        }
  1.1815        line.putback(c);
  1.1816      }
  1.1817 @@ -1670,89 +1670,89 @@
  1.1818  
  1.1819        char c;
  1.1820        if (!readLine() || !(line >> c) || c == '@') {
  1.1821 -	if (readSuccess() && line) line.putback(c);
  1.1822 -	if (!_node_maps.empty()) 
  1.1823 -	  throw DataFormatError("Cannot find map names");
  1.1824 -	return;
  1.1825 +        if (readSuccess() && line) line.putback(c);
  1.1826 +        if (!_node_maps.empty())
  1.1827 +          throw DataFormatError("Cannot find map names");
  1.1828 +        return;
  1.1829        }
  1.1830        line.putback(c);
  1.1831 -      
  1.1832 +
  1.1833        {
  1.1834 -	std::map<std::string, int> maps;
  1.1835 -	
  1.1836 -	std::string map;
  1.1837 -	int index = 0;
  1.1838 -	while (_reader_bits::readToken(line, map)) {
  1.1839 -	  if (maps.find(map) != maps.end()) {
  1.1840 -	    std::ostringstream msg;
  1.1841 -	    msg << "Multiple occurence of node map: " << map;
  1.1842 -	    throw DataFormatError(msg.str().c_str());
  1.1843 -	  }
  1.1844 -	  maps.insert(std::make_pair(map, index));
  1.1845 -	  ++index;
  1.1846 -	}
  1.1847 -	
  1.1848 -	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
  1.1849 -	  std::map<std::string, int>::iterator jt = 
  1.1850 -	    maps.find(_node_maps[i].first);
  1.1851 -	  if (jt == maps.end()) {
  1.1852 -	    std::ostringstream msg;
  1.1853 -	    msg << "Map not found in file: " << _node_maps[i].first;
  1.1854 -	    throw DataFormatError(msg.str().c_str());
  1.1855 -	  }
  1.1856 -	  map_index[i] = jt->second;
  1.1857 -	}
  1.1858 -
  1.1859 -	{
  1.1860 -	  std::map<std::string, int>::iterator jt = maps.find("label");
  1.1861 -	  if (jt != maps.end()) {
  1.1862 -	    label_index = jt->second;
  1.1863 -	  } else {
  1.1864 -	    label_index = -1;
  1.1865 -	  }
  1.1866 -	}
  1.1867 -	map_num = maps.size();
  1.1868 +        std::map<std::string, int> maps;
  1.1869 +
  1.1870 +        std::string map;
  1.1871 +        int index = 0;
  1.1872 +        while (_reader_bits::readToken(line, map)) {
  1.1873 +          if (maps.find(map) != maps.end()) {
  1.1874 +            std::ostringstream msg;
  1.1875 +            msg << "Multiple occurence of node map: " << map;
  1.1876 +            throw DataFormatError(msg.str().c_str());
  1.1877 +          }
  1.1878 +          maps.insert(std::make_pair(map, index));
  1.1879 +          ++index;
  1.1880 +        }
  1.1881 +
  1.1882 +        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
  1.1883 +          std::map<std::string, int>::iterator jt =
  1.1884 +            maps.find(_node_maps[i].first);
  1.1885 +          if (jt == maps.end()) {
  1.1886 +            std::ostringstream msg;
  1.1887 +            msg << "Map not found in file: " << _node_maps[i].first;
  1.1888 +            throw DataFormatError(msg.str().c_str());
  1.1889 +          }
  1.1890 +          map_index[i] = jt->second;
  1.1891 +        }
  1.1892 +
  1.1893 +        {
  1.1894 +          std::map<std::string, int>::iterator jt = maps.find("label");
  1.1895 +          if (jt != maps.end()) {
  1.1896 +            label_index = jt->second;
  1.1897 +          } else {
  1.1898 +            label_index = -1;
  1.1899 +          }
  1.1900 +        }
  1.1901 +        map_num = maps.size();
  1.1902        }
  1.1903  
  1.1904        while (readLine() && line >> c && c != '@') {
  1.1905 -	line.putback(c);
  1.1906 -
  1.1907 -	std::vector<std::string> tokens(map_num);
  1.1908 -	for (int i = 0; i < map_num; ++i) {
  1.1909 -	  if (!_reader_bits::readToken(line, tokens[i])) {
  1.1910 -	    std::ostringstream msg;
  1.1911 -	    msg << "Column not found (" << i + 1 << ")";
  1.1912 -	    throw DataFormatError(msg.str().c_str());
  1.1913 -	  }
  1.1914 -	}
  1.1915 -	if (line >> std::ws >> c)
  1.1916 -	  throw DataFormatError("Extra character on the end of line");
  1.1917 -	
  1.1918 -	Node n;
  1.1919 -	if (!_use_nodes) {
  1.1920 -	  n = _graph.addNode();
  1.1921 -	  if (label_index != -1) 
  1.1922 -	    _node_index.insert(std::make_pair(tokens[label_index], n));
  1.1923 -	} else {
  1.1924 -	  if (label_index == -1) 
  1.1925 -	    throw DataFormatError("Label map not found in file");
  1.1926 -	  typename std::map<std::string, Node>::iterator it =
  1.1927 -	    _node_index.find(tokens[label_index]);
  1.1928 -	  if (it == _node_index.end()) {
  1.1929 -	    std::ostringstream msg;
  1.1930 -	    msg << "Node with label not found: " << tokens[label_index];
  1.1931 -	    throw DataFormatError(msg.str().c_str());	    
  1.1932 -	  }
  1.1933 -	  n = it->second;
  1.1934 -	}
  1.1935 -
  1.1936 -	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
  1.1937 -	  _node_maps[i].second->set(n, tokens[map_index[i]]);
  1.1938 -	}
  1.1939 +        line.putback(c);
  1.1940 +
  1.1941 +        std::vector<std::string> tokens(map_num);
  1.1942 +        for (int i = 0; i < map_num; ++i) {
  1.1943 +          if (!_reader_bits::readToken(line, tokens[i])) {
  1.1944 +            std::ostringstream msg;
  1.1945 +            msg << "Column not found (" << i + 1 << ")";
  1.1946 +            throw DataFormatError(msg.str().c_str());
  1.1947 +          }
  1.1948 +        }
  1.1949 +        if (line >> std::ws >> c)
  1.1950 +          throw DataFormatError("Extra character on the end of line");
  1.1951 +
  1.1952 +        Node n;
  1.1953 +        if (!_use_nodes) {
  1.1954 +          n = _graph.addNode();
  1.1955 +          if (label_index != -1)
  1.1956 +            _node_index.insert(std::make_pair(tokens[label_index], n));
  1.1957 +        } else {
  1.1958 +          if (label_index == -1)
  1.1959 +            throw DataFormatError("Label map not found in file");
  1.1960 +          typename std::map<std::string, Node>::iterator it =
  1.1961 +            _node_index.find(tokens[label_index]);
  1.1962 +          if (it == _node_index.end()) {
  1.1963 +            std::ostringstream msg;
  1.1964 +            msg << "Node with label not found: " << tokens[label_index];
  1.1965 +            throw DataFormatError(msg.str().c_str());
  1.1966 +          }
  1.1967 +          n = it->second;
  1.1968 +        }
  1.1969 +
  1.1970 +        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
  1.1971 +          _node_maps[i].second->set(n, tokens[map_index[i]]);
  1.1972 +        }
  1.1973  
  1.1974        }
  1.1975        if (readSuccess()) {
  1.1976 -	line.putback(c);
  1.1977 +        line.putback(c);
  1.1978        }
  1.1979      }
  1.1980  
  1.1981 @@ -1763,78 +1763,78 @@
  1.1982  
  1.1983        char c;
  1.1984        if (!readLine() || !(line >> c) || c == '@') {
  1.1985 -	if (readSuccess() && line) line.putback(c);
  1.1986 -	if (!_edge_maps.empty()) 
  1.1987 -	  throw DataFormatError("Cannot find map names");
  1.1988 -	return;
  1.1989 +        if (readSuccess() && line) line.putback(c);
  1.1990 +        if (!_edge_maps.empty())
  1.1991 +          throw DataFormatError("Cannot find map names");
  1.1992 +        return;
  1.1993        }
  1.1994        line.putback(c);
  1.1995 -      
  1.1996 +
  1.1997        {
  1.1998 -	std::map<std::string, int> maps;
  1.1999 -	
  1.2000 -	std::string map;
  1.2001 -	int index = 0;
  1.2002 -	while (_reader_bits::readToken(line, map)) {
  1.2003 -	  if (maps.find(map) != maps.end()) {
  1.2004 -	    std::ostringstream msg;
  1.2005 -	    msg << "Multiple occurence of edge map: " << map;
  1.2006 -	    throw DataFormatError(msg.str().c_str());
  1.2007 -	  }
  1.2008 -	  maps.insert(std::make_pair(map, index));
  1.2009 -	  ++index;
  1.2010 -	}
  1.2011 -	
  1.2012 -	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
  1.2013 -	  std::map<std::string, int>::iterator jt = 
  1.2014 -	    maps.find(_edge_maps[i].first);
  1.2015 -	  if (jt == maps.end()) {
  1.2016 -	    std::ostringstream msg;
  1.2017 -	    msg << "Map not found in file: " << _edge_maps[i].first;
  1.2018 -	    throw DataFormatError(msg.str().c_str());
  1.2019 -	  }
  1.2020 -	  map_index[i] = jt->second;
  1.2021 -	}
  1.2022 -
  1.2023 -	{
  1.2024 -	  std::map<std::string, int>::iterator jt = maps.find("label");
  1.2025 -	  if (jt != maps.end()) {
  1.2026 -	    label_index = jt->second;
  1.2027 -	  } else {
  1.2028 -	    label_index = -1;
  1.2029 -	  }
  1.2030 -	}
  1.2031 -	map_num = maps.size();
  1.2032 +        std::map<std::string, int> maps;
  1.2033 +
  1.2034 +        std::string map;
  1.2035 +        int index = 0;
  1.2036 +        while (_reader_bits::readToken(line, map)) {
  1.2037 +          if (maps.find(map) != maps.end()) {
  1.2038 +            std::ostringstream msg;
  1.2039 +            msg << "Multiple occurence of edge map: " << map;
  1.2040 +            throw DataFormatError(msg.str().c_str());
  1.2041 +          }
  1.2042 +          maps.insert(std::make_pair(map, index));
  1.2043 +          ++index;
  1.2044 +        }
  1.2045 +
  1.2046 +        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
  1.2047 +          std::map<std::string, int>::iterator jt =
  1.2048 +            maps.find(_edge_maps[i].first);
  1.2049 +          if (jt == maps.end()) {
  1.2050 +            std::ostringstream msg;
  1.2051 +            msg << "Map not found in file: " << _edge_maps[i].first;
  1.2052 +            throw DataFormatError(msg.str().c_str());
  1.2053 +          }
  1.2054 +          map_index[i] = jt->second;
  1.2055 +        }
  1.2056 +
  1.2057 +        {
  1.2058 +          std::map<std::string, int>::iterator jt = maps.find("label");
  1.2059 +          if (jt != maps.end()) {
  1.2060 +            label_index = jt->second;
  1.2061 +          } else {
  1.2062 +            label_index = -1;
  1.2063 +          }
  1.2064 +        }
  1.2065 +        map_num = maps.size();
  1.2066        }
  1.2067  
  1.2068        while (readLine() && line >> c && c != '@') {
  1.2069 -	line.putback(c);
  1.2070 -
  1.2071 -	std::string source_token;
  1.2072 -	std::string target_token;
  1.2073 -
  1.2074 -	if (!_reader_bits::readToken(line, source_token))
  1.2075 -	  throw DataFormatError("Node u not found");
  1.2076 -
  1.2077 -	if (!_reader_bits::readToken(line, target_token))
  1.2078 -	  throw DataFormatError("Node v not found");
  1.2079 -	
  1.2080 -	std::vector<std::string> tokens(map_num);
  1.2081 -	for (int i = 0; i < map_num; ++i) {
  1.2082 -	  if (!_reader_bits::readToken(line, tokens[i])) {
  1.2083 -	    std::ostringstream msg;
  1.2084 -	    msg << "Column not found (" << i + 1 << ")";
  1.2085 -	    throw DataFormatError(msg.str().c_str());
  1.2086 -	  }
  1.2087 -	}
  1.2088 -	if (line >> std::ws >> c)
  1.2089 -	  throw DataFormatError("Extra character on the end of line");
  1.2090 -	
  1.2091 -	Edge e;
  1.2092 -	if (!_use_edges) {
  1.2093 +        line.putback(c);
  1.2094 +
  1.2095 +        std::string source_token;
  1.2096 +        std::string target_token;
  1.2097 +
  1.2098 +        if (!_reader_bits::readToken(line, source_token))
  1.2099 +          throw DataFormatError("Node u not found");
  1.2100 +
  1.2101 +        if (!_reader_bits::readToken(line, target_token))
  1.2102 +          throw DataFormatError("Node v not found");
  1.2103 +
  1.2104 +        std::vector<std::string> tokens(map_num);
  1.2105 +        for (int i = 0; i < map_num; ++i) {
  1.2106 +          if (!_reader_bits::readToken(line, tokens[i])) {
  1.2107 +            std::ostringstream msg;
  1.2108 +            msg << "Column not found (" << i + 1 << ")";
  1.2109 +            throw DataFormatError(msg.str().c_str());
  1.2110 +          }
  1.2111 +        }
  1.2112 +        if (line >> std::ws >> c)
  1.2113 +          throw DataFormatError("Extra character on the end of line");
  1.2114 +
  1.2115 +        Edge e;
  1.2116 +        if (!_use_edges) {
  1.2117  
  1.2118            typename NodeIndex::iterator it;
  1.2119 - 
  1.2120 +
  1.2121            it = _node_index.find(source_token);
  1.2122            if (it == _node_index.end()) {
  1.2123              std::ostringstream msg;
  1.2124 @@ -1844,36 +1844,36 @@
  1.2125            Node source = it->second;
  1.2126  
  1.2127            it = _node_index.find(target_token);
  1.2128 -          if (it == _node_index.end()) {       
  1.2129 -            std::ostringstream msg;            
  1.2130 +          if (it == _node_index.end()) {
  1.2131 +            std::ostringstream msg;
  1.2132              msg << "Item not found: " << target_token;
  1.2133              throw DataFormatError(msg.str().c_str());
  1.2134 -          }                                          
  1.2135 -          Node target = it->second;                            
  1.2136 -
  1.2137 -	  e = _graph.addEdge(source, target);
  1.2138 -	  if (label_index != -1) 
  1.2139 -	    _edge_index.insert(std::make_pair(tokens[label_index], e));
  1.2140 -	} else {
  1.2141 -	  if (label_index == -1) 
  1.2142 -	    throw DataFormatError("Label map not found in file");
  1.2143 -	  typename std::map<std::string, Edge>::iterator it =
  1.2144 -	    _edge_index.find(tokens[label_index]);
  1.2145 -	  if (it == _edge_index.end()) {
  1.2146 -	    std::ostringstream msg;
  1.2147 -	    msg << "Edge with label not found: " << tokens[label_index];
  1.2148 -	    throw DataFormatError(msg.str().c_str());	    
  1.2149 -	  }
  1.2150 -	  e = it->second;
  1.2151 -	}
  1.2152 -
  1.2153 -	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
  1.2154 -	  _edge_maps[i].second->set(e, tokens[map_index[i]]);
  1.2155 -	}
  1.2156 +          }
  1.2157 +          Node target = it->second;
  1.2158 +
  1.2159 +          e = _graph.addEdge(source, target);
  1.2160 +          if (label_index != -1)
  1.2161 +            _edge_index.insert(std::make_pair(tokens[label_index], e));
  1.2162 +        } else {
  1.2163 +          if (label_index == -1)
  1.2164 +            throw DataFormatError("Label map not found in file");
  1.2165 +          typename std::map<std::string, Edge>::iterator it =
  1.2166 +            _edge_index.find(tokens[label_index]);
  1.2167 +          if (it == _edge_index.end()) {
  1.2168 +            std::ostringstream msg;
  1.2169 +            msg << "Edge with label not found: " << tokens[label_index];
  1.2170 +            throw DataFormatError(msg.str().c_str());
  1.2171 +          }
  1.2172 +          e = it->second;
  1.2173 +        }
  1.2174 +
  1.2175 +        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
  1.2176 +          _edge_maps[i].second->set(e, tokens[map_index[i]]);
  1.2177 +        }
  1.2178  
  1.2179        }
  1.2180        if (readSuccess()) {
  1.2181 -	line.putback(c);
  1.2182 +        line.putback(c);
  1.2183        }
  1.2184      }
  1.2185  
  1.2186 @@ -1883,125 +1883,125 @@
  1.2187  
  1.2188        char c;
  1.2189        while (readLine() && line >> c && c != '@') {
  1.2190 -	line.putback(c);
  1.2191 -	
  1.2192 -	std::string attr, token;
  1.2193 -	if (!_reader_bits::readToken(line, attr))
  1.2194 -	  throw DataFormatError("Attribute name not found");
  1.2195 -	if (!_reader_bits::readToken(line, token))
  1.2196 -	  throw DataFormatError("Attribute value not found");
  1.2197 -	if (line >> c)
  1.2198 -	  throw DataFormatError("Extra character on the end of line");	  
  1.2199 -
  1.2200 -	{
  1.2201 -	  std::set<std::string>::iterator it = read_attr.find(attr);
  1.2202 -	  if (it != read_attr.end()) {
  1.2203 -	    std::ostringstream msg;
  1.2204 -	    msg << "Multiple occurence of attribute " << attr;
  1.2205 -	    throw DataFormatError(msg.str().c_str());
  1.2206 -	  }
  1.2207 -	  read_attr.insert(attr);
  1.2208 -	}
  1.2209 -	
  1.2210 -	{
  1.2211 -	  typename Attributes::iterator it = _attributes.lower_bound(attr);
  1.2212 -	  while (it != _attributes.end() && it->first == attr) {
  1.2213 -	    it->second->set(token);
  1.2214 -	    ++it;
  1.2215 -	  }
  1.2216 -	}
  1.2217 +        line.putback(c);
  1.2218 +
  1.2219 +        std::string attr, token;
  1.2220 +        if (!_reader_bits::readToken(line, attr))
  1.2221 +          throw DataFormatError("Attribute name not found");
  1.2222 +        if (!_reader_bits::readToken(line, token))
  1.2223 +          throw DataFormatError("Attribute value not found");
  1.2224 +        if (line >> c)
  1.2225 +          throw DataFormatError("Extra character on the end of line");
  1.2226 +
  1.2227 +        {
  1.2228 +          std::set<std::string>::iterator it = read_attr.find(attr);
  1.2229 +          if (it != read_attr.end()) {
  1.2230 +            std::ostringstream msg;
  1.2231 +            msg << "Multiple occurence of attribute " << attr;
  1.2232 +            throw DataFormatError(msg.str().c_str());
  1.2233 +          }
  1.2234 +          read_attr.insert(attr);
  1.2235 +        }
  1.2236 +
  1.2237 +        {
  1.2238 +          typename Attributes::iterator it = _attributes.lower_bound(attr);
  1.2239 +          while (it != _attributes.end() && it->first == attr) {
  1.2240 +            it->second->set(token);
  1.2241 +            ++it;
  1.2242 +          }
  1.2243 +        }
  1.2244  
  1.2245        }
  1.2246        if (readSuccess()) {
  1.2247 -	line.putback(c);
  1.2248 +        line.putback(c);
  1.2249        }
  1.2250        for (typename Attributes::iterator it = _attributes.begin();
  1.2251 -	   it != _attributes.end(); ++it) {
  1.2252 -	if (read_attr.find(it->first) == read_attr.end()) {
  1.2253 -	  std::ostringstream msg;
  1.2254 -	  msg << "Attribute not found in file: " << it->first;
  1.2255 -	  throw DataFormatError(msg.str().c_str());
  1.2256 -	}	
  1.2257 +           it != _attributes.end(); ++it) {
  1.2258 +        if (read_attr.find(it->first) == read_attr.end()) {
  1.2259 +          std::ostringstream msg;
  1.2260 +          msg << "Attribute not found in file: " << it->first;
  1.2261 +          throw DataFormatError(msg.str().c_str());
  1.2262 +        }
  1.2263        }
  1.2264      }
  1.2265  
  1.2266    public:
  1.2267  
  1.2268 -    /// \name Execution of the reader    
  1.2269 +    /// \name Execution of the reader
  1.2270      /// @{
  1.2271  
  1.2272      /// \brief Start the batch processing
  1.2273      ///
  1.2274      /// This function starts the batch processing
  1.2275      void run() {
  1.2276 -      
  1.2277 +
  1.2278        LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
  1.2279 -      
  1.2280 +
  1.2281        bool nodes_done = _skip_nodes;
  1.2282        bool edges_done = _skip_edges;
  1.2283        bool attributes_done = false;
  1.2284  
  1.2285 -      line_num = 0;      
  1.2286 +      line_num = 0;
  1.2287        readLine();
  1.2288        skipSection();
  1.2289  
  1.2290        while (readSuccess()) {
  1.2291 -	try {
  1.2292 -	  char c;
  1.2293 -	  std::string section, caption;
  1.2294 -	  line >> c;
  1.2295 -	  _reader_bits::readToken(line, section);
  1.2296 -	  _reader_bits::readToken(line, caption);
  1.2297 -
  1.2298 -	  if (line >> c) 
  1.2299 -	    throw DataFormatError("Extra character on the end of line");
  1.2300 -
  1.2301 -	  if (section == "nodes" && !nodes_done) {
  1.2302 -	    if (_nodes_caption.empty() || _nodes_caption == caption) {
  1.2303 -	      readNodes();
  1.2304 -	      nodes_done = true;
  1.2305 -	    }
  1.2306 -	  } else if ((section == "edges" || section == "arcs") && 
  1.2307 -		     !edges_done) {
  1.2308 -	    if (_edges_caption.empty() || _edges_caption == caption) {
  1.2309 -	      readEdges();
  1.2310 -	      edges_done = true;
  1.2311 -	    }
  1.2312 -	  } else if (section == "attributes" && !attributes_done) {
  1.2313 -	    if (_attributes_caption.empty() || _attributes_caption == caption) {
  1.2314 -	      readAttributes();
  1.2315 -	      attributes_done = true;
  1.2316 -	    }
  1.2317 -	  } else {
  1.2318 -	    readLine();
  1.2319 -	    skipSection();
  1.2320 -	  }
  1.2321 -	} catch (DataFormatError& error) {
  1.2322 -	  error.line(line_num);
  1.2323 -	  throw;
  1.2324 -	}	
  1.2325 +        try {
  1.2326 +          char c;
  1.2327 +          std::string section, caption;
  1.2328 +          line >> c;
  1.2329 +          _reader_bits::readToken(line, section);
  1.2330 +          _reader_bits::readToken(line, caption);
  1.2331 +
  1.2332 +          if (line >> c)
  1.2333 +            throw DataFormatError("Extra character on the end of line");
  1.2334 +
  1.2335 +          if (section == "nodes" && !nodes_done) {
  1.2336 +            if (_nodes_caption.empty() || _nodes_caption == caption) {
  1.2337 +              readNodes();
  1.2338 +              nodes_done = true;
  1.2339 +            }
  1.2340 +          } else if ((section == "edges" || section == "arcs") &&
  1.2341 +                     !edges_done) {
  1.2342 +            if (_edges_caption.empty() || _edges_caption == caption) {
  1.2343 +              readEdges();
  1.2344 +              edges_done = true;
  1.2345 +            }
  1.2346 +          } else if (section == "attributes" && !attributes_done) {
  1.2347 +            if (_attributes_caption.empty() || _attributes_caption == caption) {
  1.2348 +              readAttributes();
  1.2349 +              attributes_done = true;
  1.2350 +            }
  1.2351 +          } else {
  1.2352 +            readLine();
  1.2353 +            skipSection();
  1.2354 +          }
  1.2355 +        } catch (DataFormatError& error) {
  1.2356 +          error.line(line_num);
  1.2357 +          throw;
  1.2358 +        }
  1.2359        }
  1.2360  
  1.2361        if (!nodes_done) {
  1.2362 -	throw DataFormatError("Section @nodes not found");
  1.2363 +        throw DataFormatError("Section @nodes not found");
  1.2364        }
  1.2365  
  1.2366        if (!edges_done) {
  1.2367 -	throw DataFormatError("Section @edges not found");
  1.2368 +        throw DataFormatError("Section @edges not found");
  1.2369        }
  1.2370  
  1.2371        if (!attributes_done && !_attributes.empty()) {
  1.2372 -	throw DataFormatError("Section @attributes not found");
  1.2373 +        throw DataFormatError("Section @attributes not found");
  1.2374        }
  1.2375  
  1.2376      }
  1.2377  
  1.2378      /// @}
  1.2379 -    
  1.2380 +
  1.2381    };
  1.2382  
  1.2383    /// \brief Return a \ref GraphReader class
  1.2384 -  /// 
  1.2385 +  ///
  1.2386    /// This function just returns a \ref GraphReader class.
  1.2387    /// \relates GraphReader
  1.2388    template <typename Graph>
  1.2389 @@ -2011,18 +2011,18 @@
  1.2390    }
  1.2391  
  1.2392    /// \brief Return a \ref GraphReader class
  1.2393 -  /// 
  1.2394 +  ///
  1.2395    /// This function just returns a \ref GraphReader class.
  1.2396    /// \relates GraphReader
  1.2397    template <typename Graph>
  1.2398 -  GraphReader<Graph> graphReader(const std::string& fn, 
  1.2399 -				       Graph& graph) {
  1.2400 +  GraphReader<Graph> graphReader(const std::string& fn,
  1.2401 +                                       Graph& graph) {
  1.2402      GraphReader<Graph> tmp(fn, graph);
  1.2403      return tmp;
  1.2404    }
  1.2405  
  1.2406    /// \brief Return a \ref GraphReader class
  1.2407 -  /// 
  1.2408 +  ///
  1.2409    /// This function just returns a \ref GraphReader class.
  1.2410    /// \relates GraphReader
  1.2411    template <typename Graph>
  1.2412 @@ -2036,21 +2036,21 @@
  1.2413    SectionReader sectionReader(std::istream& is);
  1.2414    SectionReader sectionReader(const std::string& fn);
  1.2415    SectionReader sectionReader(const char* fn);
  1.2416 -  
  1.2417 +
  1.2418    /// \ingroup lemon_io
  1.2419    ///
  1.2420    /// \brief Section reader class
  1.2421    ///
  1.2422 -  /// In the \ref lgf-format "LGF" file extra sections can be placed, 
  1.2423 +  /// In the \ref lgf-format "LGF" file extra sections can be placed,
  1.2424    /// which contain any data in arbitrary format. Such sections can be
  1.2425 -  /// read with this class. A reading rule can be added to the class 
  1.2426 +  /// read with this class. A reading rule can be added to the class
  1.2427    /// with two different functions. With the \c sectionLines() function a
  1.2428    /// functor can process the section line-by-line, while with the \c
  1.2429    /// sectionStream() member the section can be read from an input
  1.2430    /// stream.
  1.2431    class SectionReader {
  1.2432    private:
  1.2433 -    
  1.2434 +
  1.2435      std::istream* _is;
  1.2436      bool local_is;
  1.2437  
  1.2438 @@ -2066,30 +2066,30 @@
  1.2439      ///
  1.2440      /// Construct a section reader, which reads from the given input
  1.2441      /// stream.
  1.2442 -    SectionReader(std::istream& is) 
  1.2443 +    SectionReader(std::istream& is)
  1.2444        : _is(&is), local_is(false) {}
  1.2445  
  1.2446      /// \brief Constructor
  1.2447      ///
  1.2448      /// Construct a section reader, which reads from the given file.
  1.2449 -    SectionReader(const std::string& fn) 
  1.2450 +    SectionReader(const std::string& fn)
  1.2451        : _is(new std::ifstream(fn.c_str())), local_is(true) {}
  1.2452 -    
  1.2453 +
  1.2454      /// \brief Constructor
  1.2455      ///
  1.2456      /// Construct a section reader, which reads from the given file.
  1.2457 -    SectionReader(const char* fn) 
  1.2458 +    SectionReader(const char* fn)
  1.2459        : _is(new std::ifstream(fn)), local_is(true) {}
  1.2460  
  1.2461      /// \brief Destructor
  1.2462      ~SectionReader() {
  1.2463 -      for (Sections::iterator it = _sections.begin(); 
  1.2464 -	   it != _sections.end(); ++it) {
  1.2465 -	delete it->second;
  1.2466 +      for (Sections::iterator it = _sections.begin();
  1.2467 +           it != _sections.end(); ++it) {
  1.2468 +        delete it->second;
  1.2469        }
  1.2470  
  1.2471        if (local_is) {
  1.2472 -	delete _is;
  1.2473 +        delete _is;
  1.2474        }
  1.2475  
  1.2476      }
  1.2477 @@ -2100,15 +2100,15 @@
  1.2478      friend SectionReader sectionReader(const std::string& fn);
  1.2479      friend SectionReader sectionReader(const char* fn);
  1.2480  
  1.2481 -    SectionReader(SectionReader& other) 
  1.2482 +    SectionReader(SectionReader& other)
  1.2483        : _is(other._is), local_is(other.local_is) {
  1.2484  
  1.2485        other._is = 0;
  1.2486        other.local_is = false;
  1.2487 -      
  1.2488 +
  1.2489        _sections.swap(other._sections);
  1.2490      }
  1.2491 -    
  1.2492 +
  1.2493      SectionReader& operator=(const SectionReader&);
  1.2494  
  1.2495    public:
  1.2496 @@ -2148,14 +2148,14 @@
  1.2497      ///
  1.2498      ///  // ...
  1.2499      ///
  1.2500 -    ///  reader.sectionLines("numbers", NumberSection(vec));  
  1.2501 +    ///  reader.sectionLines("numbers", NumberSection(vec));
  1.2502      ///\endcode
  1.2503      template <typename Functor>
  1.2504      SectionReader& sectionLines(const std::string& type, Functor functor) {
  1.2505        LEMON_ASSERT(!type.empty(), "Type is empty.");
  1.2506 -      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
  1.2507 -		   "Multiple reading of section.");
  1.2508 -      _sections.insert(std::make_pair(type, 
  1.2509 +      LEMON_ASSERT(_sections.find(type) == _sections.end(),
  1.2510 +                   "Multiple reading of section.");
  1.2511 +      _sections.insert(std::make_pair(type,
  1.2512          new _reader_bits::LineSection<Functor>(functor)));
  1.2513        return *this;
  1.2514      }
  1.2515 @@ -2171,13 +2171,13 @@
  1.2516      template <typename Functor>
  1.2517      SectionReader& sectionStream(const std::string& type, Functor functor) {
  1.2518        LEMON_ASSERT(!type.empty(), "Type is empty.");
  1.2519 -      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
  1.2520 -		   "Multiple reading of section.");
  1.2521 -      _sections.insert(std::make_pair(type, 
  1.2522 -	 new _reader_bits::StreamSection<Functor>(functor)));
  1.2523 +      LEMON_ASSERT(_sections.find(type) == _sections.end(),
  1.2524 +                   "Multiple reading of section.");
  1.2525 +      _sections.insert(std::make_pair(type,
  1.2526 +         new _reader_bits::StreamSection<Functor>(functor)));
  1.2527        return *this;
  1.2528 -    }    
  1.2529 -    
  1.2530 +    }
  1.2531 +
  1.2532      /// @}
  1.2533  
  1.2534    private:
  1.2535 @@ -2185,12 +2185,12 @@
  1.2536      bool readLine() {
  1.2537        std::string str;
  1.2538        while(++line_num, std::getline(*_is, str)) {
  1.2539 -	line.clear(); line.str(str);
  1.2540 -	char c;
  1.2541 -	if (line >> std::ws >> c && c != '#') {
  1.2542 -	  line.putback(c);
  1.2543 -	  return true;
  1.2544 -	}
  1.2545 +        line.clear(); line.str(str);
  1.2546 +        char c;
  1.2547 +        if (line >> std::ws >> c && c != '#') {
  1.2548 +          line.putback(c);
  1.2549 +          return true;
  1.2550 +        }
  1.2551        }
  1.2552        return false;
  1.2553      }
  1.2554 @@ -2198,11 +2198,11 @@
  1.2555      bool readSuccess() {
  1.2556        return static_cast<bool>(*_is);
  1.2557      }
  1.2558 -    
  1.2559 +
  1.2560      void skipSection() {
  1.2561        char c;
  1.2562        while (readSuccess() && line >> c && c != '@') {
  1.2563 -	readLine();
  1.2564 +        readLine();
  1.2565        }
  1.2566        line.putback(c);
  1.2567      }
  1.2568 @@ -2210,66 +2210,66 @@
  1.2569    public:
  1.2570  
  1.2571  
  1.2572 -    /// \name Execution of the reader    
  1.2573 +    /// \name Execution of the reader
  1.2574      /// @{
  1.2575  
  1.2576      /// \brief Start the batch processing
  1.2577      ///
  1.2578      /// This function starts the batch processing.
  1.2579      void run() {
  1.2580 -      
  1.2581 +
  1.2582        LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
  1.2583 -      
  1.2584 +
  1.2585        std::set<std::string> extra_sections;
  1.2586  
  1.2587 -      line_num = 0;      
  1.2588 +      line_num = 0;
  1.2589        readLine();
  1.2590        skipSection();
  1.2591  
  1.2592        while (readSuccess()) {
  1.2593 -	try {
  1.2594 -	  char c;
  1.2595 -	  std::string section, caption;
  1.2596 -	  line >> c;
  1.2597 -	  _reader_bits::readToken(line, section);
  1.2598 -	  _reader_bits::readToken(line, caption);
  1.2599 -
  1.2600 -	  if (line >> c) 
  1.2601 -	    throw DataFormatError("Extra character on the end of line");
  1.2602 -
  1.2603 -	  if (extra_sections.find(section) != extra_sections.end()) {
  1.2604 -	    std::ostringstream msg;
  1.2605 -	    msg << "Multiple occurence of section " << section;
  1.2606 -	    throw DataFormatError(msg.str().c_str());
  1.2607 -	  }
  1.2608 -	  Sections::iterator it = _sections.find(section);
  1.2609 -	  if (it != _sections.end()) {
  1.2610 -	    extra_sections.insert(section);
  1.2611 -	    it->second->process(*_is, line_num);
  1.2612 -	  }
  1.2613 -	  readLine();
  1.2614 -	  skipSection();
  1.2615 -	} catch (DataFormatError& error) {
  1.2616 -	  error.line(line_num);
  1.2617 -	  throw;
  1.2618 -	}	
  1.2619 +        try {
  1.2620 +          char c;
  1.2621 +          std::string section, caption;
  1.2622 +          line >> c;
  1.2623 +          _reader_bits::readToken(line, section);
  1.2624 +          _reader_bits::readToken(line, caption);
  1.2625 +
  1.2626 +          if (line >> c)
  1.2627 +            throw DataFormatError("Extra character on the end of line");
  1.2628 +
  1.2629 +          if (extra_sections.find(section) != extra_sections.end()) {
  1.2630 +            std::ostringstream msg;
  1.2631 +            msg << "Multiple occurence of section " << section;
  1.2632 +            throw DataFormatError(msg.str().c_str());
  1.2633 +          }
  1.2634 +          Sections::iterator it = _sections.find(section);
  1.2635 +          if (it != _sections.end()) {
  1.2636 +            extra_sections.insert(section);
  1.2637 +            it->second->process(*_is, line_num);
  1.2638 +          }
  1.2639 +          readLine();
  1.2640 +          skipSection();
  1.2641 +        } catch (DataFormatError& error) {
  1.2642 +          error.line(line_num);
  1.2643 +          throw;
  1.2644 +        }
  1.2645        }
  1.2646        for (Sections::iterator it = _sections.begin();
  1.2647 -	   it != _sections.end(); ++it) {
  1.2648 -	if (extra_sections.find(it->first) == extra_sections.end()) {
  1.2649 -	  std::ostringstream os;
  1.2650 -	  os << "Cannot find section: " << it->first;
  1.2651 -	  throw DataFormatError(os.str().c_str());
  1.2652 -	}
  1.2653 +           it != _sections.end(); ++it) {
  1.2654 +        if (extra_sections.find(it->first) == extra_sections.end()) {
  1.2655 +          std::ostringstream os;
  1.2656 +          os << "Cannot find section: " << it->first;
  1.2657 +          throw DataFormatError(os.str().c_str());
  1.2658 +        }
  1.2659        }
  1.2660      }
  1.2661  
  1.2662      /// @}
  1.2663 -        
  1.2664 +
  1.2665    };
  1.2666  
  1.2667    /// \brief Return a \ref SectionReader class
  1.2668 -  /// 
  1.2669 +  ///
  1.2670    /// This function just returns a \ref SectionReader class.
  1.2671    /// \relates SectionReader
  1.2672    inline SectionReader sectionReader(std::istream& is) {
  1.2673 @@ -2278,7 +2278,7 @@
  1.2674    }
  1.2675  
  1.2676    /// \brief Return a \ref SectionReader class
  1.2677 -  /// 
  1.2678 +  ///
  1.2679    /// This function just returns a \ref SectionReader class.
  1.2680    /// \relates SectionReader
  1.2681    inline SectionReader sectionReader(const std::string& fn) {
  1.2682 @@ -2287,7 +2287,7 @@
  1.2683    }
  1.2684  
  1.2685    /// \brief Return a \ref SectionReader class
  1.2686 -  /// 
  1.2687 +  ///
  1.2688    /// This function just returns a \ref SectionReader class.
  1.2689    /// \relates SectionReader
  1.2690    inline SectionReader sectionReader(const char* fn) {
  1.2691 @@ -2297,7 +2297,7 @@
  1.2692  
  1.2693    /// \ingroup lemon_io
  1.2694    ///
  1.2695 -  /// \brief Reader for the contents of the \ref lgf-format "LGF" file 
  1.2696 +  /// \brief Reader for the contents of the \ref lgf-format "LGF" file
  1.2697    ///
  1.2698    /// This class can be used to read the sections, the map names and
  1.2699    /// the attributes from a file. Usually, the Lemon programs know
  1.2700 @@ -2307,8 +2307,8 @@
  1.2701    /// reads the graph and stores the appropriate information for
  1.2702    /// reading the graph.
  1.2703    ///
  1.2704 -  ///\code 
  1.2705 -  /// LgfContents contents("graph.lgf"); 
  1.2706 +  ///\code
  1.2707 +  /// LgfContents contents("graph.lgf");
  1.2708    /// contents.run();
  1.2709    ///
  1.2710    /// // Does it contain any node section and arc section?
  1.2711 @@ -2316,14 +2316,14 @@
  1.2712    ///   std::cerr << "Failure, cannot find graph." << std::endl;
  1.2713    ///   return -1;
  1.2714    /// }
  1.2715 -  /// std::cout << "The name of the default node section: " 
  1.2716 +  /// std::cout << "The name of the default node section: "
  1.2717    ///           << contents.nodeSection(0) << std::endl;
  1.2718 -  /// std::cout << "The number of the arc maps: " 
  1.2719 +  /// std::cout << "The number of the arc maps: "
  1.2720    ///           << contents.arcMaps(0).size() << std::endl;
  1.2721 -  /// std::cout << "The name of second arc map: " 
  1.2722 +  /// std::cout << "The name of second arc map: "
  1.2723    ///           << contents.arcMaps(0)[1] << std::endl;
  1.2724    ///\endcode
  1.2725 -  class LgfContents {    
  1.2726 +  class LgfContents {
  1.2727    private:
  1.2728  
  1.2729      std::istream* _is;
  1.2730 @@ -2344,21 +2344,21 @@
  1.2731  
  1.2732      int line_num;
  1.2733      std::istringstream line;
  1.2734 -    
  1.2735 +
  1.2736    public:
  1.2737  
  1.2738      /// \brief Constructor
  1.2739      ///
  1.2740      /// Construct an \e LGF contents reader, which reads from the given
  1.2741      /// input stream.
  1.2742 -    LgfContents(std::istream& is) 
  1.2743 +    LgfContents(std::istream& is)
  1.2744        : _is(&is), local_is(false) {}
  1.2745  
  1.2746      /// \brief Constructor
  1.2747      ///
  1.2748      /// Construct an \e LGF contents reader, which reads from the given
  1.2749      /// file.
  1.2750 -    LgfContents(const std::string& fn) 
  1.2751 +    LgfContents(const std::string& fn)
  1.2752        : _is(new std::ifstream(fn.c_str())), local_is(true) {}
  1.2753  
  1.2754      /// \brief Constructor
  1.2755 @@ -2367,14 +2367,14 @@
  1.2756      /// file.
  1.2757      LgfContents(const char* fn)
  1.2758        : _is(new std::ifstream(fn)), local_is(true) {}
  1.2759 -    
  1.2760 +
  1.2761      /// \brief Destructor
  1.2762      ~LgfContents() {
  1.2763        if (local_is) delete _is;
  1.2764      }
  1.2765  
  1.2766    private:
  1.2767 -    
  1.2768 +
  1.2769      LgfContents(const LgfContents&);
  1.2770      LgfContents& operator=(const LgfContents&);
  1.2771  
  1.2772 @@ -2391,9 +2391,9 @@
  1.2773        return _node_sections.size();
  1.2774      }
  1.2775  
  1.2776 -    /// \brief Returns the node section name at the given position. 
  1.2777 +    /// \brief Returns the node section name at the given position.
  1.2778      ///
  1.2779 -    /// Returns the node section name at the given position. 
  1.2780 +    /// Returns the node section name at the given position.
  1.2781      const std::string& nodeSection(int i) const {
  1.2782        return _node_sections[i];
  1.2783      }
  1.2784 @@ -2407,7 +2407,7 @@
  1.2785  
  1.2786      /// @}
  1.2787  
  1.2788 -    /// \name Arc/Edge sections 
  1.2789 +    /// \name Arc/Edge sections
  1.2790      /// @{
  1.2791  
  1.2792      /// \brief Gives back the number of arc/edge sections in the file.
  1.2793 @@ -2418,9 +2418,9 @@
  1.2794        return _edge_sections.size();
  1.2795      }
  1.2796  
  1.2797 -    /// \brief Returns the arc/edge section name at the given position. 
  1.2798 +    /// \brief Returns the arc/edge section name at the given position.
  1.2799      ///
  1.2800 -    /// Returns the arc/edge section name at the given position. 
  1.2801 +    /// Returns the arc/edge section name at the given position.
  1.2802      /// \note It is synonym of \c edgeSection().
  1.2803      const std::string& arcSection(int i) const {
  1.2804        return _edge_sections[i];
  1.2805 @@ -2447,9 +2447,9 @@
  1.2806        return _edge_sections.size();
  1.2807      }
  1.2808  
  1.2809 -    /// \brief Returns the section name at the given position. 
  1.2810 +    /// \brief Returns the section name at the given position.
  1.2811      ///
  1.2812 -    /// Returns the section name at the given position. 
  1.2813 +    /// Returns the section name at the given position.
  1.2814      /// \note It is synonym of \c arcSection().
  1.2815      const std::string& edgeSection(int i) const {
  1.2816        return _edge_sections[i];
  1.2817 @@ -2465,7 +2465,7 @@
  1.2818  
  1.2819      /// @}
  1.2820  
  1.2821 -    /// \name Attribute sections   
  1.2822 +    /// \name Attribute sections
  1.2823      /// @{
  1.2824  
  1.2825      /// \brief Gives back the number of attribute sections in the file.
  1.2826 @@ -2475,9 +2475,9 @@
  1.2827        return _attribute_sections.size();
  1.2828      }
  1.2829  
  1.2830 -    /// \brief Returns the attribute section name at the given position. 
  1.2831 +    /// \brief Returns the attribute section name at the given position.
  1.2832      ///
  1.2833 -    /// Returns the attribute section name at the given position. 
  1.2834 +    /// Returns the attribute section name at the given position.
  1.2835      const std::string& attributeSectionNames(int i) const {
  1.2836        return _attribute_sections[i];
  1.2837      }
  1.2838 @@ -2491,7 +2491,7 @@
  1.2839  
  1.2840      /// @}
  1.2841  
  1.2842 -    /// \name Extra sections   
  1.2843 +    /// \name Extra sections
  1.2844      /// @{
  1.2845  
  1.2846      /// \brief Gives back the number of extra sections in the file.
  1.2847 @@ -2501,9 +2501,9 @@
  1.2848        return _extra_sections.size();
  1.2849      }
  1.2850  
  1.2851 -    /// \brief Returns the extra section type at the given position. 
  1.2852 +    /// \brief Returns the extra section type at the given position.
  1.2853      ///
  1.2854 -    /// Returns the section type at the given position. 
  1.2855 +    /// Returns the section type at the given position.
  1.2856      const std::string& extraSection(int i) const {
  1.2857        return _extra_sections[i];
  1.2858      }
  1.2859 @@ -2515,12 +2515,12 @@
  1.2860      bool readLine() {
  1.2861        std::string str;
  1.2862        while(++line_num, std::getline(*_is, str)) {
  1.2863 -	line.clear(); line.str(str);
  1.2864 -	char c;
  1.2865 -	if (line >> std::ws >> c && c != '#') {
  1.2866 -	  line.putback(c);
  1.2867 -	  return true;
  1.2868 -	}
  1.2869 +        line.clear(); line.str(str);
  1.2870 +        char c;
  1.2871 +        if (line >> std::ws >> c && c != '#') {
  1.2872 +          line.putback(c);
  1.2873 +          return true;
  1.2874 +        }
  1.2875        }
  1.2876        return false;
  1.2877      }
  1.2878 @@ -2532,7 +2532,7 @@
  1.2879      void skipSection() {
  1.2880        char c;
  1.2881        while (readSuccess() && line >> c && c != '@') {
  1.2882 -	readLine();
  1.2883 +        readLine();
  1.2884        }
  1.2885        line.putback(c);
  1.2886      }
  1.2887 @@ -2540,13 +2540,13 @@
  1.2888      void readMaps(std::vector<std::string>& maps) {
  1.2889        char c;
  1.2890        if (!readLine() || !(line >> c) || c == '@') {
  1.2891 -	if (readSuccess() && line) line.putback(c);
  1.2892 -	return;
  1.2893 +        if (readSuccess() && line) line.putback(c);
  1.2894 +        return;
  1.2895        }
  1.2896        line.putback(c);
  1.2897        std::string map;
  1.2898        while (_reader_bits::readToken(line, map)) {
  1.2899 -	maps.push_back(map);
  1.2900 +        maps.push_back(map);
  1.2901        }
  1.2902      }
  1.2903  
  1.2904 @@ -2554,18 +2554,18 @@
  1.2905        readLine();
  1.2906        char c;
  1.2907        while (readSuccess() && line >> c && c != '@') {
  1.2908 -	line.putback(c);
  1.2909 -	std::string attr;
  1.2910 -	_reader_bits::readToken(line, attr);
  1.2911 -	attrs.push_back(attr);
  1.2912 -	readLine();
  1.2913 +        line.putback(c);
  1.2914 +        std::string attr;
  1.2915 +        _reader_bits::readToken(line, attr);
  1.2916 +        attrs.push_back(attr);
  1.2917 +        readLine();
  1.2918        }
  1.2919        line.putback(c);
  1.2920      }
  1.2921  
  1.2922    public:
  1.2923  
  1.2924 -    /// \name Execution of the contents reader    
  1.2925 +    /// \name Execution of the contents reader
  1.2926      /// @{
  1.2927  
  1.2928      /// \brief Starts the reading
  1.2929 @@ -2578,37 +2578,37 @@
  1.2930  
  1.2931        while (readSuccess()) {
  1.2932  
  1.2933 -	char c;
  1.2934 -	line >> c;
  1.2935 -
  1.2936 -	std::string section, caption;
  1.2937 -	_reader_bits::readToken(line, section);
  1.2938 -	_reader_bits::readToken(line, caption);
  1.2939 -
  1.2940 -	if (section == "nodes") {
  1.2941 -	  _node_sections.push_back(caption);
  1.2942 -	  _node_maps.push_back(std::vector<std::string>());
  1.2943 -	  readMaps(_node_maps.back());
  1.2944 -	  readLine(); skipSection();
  1.2945 -	} else if (section == "arcs" || section == "edges") {
  1.2946 -	  _edge_sections.push_back(caption);
  1.2947 -	  _arc_sections.push_back(section == "arcs");
  1.2948 -	  _edge_maps.push_back(std::vector<std::string>());
  1.2949 -	  readMaps(_edge_maps.back());
  1.2950 -	  readLine(); skipSection();
  1.2951 -	} else if (section == "attributes") {
  1.2952 -	  _attribute_sections.push_back(caption);
  1.2953 -	  _attributes.push_back(std::vector<std::string>());
  1.2954 -	  readAttributes(_attributes.back());
  1.2955 -	} else {
  1.2956 -	  _extra_sections.push_back(section);
  1.2957 -	  readLine(); skipSection();
  1.2958 -	}
  1.2959 +        char c;
  1.2960 +        line >> c;
  1.2961 +
  1.2962 +        std::string section, caption;
  1.2963 +        _reader_bits::readToken(line, section);
  1.2964 +        _reader_bits::readToken(line, caption);
  1.2965 +
  1.2966 +        if (section == "nodes") {
  1.2967 +          _node_sections.push_back(caption);
  1.2968 +          _node_maps.push_back(std::vector<std::string>());
  1.2969 +          readMaps(_node_maps.back());
  1.2970 +          readLine(); skipSection();
  1.2971 +        } else if (section == "arcs" || section == "edges") {
  1.2972 +          _edge_sections.push_back(caption);
  1.2973 +          _arc_sections.push_back(section == "arcs");
  1.2974 +          _edge_maps.push_back(std::vector<std::string>());
  1.2975 +          readMaps(_edge_maps.back());
  1.2976 +          readLine(); skipSection();
  1.2977 +        } else if (section == "attributes") {
  1.2978 +          _attribute_sections.push_back(caption);
  1.2979 +          _attributes.push_back(std::vector<std::string>());
  1.2980 +          readAttributes(_attributes.back());
  1.2981 +        } else {
  1.2982 +          _extra_sections.push_back(section);
  1.2983 +          readLine(); skipSection();
  1.2984 +        }
  1.2985        }
  1.2986      }
  1.2987  
  1.2988      /// @}
  1.2989 -    
  1.2990 +
  1.2991    };
  1.2992  }
  1.2993