diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-12-20 14:11:13 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-05 02:09:49 +0100 |
| commit | 47727a7c80b60a0fd0ce18d8347b14241fc48f97 (patch) | |
| tree | e1137ad3c8dc58ef5017011cdcc89a378b223092 | |
| parent | 64eb1161584a9813591cf958fbc2fa0208d58ce8 (diff) | |
std::shared_ptr
| -rw-r--r-- | cscript | 18 | ||||
| -rw-r--r-- | src/dcp_reader.cc | 4 | ||||
| -rw-r--r-- | src/reader_factory.cc | 2 | ||||
| -rw-r--r-- | src/reader_factory.h | 4 | ||||
| -rw-r--r-- | src/stl_binary_reader.cc | 2 | ||||
| -rw-r--r-- | src/stl_binary_reader.h | 2 | ||||
| -rw-r--r-- | src/util.cc | 4 | ||||
| -rw-r--r-- | src/util.h | 4 | ||||
| -rw-r--r-- | src/xml.h | 38 | ||||
| -rw-r--r-- | test/dcp_reader_test.cc | 2 | ||||
| -rw-r--r-- | test/stl_binary_reader_test.cc | 2 | ||||
| -rw-r--r-- | tools/dumpsubs.cc | 2 | ||||
| -rw-r--r-- | wscript | 5 |
13 files changed, 36 insertions, 53 deletions
@@ -22,8 +22,8 @@ import os option_defaults = { 'force-cpp11': False } def dependencies(target, options): - libdcp = ('libdcp', 'c6665c1', { 'force-cpp11': options['force-cpp11'] }) - libcxml = ('libcxml', 'c333199', { 'force-cpp11': options['force-cpp11'] }) + libdcp = ('libdcp', '0f1034f') + libcxml = ('libcxml', 'c336f86') return (('asdcplib', 'carl'), libcxml, libdcp) def build(target, options): @@ -37,20 +37,6 @@ def build(target, options): if target.platform == 'windows': cmd += ' --target-windows --disable-tests' - # Centos 7 ships with glibmm 2.50.0 which requires C++11 - # but its compiler (gcc 4.8.5) defaults to C++97. Go figure. - # I worry that this will cause ABI problems but I don't have - # a better solution. Mageia 6 pulls the same stunt except it's - # libxml++ that requires C++11 - force_cpp11 = False - if target.platform == 'linux': - if target.distro == 'centos' and target.version == '7': - force_cpp11 = True - if target.distro == 'mageia' and target.version == '6': - force_cpp11 = True - if force_cpp11 or options['force-cpp11']: - cmd += ' --force-cpp11' - target.command(cmd) target.command('./waf build install') diff --git a/src/dcp_reader.cc b/src/dcp_reader.cc index a3ee8e5..5784ad0 100644 --- a/src/dcp_reader.cc +++ b/src/dcp_reader.cc @@ -30,9 +30,9 @@ using std::list; using std::cout; using std::string; using std::exception; -using boost::shared_ptr; +using std::shared_ptr; using boost::optional; -using boost::dynamic_pointer_cast; +using std::dynamic_pointer_cast; using namespace sub; static Time diff --git a/src/reader_factory.cc b/src/reader_factory.cc index 759abff..fb717ea 100644 --- a/src/reader_factory.cc +++ b/src/reader_factory.cc @@ -30,7 +30,7 @@ using std::string; using std::ifstream; using boost::algorithm::ends_with; -using boost::shared_ptr; +using std::shared_ptr; using namespace sub; shared_ptr<Reader> diff --git a/src/reader_factory.h b/src/reader_factory.h index e7c349b..e519468 100644 --- a/src/reader_factory.h +++ b/src/reader_factory.h @@ -17,14 +17,14 @@ */ -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/filesystem.hpp> namespace sub { class Reader; -extern boost::shared_ptr<Reader> +extern std::shared_ptr<Reader> reader_factory (boost::filesystem::path); } diff --git a/src/stl_binary_reader.cc b/src/stl_binary_reader.cc index 467830c..f441aec 100644 --- a/src/stl_binary_reader.cc +++ b/src/stl_binary_reader.cc @@ -36,7 +36,7 @@ using boost::lexical_cast; using boost::algorithm::replace_all; using boost::is_any_of; using boost::locale::conv::utf_to_utf; -using boost::shared_ptr; +using std::shared_ptr; using namespace sub; namespace sub { diff --git a/src/stl_binary_reader.h b/src/stl_binary_reader.h index fd85a3c..94d68b3 100644 --- a/src/stl_binary_reader.h +++ b/src/stl_binary_reader.h @@ -70,7 +70,7 @@ public: std::string editor_contact_details; private: - void read (boost::shared_ptr<InputReader> reader); + void read (std::shared_ptr<InputReader> reader); STLBinaryTables _tables; }; diff --git a/src/util.cc b/src/util.cc index 89af13f..c347375 100644 --- a/src/util.cc +++ b/src/util.cc @@ -21,7 +21,7 @@ #include "reader.h" #include "subtitle.h" #include "collect.h" -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <iostream> #include <cstdio> @@ -33,7 +33,7 @@ using std::ostream; using std::map; using std::list; using boost::optional; -using boost::shared_ptr; +using std::shared_ptr; using namespace sub; /** @param s A string. @@ -22,7 +22,7 @@ */ #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #define LIBSUB_UNUSED(x) (void)(x) @@ -35,6 +35,6 @@ extern bool empty_or_white_space (std::string s); extern void remove_unicode_bom (boost::optional<std::string>& line); extern boost::optional<std::string> get_line_file (FILE* f); extern boost::optional<std::string> get_line_string (std::string* s); -extern void dump (boost::shared_ptr<const Reader> read, std::ostream& os); +extern void dump (std::shared_ptr<const Reader> read, std::ostream& os); } @@ -31,61 +31,61 @@ namespace sub { template <class T> -boost::shared_ptr<T> +std::shared_ptr<T> optional_type_child (cxml::Node const & node, std::string name) { - std::list<boost::shared_ptr<cxml::Node> > n = node.node_children (name); + std::list<std::shared_ptr<cxml::Node> > n = node.node_children (name); if (n.size() > 1) { throw XMLError ("duplicate XML tag"); } else if (n.empty ()) { - return boost::shared_ptr<T> (); + return std::shared_ptr<T> (); } - return boost::shared_ptr<T> (new T (n.front ())); + return std::shared_ptr<T> (new T (n.front ())); } template <class T> -boost::shared_ptr<T> type_child (boost::shared_ptr<const cxml::Node> node, std::string name) { - return boost::shared_ptr<T> (new T (node->node_child (name))); +std::shared_ptr<T> type_child (std::shared_ptr<const cxml::Node> node, std::string name) { + return std::shared_ptr<T> (new T (node->node_child (name))); } template <class T> -boost::shared_ptr<T> -optional_type_child (boost::shared_ptr<const cxml::Node> node, std::string name) +std::shared_ptr<T> +optional_type_child (std::shared_ptr<const cxml::Node> node, std::string name) { return optional_type_child<T> (*node.get(), name); } template <class T> -std::list<boost::shared_ptr<T> > +std::list<std::shared_ptr<T> > type_children (cxml::Node const & node, std::string name) { - std::list<boost::shared_ptr<cxml::Node> > n = node.node_children (name); - std::list<boost::shared_ptr<T> > r; - for (typename std::list<boost::shared_ptr<cxml::Node> >::iterator i = n.begin(); i != n.end(); ++i) { - r.push_back (boost::shared_ptr<T> (new T (*i))); + std::list<std::shared_ptr<cxml::Node> > n = node.node_children (name); + std::list<std::shared_ptr<T> > r; + for (typename std::list<std::shared_ptr<cxml::Node> >::iterator i = n.begin(); i != n.end(); ++i) { + r.push_back (std::shared_ptr<T> (new T (*i))); } return r; } template <class T> -std::list<boost::shared_ptr<T> > -type_children (boost::shared_ptr<const cxml::Node> node, std::string name) +std::list<std::shared_ptr<T> > +type_children (std::shared_ptr<const cxml::Node> node, std::string name) { return type_children<T> (*node.get(), name); } template <class T> -std::list<boost::shared_ptr<T> > +std::list<std::shared_ptr<T> > type_grand_children (cxml::Node const & node, std::string name, std::string sub) { - boost::shared_ptr<const cxml::Node> p = node.node_child (name); + std::shared_ptr<const cxml::Node> p = node.node_child (name); return type_children<T> (p, sub); } template <class T> -std::list<boost::shared_ptr<T> > -type_grand_children (boost::shared_ptr<const cxml::Node> node, std::string name, std::string sub) +std::list<std::shared_ptr<T> > +type_grand_children (std::shared_ptr<const cxml::Node> node, std::string name, std::string sub) { return type_grand_children<T> (*node.get(), name, sub); } diff --git a/test/dcp_reader_test.cc b/test/dcp_reader_test.cc index 57d3d66..e6a53e6 100644 --- a/test/dcp_reader_test.cc +++ b/test/dcp_reader_test.cc @@ -23,7 +23,7 @@ #include <boost/optional/optional_io.hpp> using std::list; -using boost::shared_ptr; +using std::shared_ptr; /* Test reading of a DCP XML file */ BOOST_AUTO_TEST_CASE (dcp_reader_test1) diff --git a/test/stl_binary_reader_test.cc b/test/stl_binary_reader_test.cc index 3dcddb2..bad4bc4 100644 --- a/test/stl_binary_reader_test.cc +++ b/test/stl_binary_reader_test.cc @@ -27,7 +27,7 @@ using std::list; using std::ifstream; using std::ofstream; -using boost::shared_ptr; +using std::shared_ptr; /* Test reading of a binary STL file */ BOOST_AUTO_TEST_CASE (stl_binary_reader_test1) diff --git a/tools/dumpsubs.cc b/tools/dumpsubs.cc index de1f13c..94470e8 100644 --- a/tools/dumpsubs.cc +++ b/tools/dumpsubs.cc @@ -31,7 +31,7 @@ using std::cerr; using std::cout; using std::map; using std::list; -using boost::shared_ptr; +using std::shared_ptr; using namespace sub; static void @@ -78,14 +78,11 @@ def options(opt): opt.add_option('--static', action='store_true', default=False, help='build libsub statically and link statically to cxml and dcp') opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to make a Windows package') opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests') - opt.add_option('--force-cpp11', action='store_true', default=False, help='force use of C++11') def configure(conf): conf.load('compiler_cxx') conf.load('clang_compilation_database', tooldir=['waf-tools']) - conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS']) - if conf.options.force_cpp11: - conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS']) + conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS', '-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS']) conf.env.append_value('CXXFLAGS', ['-DLIBSUB_VERSION="%s"' % VERSION]) conf.env.ENABLE_DEBUG = conf.options.enable_debug |
