Document::read_stream; improve Document::read_string efficiency.
Use locked_stringstream instead of plain one to try to fix
DCP-o-matic crashes on OS X.
+# -*- mode: python -*-
+#
+# Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+#
+# This file is part of libcxml.
+#
+# libcxml 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.
+#
+# libcxml 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 libcxml. If not, see <http://www.gnu.org/licenses/>.
+#
+
import os
+def dependencies(target):
+ return (('locked_sstream', None))
+
def build(target, options):
cmd = './waf configure --prefix=%s' % target.directory
if target.platform == 'linux':
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of libcxml.
+
+ libcxml 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,
+ libcxml 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with libcxml. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <sstream>
-#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <libxml++/libxml++.h>
#include "cxml.h"
using std::string;
-using std::stringstream;
-using std::istream;
using std::list;
using boost::shared_ptr;
using boost::optional;
take_root_node ();
}
-void
-cxml::Document::read_stream (istream& stream)
-{
- _parser->parse_stream (stream);
- take_root_node ();
-}
-
void
cxml::Document::read_string (string s)
{
- stringstream t (s);
- _parser->parse_stream (t);
+ _parser->parse_memory (s);
take_root_node ();
}
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of libcxml.
+
+ libcxml 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,
+ libcxml 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with libcxml. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBCXML_CXML_H
#define LIBCXML_CXML_H
+#include <locked_sstream.h>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <stdint.h>
#include <string>
-#include <sstream>
#include <list>
/* Hack for OS X compile failure; see https://bugs.launchpad.net/hugin/+bug/910160 */
{
std::string s = string_child (c);
boost::erase_all (s, " ");
- std::stringstream t;
+ locked_stringstream t;
t.imbue (std::locale::classic ());
t << s;
T n;
std::string t = s.get ();
boost::erase_all (t, " ");
- std::stringstream u;
+ locked_stringstream u;
u.imbue (std::locale::classic ());
u << t;
T n;
{
std::string s = string_attribute (c);
boost::erase_all (s, " ");
- std::stringstream t;
+ locked_stringstream t;
t.imbue (std::locale::classic ());
t << s;
T n;
std::string t = s.get ();
boost::erase_all (t, " ");
- std::stringstream u;
+ locked_stringstream u;
u.imbue (std::locale::classic ());
u << t;
T n;
virtual ~Document ();
void read_file (boost::filesystem::path);
- void read_stream (std::istream &);
void read_string (std::string);
std::string root_name () const {
+# -*- mode: python -*-
+#
+# Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+#
+# This file is part of libcxml.
+#
+# libcxml 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.
+#
+# libcxml 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 libcxml. If not, see <http://www.gnu.org/licenses/>.
+#
+
def build(bld):
if bld.env.STATIC:
obj = bld(features='cxx cxxstlib')
bld.install_files('${PREFIX}/include/libcxml', "cxml.h")
if bld.env.STATIC:
bld.install_files('${PREFIX}/lib', 'libcxml.a')
-
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of libcxml.
+
+ libcxml 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,
+ libcxml 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with libcxml. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <iostream>
#include <cmath>
#include <boost/filesystem.hpp>
#include <libxml++/libxml++.h>
#include <boost/test/unit_test.hpp>
using std::string;
-using std::cout;
using std::vector;
using std::list;
using boost::shared_ptr;
+# -*- mode: python -*-
+#
+# Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+#
+# This file is part of libcxml.
+#
+# libcxml 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.
+#
+# libcxml 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 libcxml. If not, see <http://www.gnu.org/licenses/>.
+#
+
def configure(conf):
conf.env.prepend_value('LINKFLAGS', '-Lsrc')
+# -*- mode: python -*-
+#
+# Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+#
+# This file is part of libcxml.
+#
+# libcxml 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.
+#
+# libcxml 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 libcxml. If not, see <http://www.gnu.org/licenses/>.
+#
+
from waflib import Context
APPNAME = 'libcxml'
v = (int(s[0]) << 16) | (int(s[1]) << 8) | int(s[2])
if v >= 0x022701:
conf.env.append_value('CXXFLAGS', '-std=c++11')
-
+
def build(bld):
bld(source='libcxml.pc.in',