Changeset 291:d901321d6555 in lemon-1.2 for lemon/lgf_reader.h
- Timestamp:
- 10/01/08 11:58:03 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lgf_reader.h
r290 r291 517 517 _use_nodes(false), _use_arcs(false), 518 518 _skip_nodes(false), _skip_arcs(false) { 519 if (!(*_is)) throw IoError( fn, "Cannot open file");519 if (!(*_is)) throw IoError("Cannot open file", fn); 520 520 } 521 521 … … 529 529 _use_nodes(false), _use_arcs(false), 530 530 _skip_nodes(false), _skip_arcs(false) { 531 if (!(*_is)) throw IoError( fn, "Cannot open file");531 if (!(*_is)) throw IoError("Cannot open file", fn); 532 532 } 533 533 … … 880 880 if (jt == maps.end()) { 881 881 std::ostringstream msg; 882 msg << "Map not found in file: " << _node_maps[i].first;882 msg << "Map not found: " << _node_maps[i].first; 883 883 throw FormatError(msg.str()); 884 884 } … … 909 909 } 910 910 if (line >> std::ws >> c) 911 throw FormatError("Extra character onthe end of line");911 throw FormatError("Extra character at the end of line"); 912 912 913 913 Node n; … … 918 918 } else { 919 919 if (label_index == -1) 920 throw FormatError("Label map not found in file");920 throw FormatError("Label map not found"); 921 921 typename std::map<std::string, Node>::iterator it = 922 922 _node_index.find(tokens[label_index]); … … 973 973 if (jt == maps.end()) { 974 974 std::ostringstream msg; 975 msg << "Map not found in file: " << _arc_maps[i].first;975 msg << "Map not found: " << _arc_maps[i].first; 976 976 throw FormatError(msg.str()); 977 977 } … … 1011 1011 } 1012 1012 if (line >> std::ws >> c) 1013 throw FormatError("Extra character onthe end of line");1013 throw FormatError("Extra character at the end of line"); 1014 1014 1015 1015 Arc a; … … 1039 1039 } else { 1040 1040 if (label_index == -1) 1041 throw FormatError("Label map not found in file");1041 throw FormatError("Label map not found"); 1042 1042 typename std::map<std::string, Arc>::iterator it = 1043 1043 _arc_index.find(tokens[label_index]); … … 1074 1074 throw FormatError("Attribute value not found"); 1075 1075 if (line >> c) 1076 throw FormatError("Extra character onthe end of line");1076 throw FormatError("Extra character at the end of line"); 1077 1077 1078 1078 { … … 1080 1080 if (it != read_attr.end()) { 1081 1081 std::ostringstream msg; 1082 msg << "Multiple occurence of attribute " << attr;1082 msg << "Multiple occurence of attribute: " << attr; 1083 1083 throw FormatError(msg.str()); 1084 1084 } … … 1102 1102 if (read_attr.find(it->first) == read_attr.end()) { 1103 1103 std::ostringstream msg; 1104 msg << "Attribute not found in file: " << it->first;1104 msg << "Attribute not found: " << it->first; 1105 1105 throw FormatError(msg.str()); 1106 1106 } … … 1118 1118 void run() { 1119 1119 LEMON_ASSERT(_is != 0, "This reader assigned to an other reader"); 1120 if (!*_is) {1121 throw FormatError("Cannot find file");1122 }1123 1120 1124 1121 bool nodes_done = _skip_nodes; … … 1139 1136 1140 1137 if (line >> c) 1141 throw FormatError("Extra character onthe end of line");1138 throw FormatError("Extra character at the end of line"); 1142 1139 1143 1140 if (section == "nodes" && !nodes_done) { … … 1309 1306 _use_nodes(false), _use_edges(false), 1310 1307 _skip_nodes(false), _skip_edges(false) { 1311 if (!(*_is)) throw IoError( fn, "Cannot open file");1308 if (!(*_is)) throw IoError("Cannot open file", fn); 1312 1309 } 1313 1310 … … 1321 1318 _use_nodes(false), _use_edges(false), 1322 1319 _skip_nodes(false), _skip_edges(false) { 1323 if (!(*_is)) throw IoError( fn, "Cannot open file");1320 if (!(*_is)) throw IoError("Cannot open file", fn); 1324 1321 } 1325 1322 … … 1716 1713 if (jt == maps.end()) { 1717 1714 std::ostringstream msg; 1718 msg << "Map not found in file: " << _node_maps[i].first;1715 msg << "Map not found: " << _node_maps[i].first; 1719 1716 throw FormatError(msg.str()); 1720 1717 } … … 1745 1742 } 1746 1743 if (line >> std::ws >> c) 1747 throw FormatError("Extra character onthe end of line");1744 throw FormatError("Extra character at the end of line"); 1748 1745 1749 1746 Node n; … … 1754 1751 } else { 1755 1752 if (label_index == -1) 1756 throw FormatError("Label map not found in file");1753 throw FormatError("Label map not found"); 1757 1754 typename std::map<std::string, Node>::iterator it = 1758 1755 _node_index.find(tokens[label_index]); … … 1809 1806 if (jt == maps.end()) { 1810 1807 std::ostringstream msg; 1811 msg << "Map not found in file: " << _edge_maps[i].first;1808 msg << "Map not found: " << _edge_maps[i].first; 1812 1809 throw FormatError(msg.str()); 1813 1810 } … … 1847 1844 } 1848 1845 if (line >> std::ws >> c) 1849 throw FormatError("Extra character onthe end of line");1846 throw FormatError("Extra character at the end of line"); 1850 1847 1851 1848 Edge e; … … 1875 1872 } else { 1876 1873 if (label_index == -1) 1877 throw FormatError("Label map not found in file");1874 throw FormatError("Label map not found"); 1878 1875 typename std::map<std::string, Edge>::iterator it = 1879 1876 _edge_index.find(tokens[label_index]); … … 1910 1907 throw FormatError("Attribute value not found"); 1911 1908 if (line >> c) 1912 throw FormatError("Extra character onthe end of line");1909 throw FormatError("Extra character at the end of line"); 1913 1910 1914 1911 { … … 1916 1913 if (it != read_attr.end()) { 1917 1914 std::ostringstream msg; 1918 msg << "Multiple occurence of attribute " << attr;1915 msg << "Multiple occurence of attribute: " << attr; 1919 1916 throw FormatError(msg.str()); 1920 1917 } … … 1938 1935 if (read_attr.find(it->first) == read_attr.end()) { 1939 1936 std::ostringstream msg; 1940 msg << "Attribute not found in file: " << it->first;1937 msg << "Attribute not found: " << it->first; 1941 1938 throw FormatError(msg.str()); 1942 1939 } … … 1973 1970 1974 1971 if (line >> c) 1975 throw FormatError("Extra character onthe end of line");1972 throw FormatError("Extra character at the end of line"); 1976 1973 1977 1974 if (section == "nodes" && !nodes_done) { … … 2096 2093 : _is(new std::ifstream(fn.c_str())), local_is(true), 2097 2094 _filename(fn) { 2098 if (!(*_is)) throw IoError( fn, "Cannot open file");2095 if (!(*_is)) throw IoError("Cannot open file", fn); 2099 2096 } 2100 2097 … … 2105 2102 : _is(new std::ifstream(fn)), local_is(true), 2106 2103 _filename(fn) { 2107 if (!(*_is)) throw IoError( fn, "Cannot open file");2104 if (!(*_is)) throw IoError("Cannot open file", fn); 2108 2105 } 2109 2106 … … 2262 2259 2263 2260 if (line >> c) 2264 throw FormatError("Extra character onthe end of line");2261 throw FormatError("Extra character at the end of line"); 2265 2262 2266 2263 if (extra_sections.find(section) != extra_sections.end()) { 2267 2264 std::ostringstream msg; 2268 msg << "Multiple occurence of section " << section;2265 msg << "Multiple occurence of section: " << section; 2269 2266 throw FormatError(msg.str()); 2270 2267 } … … 2388 2385 LgfContents(const std::string& fn) 2389 2386 : _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); 2391 2388 } 2392 2389 … … 2397 2394 LgfContents(const char* fn) 2398 2395 : _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); 2400 2397 } 2401 2398
Note: See TracChangeset
for help on using the changeset viewer.