mirror of
https://github.com/boostorg/graph.git
synced 2026-01-30 20:02:12 +00:00
Changed to property_tree copy of encode_char_entities
[SVN r58180]
This commit is contained in:
@@ -23,64 +23,13 @@
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
#if 0 // Change this back later
|
||||
#include <boost/property_tree/detail/xml_parser_utils.hpp>
|
||||
#endif
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// FIXME: Remove this once property_tree is stable
|
||||
namespace graph_detail_from_property_tree {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2006 Marcin Kalicinski
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Naively convert narrow string to another character type
|
||||
template<class Ch>
|
||||
std::basic_string<Ch> widen(const char *text)
|
||||
{
|
||||
std::basic_string<Ch> result;
|
||||
while (*text)
|
||||
{
|
||||
result += Ch(*text);
|
||||
++text;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class Ch>
|
||||
std::basic_string<Ch> encode_char_entities(const std::basic_string<Ch> &s)
|
||||
{
|
||||
typedef typename std::basic_string<Ch> Str;
|
||||
Str r;
|
||||
typename Str::const_iterator end = s.end();
|
||||
for (typename Str::const_iterator it = s.begin(); it != end; ++it)
|
||||
{
|
||||
switch (*it)
|
||||
{
|
||||
case Ch('<'): r += boost::graph_detail_from_property_tree::widen<Ch>("<"); break;
|
||||
case Ch('>'): r += boost::graph_detail_from_property_tree::widen<Ch>(">"); break;
|
||||
case Ch('&'): r += boost::graph_detail_from_property_tree::widen<Ch>("&"); break;
|
||||
case Ch('"'): r += boost::graph_detail_from_property_tree::widen<Ch>("""); break;
|
||||
case Ch('\''): r += boost::graph_detail_from_property_tree::widen<Ch>("'"); break;
|
||||
default: r += *it; break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Graph reader exceptions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -280,8 +229,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
|
||||
typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
// using boost::property_tree::xml_parser::encode_char_entities;
|
||||
using boost::graph_detail_from_property_tree::encode_char_entities;
|
||||
using boost::property_tree::xml_parser::encode_char_entities;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
graph_is_directed =
|
||||
|
||||
Reference in New Issue
Block a user