Commit 89004f4b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

sync graphml reader with boost library


git-svn-id: https://svn.forked.de/graph-tool/trunk@78 d4600afd-f417-0410-95de-beed9576f240
parent 3dd3d3d0
This diff is collapsed.
......@@ -9,7 +9,8 @@ bin_SCRIPTS = graph-tool
boost_workarounddir = boost-workaround
boost_workaround_DATA = \
boost-workaround/boost/graph/filtered_graph.hpp \
boost-workaround/boost/graph/fruchterman_reingold.hpp
boost-workaround/boost/graph/fruchterman_reingold.hpp \
boost-workaround/boost/graph/graphml.hpp
EXTRA_DIST = $(bin_SCRIPTS) $(boost_workaround_DATA)
\ No newline at end of file
// graph-tool -- a general graph modification and manipulation thingy
//
// Copyright (C) 2006 Tiago de Paula Peixoto <tiago@forked.de>
// Copyright (C) 2004 The Trustees of Indiana University.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Copyright (C) 2004 The Trustees of Indiana University.
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
// Use, modification and distribution is subject to 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)
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// Authors: Douglas Gregor
// Andrew Lumsdaine
// Tiago de Paula Peixoto
#ifndef GRAPHML_HPP
#define GRAPHML_HPP
#ifndef BOOST_GRAPH_GRAPHML_HPP
#define BOOST_GRAPH_GRAPHML_HPP
#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
......@@ -367,4 +330,4 @@ write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp,
} // boost namespace
#endif
#endif // BOOST_GRAPH_GRAPHML_HPP
......@@ -42,7 +42,6 @@ libgraph_tool_la_SOURCES = \
graph_line_graph.cc\
graph_io.cc\
graph_bind.cc\
graphml.hpp\
graphml.cpp\
histogram.hh\
read_graphviz_spirit.cpp
......
......@@ -28,7 +28,7 @@
#include "graph_selectors.hh"
#include "graph_properties.hh"
#include <boost/graph/graphviz.hpp>
#include "graphml.hpp"
#include <boost/graph/graphml.hpp>
using namespace std;
using namespace boost;
......
......@@ -24,7 +24,7 @@
#include "histogram.hh"
#include "graph_filtering.hh"
#include "graph_properties.hh"
#include "graphml.hpp"
#include <boost/graph/graphml.hpp>
using namespace std;
using namespace boost;
......
......@@ -28,7 +28,7 @@
#include "graph_selectors.hh"
#include "graph_properties.hh"
#include <boost/graph/graphviz.hpp>
#include "graphml.hpp"
#include <boost/graph/graphml.hpp>
using namespace std;
using namespace boost;
......
// graph-tool -- a general graph modification and manipulation thingy
//
// Copyright (C) 2006 Tiago de Paula Peixoto <tiago@forked.de>
// Copyright (C) 2004 The Trustees of Indiana University.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Copyright (C) 2004 The Trustees of Indiana University.
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// Use, modification and distribution is subject to 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)
// Authors: Douglas Gregor
// Andrew Lumsdaine
// Tiago de Paula Peixoto
#include <boost/variant.hpp>
#include <expat.h>
#include <boost/graph/graphml.hpp>
#include <boost/algorithm/string/replace.hpp>
#include "expat.h"
#include "graphml.hpp"
using namespace boost;
......@@ -67,15 +30,16 @@ public:
XML_SetCharacterDataHandler(m_parser, &on_character_data);
XML_SetUserData(m_parser, this);
char buffer[buffer_size];
int retval;
bool okay = true;
do
{
in.read(buffer, buffer_size);
retval = XML_Parse(m_parser, buffer, in.gcount(), in.gcount() == 0);
okay = XML_Parse(m_parser, buffer, in.gcount(), in.gcount() == 0);
}
while (retval && in.good());
while (okay && in.good());
if (retval == 0)
if (!okay)
{
std::stringstream s;
s << "on line " << XML_GetCurrentLineNumber(m_parser)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment