at master 7.2 kB view raw
1diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp 2index 9add692c9..488427b56 100644 3--- a/src/mapnik_image.cpp 4+++ b/src/mapnik_image.cpp 5@@ -230,7 +230,7 @@ unsigned get_type(mapnik::image_any & im) 6 7 std::shared_ptr<image_any> open_from_file(std::string const& filename) 8 { 9- boost::optional<std::string> type = type_from_filename(filename); 10+ auto type = type_from_filename(filename); 11 if (type) 12 { 13 std::unique_ptr<image_reader> reader(get_image_reader(filename,*type)); 14diff --git a/src/mapnik_layer.cpp b/src/mapnik_layer.cpp 15index 4fc7ea579..fbd277a81 100644 16--- a/src/mapnik_layer.cpp 17+++ b/src/mapnik_layer.cpp 18@@ -95,7 +95,7 @@ struct layer_pickle_suite : boost::python::pickle_suite 19 20 std::vector<std::string> & (mapnik::layer::*_styles_)() = &mapnik::layer::styles; 21 22-void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double> > const& box) 23+void set_maximum_extent(mapnik::layer & l, std::optional<mapnik::box2d<double> > const& box) 24 { 25 if (box) 26 { 27@@ -107,7 +107,7 @@ void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double> 28 } 29 } 30 31-void set_buffer_size(mapnik::layer & l, boost::optional<int> const& buffer_size) 32+void set_buffer_size(mapnik::layer & l, std::optional<int> const& buffer_size) 33 { 34 if (buffer_size) 35 { 36@@ -121,7 +121,7 @@ void set_buffer_size(mapnik::layer & l, boost::optional<int> const& buffer_size) 37 38 PyObject * get_buffer_size(mapnik::layer & l) 39 { 40- boost::optional<int> buffer_size = l.buffer_size(); 41+ std::optional<int> buffer_size = l.buffer_size(); 42 if (buffer_size) 43 { 44 #if PY_VERSION_HEX >= 0x03000000 45diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp 46index 3587e5d8a..cfa523b03 100644 47--- a/src/mapnik_map.cpp 48+++ b/src/mapnik_map.cpp 49@@ -105,7 +105,7 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x 50 return m.query_map_point(idx, x, y); 51 } 52 53-void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box) 54+void set_maximum_extent(mapnik::Map & m, std::optional<mapnik::box2d<double> > const& box) 55 { 56 if (box) 57 { 58diff --git a/src/python_optional.hpp b/src/python_optional.hpp 59index d690b7c51..9d86c340e 100644 60--- a/src/python_optional.hpp 61+++ b/src/python_optional.hpp 62@@ -28,7 +28,7 @@ 63 #include <mapnik/util/noncopyable.hpp> 64 #pragma GCC diagnostic pop 65 66-// boost::optional<T> to/from converter from John Wiegley 67+// std::optional<T> to/from converter from John Wiegley 68 69 template <typename T, typename TfromPy> 70 struct object_from_python 71@@ -54,7 +54,7 @@ struct python_optional : public mapnik::util::noncopyable 72 { 73 struct optional_to_python 74 { 75- static PyObject * convert(const boost::optional<T>& value) 76+ static PyObject * convert(const std::optional<T>& value) 77 { 78 return (value ? boost::python::to_python_value<T>()(*value) : 79 boost::python::detail::none()); 80@@ -90,9 +90,9 @@ struct python_optional : public mapnik::util::noncopyable 81 data)->storage.bytes; 82 83 if (data->convertible == source) // == None 84- new (storage) boost::optional<T>(); // A Boost uninitialized value 85+ new (storage) std::optional<T>(); // A Boost uninitialized value 86 else 87- new (storage) boost::optional<T>(*static_cast<T *>(data->convertible)); 88+ new (storage) std::optional<T>(*static_cast<T *>(data->convertible)); 89 90 data->convertible = storage; 91 } 92@@ -100,18 +100,18 @@ struct python_optional : public mapnik::util::noncopyable 93 94 explicit python_optional() 95 { 96- register_python_conversion<boost::optional<T>, 97+ register_python_conversion<std::optional<T>, 98 optional_to_python, optional_from_python>(); 99 } 100 }; 101 102-// to/from boost::optional<bool> 103+// to/from std::optional<bool> 104 template <> 105 struct python_optional<float> : public mapnik::util::noncopyable 106 { 107 struct optional_to_python 108 { 109- static PyObject * convert(const boost::optional<float>& value) 110+ static PyObject * convert(const std::optional<float>& value) 111 { 112 return (value ? PyFloat_FromDouble(*value) : 113 boost::python::detail::none()); 114@@ -133,30 +133,30 @@ struct python_optional<float> : public mapnik::util::noncopyable 115 boost::python::converter::rvalue_from_python_stage1_data * data) 116 { 117 using namespace boost::python::converter; 118- void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *) 119+ void * const storage = ((rvalue_from_python_storage<std::optional<bool> > *) 120 data)->storage.bytes; 121 if (source == Py_None) // == None 122- new (storage) boost::optional<float>(); // A Boost uninitialized value 123+ new (storage) std::optional<float>(); // A Boost uninitialized value 124 else 125- new (storage) boost::optional<float>(PyFloat_AsDouble(source)); 126+ new (storage) std::optional<float>(PyFloat_AsDouble(source)); 127 data->convertible = storage; 128 } 129 }; 130 131 explicit python_optional() 132 { 133- register_python_conversion<boost::optional<float>, 134+ register_python_conversion<std::optional<float>, 135 optional_to_python, optional_from_python>(); 136 } 137 }; 138 139-// to/from boost::optional<float> 140+// to/from std::optional<float> 141 template <> 142 struct python_optional<bool> : public mapnik::util::noncopyable 143 { 144 struct optional_to_python 145 { 146- static PyObject * convert(const boost::optional<bool>& value) 147+ static PyObject * convert(const std::optional<bool>& value) 148 { 149 if (value) 150 { 151@@ -181,13 +181,13 @@ struct python_optional<bool> : public mapnik::util::noncopyable 152 boost::python::converter::rvalue_from_python_stage1_data * data) 153 { 154 using namespace boost::python::converter; 155- void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *) 156+ void * const storage = ((rvalue_from_python_storage<std::optional<bool> > *) 157 data)->storage.bytes; 158 if (source == Py_None) // == None 159- new (storage) boost::optional<bool>(); // A Boost uninitialized value 160+ new (storage) std::optional<bool>(); // A Boost uninitialized value 161 else 162 { 163- new (storage) boost::optional<bool>(source == Py_True ? true : false); 164+ new (storage) std::optional<bool>(source == Py_True ? true : false); 165 } 166 data->convertible = storage; 167 } 168@@ -195,7 +195,7 @@ struct python_optional<bool> : public mapnik::util::noncopyable 169 170 explicit python_optional() 171 { 172- register_python_conversion<boost::optional<bool>, 173+ register_python_conversion<std::optional<bool>, 174 optional_to_python, optional_from_python>(); 175 } 176 };