lemon/lgf_reader.h
changeset 422 54464584b157
parent 374 afd134142111
child 423 e8afd887d706
     1.1 --- a/lemon/lgf_reader.h	Wed Sep 22 08:53:09 2010 +0200
     1.2 +++ b/lemon/lgf_reader.h	Tue Aug 02 18:13:34 2011 +0200
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2008
     1.8 + * Copyright (C) 2003-2011
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -963,6 +963,13 @@
    1.13          std::string map;
    1.14          int index = 0;
    1.15          while (_reader_bits::readToken(line, map)) {
    1.16 +          if(map == "-") {
    1.17 +              if(index!=0)
    1.18 +                throw FormatError("'-' is not allowed as a map name");
    1.19 +              else if (line >> std::ws >> c)
    1.20 +                throw FormatError("Extra character at the end of line");
    1.21 +              else break;
    1.22 +            }
    1.23            if (maps.find(map) != maps.end()) {
    1.24              std::ostringstream msg;
    1.25              msg << "Multiple occurence of arc map: " << map;
    1.26 @@ -1803,6 +1810,13 @@
    1.27          std::string map;
    1.28          int index = 0;
    1.29          while (_reader_bits::readToken(line, map)) {
    1.30 +          if(map == "-") {
    1.31 +              if(index!=0)
    1.32 +                throw FormatError("'-' is not allowed as a map name");
    1.33 +              else if (line >> std::ws >> c)
    1.34 +                throw FormatError("Extra character at the end of line");
    1.35 +              else break;
    1.36 +            }
    1.37            if (maps.find(map) != maps.end()) {
    1.38              std::ostringstream msg;
    1.39              msg << "Multiple occurence of edge map: " << map;