Reduce reliance on boost - the easy part

* boost::unordered_map -> std::unordered_map
* BOOST_STATIC_ASSERT/static_assert
* BOOST_FOREACH -> for
* boost::tuple -> std::tuple/g
* boost::math::isnormal -> std::isnormal
* boost::container::set -> std::set
* boost::none -> std::nullopt
* boost::optional -> std::optional
This commit is contained in:
Robin Gareus 2024-10-19 02:23:13 +02:00
parent 168b917730
commit ff95d81612
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
58 changed files with 144 additions and 155 deletions

View file

@ -20,8 +20,7 @@
#define __push2_meter_h__
#include <map>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <tuple>
#include <cairomm/pattern.h>
#include <cairomm/region.h>
@ -156,9 +155,9 @@ class Meter : public Item {
|| (dim == rhs.dim && stp == rhs.stp && cols < rhs.cols)
|| (dim == rhs.dim && stp == rhs.stp && cols == rhs.cols && style < rhs.style);
}
boost::tuple<int, int> dim;
boost::tuple<float, float, float, float> stp;
boost::tuple<int, int, int, int, int, int, int, int, int, int> cols;
std::tuple<int, int> dim;
std::tuple<float, float, float, float> stp;
std::tuple<int, int, int, int, int, int, int, int, int, int> cols;
int style;
};
typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;
@ -172,8 +171,8 @@ class Meter : public Item {
inline bool operator<(const PatternBgMapKey& rhs) const {
return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh));
}
boost::tuple<int, int> dim;
boost::tuple<int, int> cols;
std::tuple<int, int> dim;
std::tuple<int, int> cols;
bool sh;
};
typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > PatternBgMap;

View file

@ -27,7 +27,7 @@ ArrowTest::bounding_box ()
arrow.set_outline_width (0);
boost::optional<Rect> bbox = arrow.bounding_box ();
std::optional<Rect> bbox = arrow.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == -6);

View file

@ -23,7 +23,7 @@ GroupTest::bounding_box ()
c.set_outline_width (0);
Rectangle d (canvas.root(), Rect (33, 33, 64, 64));
d.set_outline_width (0);
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
/* check the bounding box */
CPPUNIT_ASSERT (bbox.is_initialized ());
@ -51,7 +51,7 @@ GroupTest::null_bounding_box ()
Group empty (canvas.root());
boost::optional<Rect> bbox = empty.bounding_box ();
std::optional<Rect> bbox = empty.bounding_box ();
CPPUNIT_ASSERT (!bbox.is_initialized ());
}
@ -116,7 +116,7 @@ GroupTest::children_changing ()
a.set_outline_width (0);
/* Check that initial bbox */
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == 0);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
@ -156,7 +156,7 @@ GroupTest::grandchildren_changing ()
a.set_outline_width (0);
/* Check the initial bboxes */
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == 0);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
@ -276,7 +276,7 @@ GroupTest::torture_add_items_at_point ()
}
for (list<Item*>::iterator j = rectangles.begin(); j != rectangles.end(); ++j) {
boost::optional<Rect> bbox = (*j)->bounding_box ();
std::optional<Rect> bbox = (*j)->bounding_box ();
assert (bbox);
if (bbox.value().contains (test)) {
items_B.push_back (*j);

View file

@ -29,7 +29,7 @@ PolygonTest::bounding_box ()
/* should now have a bounding box around those points,
taking into account default line width
*/
boost::optional<Rect> bbox = polygon.bounding_box ();
std::optional<Rect> bbox = polygon.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == -6.25);
CPPUNIT_ASSERT (bbox.value().x1 == 6.25);

View file

@ -12,7 +12,7 @@ TypesTest::intersect ()
{
Rect a (0, 0, 1024, 1024);
Rect b (0, 0, 512, 512);
boost::optional<Rect> c = a.intersection (b);
std::optional<Rect> c = a.intersection (b);
CPPUNIT_ASSERT (c.is_initialized ());
CPPUNIT_ASSERT (c->x0 == 0);
@ -24,7 +24,7 @@ TypesTest::intersect ()
{
Rect a (0, 0, 512, 512);
Rect b (513, 513, 1024, 1024);
boost::optional<Rect> c = a.intersection (b);
std::optional<Rect> c = a.intersection (b);
CPPUNIT_ASSERT (!c.is_initialized ());
}