summaryrefslogtreecommitdiffstats
path: root/src/helper/sigc-track-obj.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper/sigc-track-obj.h')
-rw-r--r--src/helper/sigc-track-obj.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/helper/sigc-track-obj.h b/src/helper/sigc-track-obj.h
new file mode 100644
index 0000000..bef46fa
--- /dev/null
+++ b/src/helper/sigc-track-obj.h
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef INKSCAPE_HELPER_SIGC_TRACK_OBJ_H
+#define INKSCAPE_HELPER_SIGC_TRACK_OBJ_H
+
+/**
+ * @file
+ * Macros to handle API transition in libsigc++, replacing the function template
+ * sigc::track_obj with sigc::track_object.
+ *
+ * Specifically, this file provides the macro SIGC_TRACKING_ADAPTOR which expands
+ * to the correct identifier (including the sigc:: namespace qualification).
+ */
+/*
+ * Author:
+ * Rafael Siejakowski <rs@rs-math.net>
+ *
+ * Copyright (C) 2023 Rafael Siejakowski
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#include <sigc++/sigc++.h>
+
+// The replacement of sigc::track_obj with sigc::track_object takes place:
+// - in sigc++ 2.12 for major version 2,
+// - in sigc++ 3.4 for major version 3.
+#if SIGCXX_MAJOR_VERSION < 2
+# define USE_SIGCXX_TRACK_OBJ 1
+#elif SIGCXX_MAJOR_VERSION == 2
+# if SIGCXX_MINOR_VERSION < 12
+# define USE_SIGCXX_TRACK_OBJ 1
+# else
+# define USE_SIGCXX_TRACK_OBJ 0
+# endif
+#elif SIGCXX_MAJOR_VERSION == 3
+# if SIGCXX_MINOR_VERSION < 4
+# define USE_SIGCXX_TRACK_OBJ 1
+# else
+# define USE_SIGCXX_TRACK_OBJ 0
+# endif
+#else
+# define USE_SIGCXX_TRACK_OBJ 0
+#endif
+
+#if USE_SIGCXX_TRACK_OBJ
+# define SIGC_TRACKING_ADAPTOR (sigc::track_obj)
+#else
+# define SIGC_TRACKING_ADAPTOR (sigc::track_object)
+#endif
+
+#undef USE_SIGCXX_TRACK_OBJ
+
+#endif // INKSCAPE_HELPER_SIGC_TRACK_OBJ_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : \ No newline at end of file