1.1 --- a/demo/reader_writer_demo.cc Tue Mar 27 09:23:33 2007 +0000
1.2 +++ b/demo/reader_writer_demo.cc Fri Mar 30 14:17:28 2007 +0000
1.3 @@ -39,9 +39,11 @@
1.4
1.5 try {
1.6 std::string filename="sample.lgf";
1.7 + std::string name;
1.8 GraphReader<SmartGraph> reader(filename,graph);
1.9 SmartGraph::EdgeMap<int> cap(graph);
1.10 reader.readEdgeMap("capacity",cap);
1.11 + reader.readAttribute("name",name);
1.12 reader.run();
1.13
1.14 std::cout << "Hello! We have read a graph from file " << filename<<
1.15 @@ -51,6 +53,7 @@
1.16
1.17 GraphWriter<SmartGraph> writer(std::cout, graph);
1.18 writer.writeEdgeMap("multiplicity", cap);
1.19 + writer.writeAttribute("name",name);
1.20 writer.run();
1.21
1.22 } catch (DataFormatError& error) {
2.1 --- a/demo/sample.lgf Tue Mar 27 09:23:33 2007 +0000
2.2 +++ b/demo/sample.lgf Fri Mar 30 14:17:28 2007 +0000
2.3 @@ -20,6 +20,7 @@
2.4 source 0
2.5 target 5
2.6 @edges
2.7 -@attributes
2.8 +@attributes
2.9 +name "Simple Sample Graph"
2.10 author "Attila BERNATH"
2.11 @end
3.1 --- a/lemon/lemon_reader.h Tue Mar 27 09:23:33 2007 +0000
3.2 +++ b/lemon/lemon_reader.h Fri Mar 30 14:17:28 2007 +0000
3.3 @@ -1951,16 +1951,16 @@
3.4 ///
3.5 /// Add an attribute reader command for the reader.
3.6 template <typename Value>
3.7 - AttributeReader& readAttribute(const std::string& id, Value& value) {
3.8 + AttributeReader& readAttribute(const std::string& label, Value& value) {
3.9 return readAttribute<typename Traits::template Reader<Value> >
3.10 - (id, value);
3.11 + (label, value);
3.12 }
3.13
3.14 /// \brief Add an attribute reader command for the reader.
3.15 ///
3.16 /// Add an attribute reader command for the reader.
3.17 template <typename ItemReader, typename Value>
3.18 - AttributeReader& readAttribute(std::string label, Value& value,
3.19 + AttributeReader& readAttribute(const std::string& label, Value& value,
3.20 const ItemReader& ir = ItemReader()) {
3.21 checkConcept<_reader_bits::ItemReader<Value>, ItemReader>();
3.22 if (readers.find(label) != readers.end()) {
3.23 @@ -2012,7 +2012,7 @@
3.24 }
3.25 }
3.26 }
3.27 -
3.28 +
3.29 virtual void missing() {
3.30 if (readers.empty()) return;
3.31 ErrorMessage msg;