2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-02 08:52:10 +00:00

Changed type of graph property keys to Graph* to match Graphviz reader code and test

[SVN r77341]
This commit is contained in:
Jeremiah Willcock
2012-03-15 17:39:14 +00:00
parent 908ebf506f
commit 7cddb8febf

View File

@@ -262,7 +262,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
{
std::string key_id = "key" + lexical_cast<std::string>(key_count++);
if (i->second->key() == typeid(Graph))
if (i->second->key() == typeid(Graph*))
graph_key_ids[i->first] = key_id;
else if (i->second->key() == typeid(vertex_descriptor))
vertex_key_ids[i->first] = key_id;
@@ -273,7 +273,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
std::string type_name = "string";
mpl::for_each<value_types>(get_type_name<value_types>(i->second->value(), type_names, type_name));
out << " <key id=\"" << encode_char_entities(key_id) << "\" for=\""
<< (i->second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
<< (i->second->key() == typeid(Graph*) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
<< " attr.name=\"" << i->first << "\""
<< " attr.type=\"" << type_name << "\""
<< " />\n";
@@ -287,10 +287,12 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
// Output graph data
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
{
if (i->second->key() == typeid(Graph))
if (i->second->key() == typeid(Graph*))
{
// The const_cast here is just to get typeid correct for property
// map key; the graph should not be mutated using it.
out << " <data key=\"" << graph_key_ids[i->first] << "\">"
<< encode_char_entities(i->second->get_string(g)) << "</data>\n";
<< encode_char_entities(i->second->get_string(const_cast<Graph*>(&g))) << "</data>\n";
}
}