Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ target_link_libraries(boost_graph
Boost::integer
Boost::iterator
Boost::lexical_cast
Boost::mp11
Boost::mpl
Boost::multi_index
Boost::multiprecision
Expand Down
1 change: 1 addition & 0 deletions build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ constant boost_dependencies :
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/mp11//boost_mp11
/boost/mpl//boost_mpl
/boost/multi_index//boost_multi_index
/boost/multiprecision//boost_multiprecision
Expand Down
33 changes: 14 additions & 19 deletions include/boost/graph/graphml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dll_import_export.hpp>
#include <boost/graph/exception.hpp>
#include <boost/graph/graph_traits.hpp>

#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/property_tree/detail/xml_parser_utils.hpp>
#include <boost/throw_exception.hpp>
Expand Down Expand Up @@ -111,7 +109,7 @@ template < typename MutableGraph > class mutate_graph_impl : public mutate_graph
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< MutableGraph*, value_types >(name, m_dp, &m_g,
value, value_type, m_type_names, type_found));
}
Expand All @@ -133,7 +131,7 @@ template < typename MutableGraph > class mutate_graph_impl : public mutate_graph
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< vertex_descriptor, value_types >(name, m_dp,
any_cast< vertex_descriptor >(vertex), value, value_type,
m_type_names, type_found));
Expand All @@ -156,7 +154,7 @@ template < typename MutableGraph > class mutate_graph_impl : public mutate_graph
bool type_found = false;
try
{
mpl::for_each< value_types >(
mp11::mp_for_each< value_types >(
put_property< edge_descriptor, value_types >(name, m_dp,
any_cast< edge_descriptor >(edge), value, value_type,
m_type_names, type_found));
Expand Down Expand Up @@ -192,8 +190,7 @@ template < typename MutableGraph > class mutate_graph_impl : public mutate_graph
template < class Value > void operator()(Value)
{
if (m_value_type
== m_type_names[mpl::find< ValueVector,
Value >::type::pos::value])
== m_type_names[mp11::mp_find< ValueVector, Value >::value])
{
put(m_name, m_dp, m_key, lexical_cast< Value >(m_value));
m_type_found = true;
Expand All @@ -213,8 +210,7 @@ template < typename MutableGraph > class mutate_graph_impl : public mutate_graph
protected:
MutableGraph& m_g;
dynamic_properties& m_dp;
typedef mpl::vector< bool, int, long, float, double, std::string >
value_types;
using value_types = mp11::mp_list< bool, int, long, float, double, std::string >;
static const char* m_type_names[];
};

Expand Down Expand Up @@ -244,8 +240,7 @@ template < typename Types > class get_type_name
template < typename Type > void operator()(Type)
{
if (typeid(Type) == m_type)
m_type_name
= m_type_names[mpl::find< Types, Type >::type::pos::value];
m_type_name = m_type_names[mp11::mp_find< Types, Type >::value];
}

private:
Expand Down Expand Up @@ -275,10 +270,9 @@ void write_graphml(std::ostream& out, const Graph& g,
"xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
"http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n";

typedef mpl::vector< bool, short, unsigned short, int, unsigned int, long,
unsigned long, long long, unsigned long long, float, double,
long double, std::string >
value_types;
using value_types = mp11::mp_list< bool, short,
unsigned short, int, unsigned int, long, unsigned long, long long,
unsigned long long, float, double, long double, std::string >;
const char* type_names[] = { "boolean", "int", "int", "int", "int", "long",
"long", "long", "long", "float", "double", "double", "string" };
std::map< std::string, std::string > graph_key_ids;
Expand All @@ -299,8 +293,9 @@ void write_graphml(std::ostream& out, const Graph& g,
else
continue;
std::string type_name = "string";
mpl::for_each< value_types >(get_type_name< value_types >(
i->second->value(), type_names, type_name));
mp11::mp_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"
Expand Down
Loading