COIN-OR::LEMON - Graph Library

Changeset 291:d901321d6555 in lemon for lemon/lgf_reader.h


Ignore:
Timestamp:
10/01/08 11:58:03 (16 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Changing parameter order in exception classes + improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lgf_reader.h

    r290 r291  
    517517        _use_nodes(false), _use_arcs(false),
    518518        _skip_nodes(false), _skip_arcs(false) {
    519       if (!(*_is)) throw IoError(fn, "Cannot open file");
     519      if (!(*_is)) throw IoError("Cannot open file", fn);
    520520    }
    521521
     
    529529        _use_nodes(false), _use_arcs(false),
    530530        _skip_nodes(false), _skip_arcs(false) {
    531       if (!(*_is)) throw IoError(fn, "Cannot open file");
     531      if (!(*_is)) throw IoError("Cannot open file", fn);
    532532    }
    533533
     
    880880          if (jt == maps.end()) {
    881881            std::ostringstream msg;
    882             msg << "Map not found in file: " << _node_maps[i].first;
     882            msg << "Map not found: " << _node_maps[i].first;
    883883            throw FormatError(msg.str());
    884884          }
     
    909909        }
    910910        if (line >> std::ws >> c)
    911           throw FormatError("Extra character on the end of line");
     911          throw FormatError("Extra character at the end of line");
    912912
    913913        Node n;
     
    918918        } else {
    919919          if (label_index == -1)
    920             throw FormatError("Label map not found in file");
     920            throw FormatError("Label map not found");
    921921          typename std::map<std::string, Node>::iterator it =
    922922            _node_index.find(tokens[label_index]);
     
    973973          if (jt == maps.end()) {
    974974            std::ostringstream msg;
    975             msg << "Map not found in file: " << _arc_maps[i].first;
     975            msg << "Map not found: " << _arc_maps[i].first;
    976976            throw FormatError(msg.str());
    977977          }
     
    10111011        }
    10121012        if (line >> std::ws >> c)
    1013           throw FormatError("Extra character on the end of line");
     1013          throw FormatError("Extra character at the end of line");
    10141014
    10151015        Arc a;
     
    10391039        } else {
    10401040          if (label_index == -1)
    1041             throw FormatError("Label map not found in file");
     1041            throw FormatError("Label map not found");
    10421042          typename std::map<std::string, Arc>::iterator it =
    10431043            _arc_index.find(tokens[label_index]);
     
    10741074          throw FormatError("Attribute value not found");
    10751075        if (line >> c)
    1076           throw FormatError("Extra character on the end of line");
     1076          throw FormatError("Extra character at the end of line");
    10771077
    10781078        {
     
    10801080          if (it != read_attr.end()) {
    10811081            std::ostringstream msg;
    1082             msg << "Multiple occurence of attribute " << attr;
     1082            msg << "Multiple occurence of attribute: " << attr;
    10831083            throw FormatError(msg.str());
    10841084          }
     
    11021102        if (read_attr.find(it->first) == read_attr.end()) {
    11031103          std::ostringstream msg;
    1104           msg << "Attribute not found in file: " << it->first;
     1104          msg << "Attribute not found: " << it->first;
    11051105          throw FormatError(msg.str());
    11061106        }
     
    11181118    void run() {
    11191119      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
    1120       if (!*_is) {
    1121         throw FormatError("Cannot find file");
    1122       }
    11231120
    11241121      bool nodes_done = _skip_nodes;
     
    11391136
    11401137          if (line >> c)
    1141             throw FormatError("Extra character on the end of line");
     1138            throw FormatError("Extra character at the end of line");
    11421139
    11431140          if (section == "nodes" && !nodes_done) {
     
    13091306        _use_nodes(false), _use_edges(false),
    13101307        _skip_nodes(false), _skip_edges(false) {
    1311       if (!(*_is)) throw IoError(fn, "Cannot open file");
     1308      if (!(*_is)) throw IoError("Cannot open file", fn);
    13121309    }
    13131310
     
    13211318        _use_nodes(false), _use_edges(false),
    13221319        _skip_nodes(false), _skip_edges(false) {
    1323       if (!(*_is)) throw IoError(fn, "Cannot open file");
     1320      if (!(*_is)) throw IoError("Cannot open file", fn);
    13241321    }
    13251322
     
    17161713          if (jt == maps.end()) {
    17171714            std::ostringstream msg;
    1718             msg << "Map not found in file: " << _node_maps[i].first;
     1715            msg << "Map not found: " << _node_maps[i].first;
    17191716            throw FormatError(msg.str());
    17201717          }
     
    17451742        }
    17461743        if (line >> std::ws >> c)
    1747           throw FormatError("Extra character on the end of line");
     1744          throw FormatError("Extra character at the end of line");
    17481745
    17491746        Node n;
     
    17541751        } else {
    17551752          if (label_index == -1)
    1756             throw FormatError("Label map not found in file");
     1753            throw FormatError("Label map not found");
    17571754          typename std::map<std::string, Node>::iterator it =
    17581755            _node_index.find(tokens[label_index]);
     
    18091806          if (jt == maps.end()) {
    18101807            std::ostringstream msg;
    1811             msg << "Map not found in file: " << _edge_maps[i].first;
     1808            msg << "Map not found: " << _edge_maps[i].first;
    18121809            throw FormatError(msg.str());
    18131810          }
     
    18471844        }
    18481845        if (line >> std::ws >> c)
    1849           throw FormatError("Extra character on the end of line");
     1846          throw FormatError("Extra character at the end of line");
    18501847
    18511848        Edge e;
     
    18751872        } else {
    18761873          if (label_index == -1)
    1877             throw FormatError("Label map not found in file");
     1874            throw FormatError("Label map not found");
    18781875          typename std::map<std::string, Edge>::iterator it =
    18791876            _edge_index.find(tokens[label_index]);
     
    19101907          throw FormatError("Attribute value not found");
    19111908        if (line >> c)
    1912           throw FormatError("Extra character on the end of line");
     1909          throw FormatError("Extra character at the end of line");
    19131910
    19141911        {
     
    19161913          if (it != read_attr.end()) {
    19171914            std::ostringstream msg;
    1918             msg << "Multiple occurence of attribute " << attr;
     1915            msg << "Multiple occurence of attribute: " << attr;
    19191916            throw FormatError(msg.str());
    19201917          }
     
    19381935        if (read_attr.find(it->first) == read_attr.end()) {
    19391936          std::ostringstream msg;
    1940           msg << "Attribute not found in file: " << it->first;
     1937          msg << "Attribute not found: " << it->first;
    19411938          throw FormatError(msg.str());
    19421939        }
     
    19731970
    19741971          if (line >> c)
    1975             throw FormatError("Extra character on the end of line");
     1972            throw FormatError("Extra character at the end of line");
    19761973
    19771974          if (section == "nodes" && !nodes_done) {
     
    20962093      : _is(new std::ifstream(fn.c_str())), local_is(true),
    20972094        _filename(fn) {
    2098       if (!(*_is)) throw IoError(fn, "Cannot open file");
     2095      if (!(*_is)) throw IoError("Cannot open file", fn);
    20992096    }
    21002097
     
    21052102      : _is(new std::ifstream(fn)), local_is(true),
    21062103        _filename(fn) {
    2107       if (!(*_is)) throw IoError(fn, "Cannot open file");
     2104      if (!(*_is)) throw IoError("Cannot open file", fn);
    21082105    }
    21092106
     
    22622259
    22632260          if (line >> c)
    2264             throw FormatError("Extra character on the end of line");
     2261            throw FormatError("Extra character at the end of line");
    22652262
    22662263          if (extra_sections.find(section) != extra_sections.end()) {
    22672264            std::ostringstream msg;
    2268             msg << "Multiple occurence of section " << section;
     2265            msg << "Multiple occurence of section: " << section;
    22692266            throw FormatError(msg.str());
    22702267          }
     
    23882385    LgfContents(const std::string& fn)
    23892386      : _is(new std::ifstream(fn.c_str())), local_is(true) {
    2390       if (!(*_is)) throw IoError(fn, "Cannot open file");
     2387      if (!(*_is)) throw IoError("Cannot open file", fn);
    23912388    }
    23922389
     
    23972394    LgfContents(const char* fn)
    23982395      : _is(new std::ifstream(fn)), local_is(true) {
    2399       if (!(*_is)) throw IoError(fn, "Cannot open file");
     2396      if (!(*_is)) throw IoError("Cannot open file", fn);
    24002397    }
    24012398
Note: See TracChangeset for help on using the changeset viewer.