summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/macros.hpp15
-rw-r--r--compat/tr.cpp17
-rw-r--r--compat/tr.hpp19
3 files changed, 42 insertions, 9 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index c8fbca20..b0c7a51d 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -1,16 +1,9 @@
#pragma once
-#if !defined __WINE__
-# include <QCoreApplication>
-# define otr_tr(...) (QCoreApplication::translate(OTR_MODULE_NAME, __VA_ARGS__))
-# define _(...) (otr_tr(__VA_ARGS__))
-#endif
-
#if defined _MSC_VER
-#
-# define MEMORY_BARRIER _ReadWriteBarrier()
+# define MEMORY_BARRIER() _ReadWriteBarrier()
#else
-# define MEMORY_BARRIER asm volatile("" ::: "memory")
+# define MEMORY_BARRIER() asm volatile("" ::: "memory")
#endif
#if defined _MSC_VER
@@ -52,3 +45,7 @@
#else
# define OTR_FUNNAME (__PRETTY_FUNCTION__)
#endif
+
+#if defined __cplusplus
+# define thunk(...) ([&]() { __VA_ARGS__; })
+#endif
diff --git a/compat/tr.cpp b/compat/tr.cpp
new file mode 100644
index 00000000..b3349435
--- /dev/null
+++ b/compat/tr.cpp
@@ -0,0 +1,17 @@
+#include "tr.hpp"
+
+
+TR::TR() {}
+
+TR::TR(const TR&) {}
+
+TR&TR::operator=(const TR& other)
+{
+ if (this == &other)
+ return *this;
+
+ TR::~TR();
+ return *new (this) TR;
+}
+
+TR::~TR() {}
diff --git a/compat/tr.hpp b/compat/tr.hpp
new file mode 100644
index 00000000..7bb4fb71
--- /dev/null
+++ b/compat/tr.hpp
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <QObject>
+#include "export.hpp"
+
+// The class does nothing except provide a fake assignment operator for QObject
+// It's meant to be used inside classes that need i18n support but are returned by value.
+
+class OTR_COMPAT_EXPORT TR : public QObject
+{
+ Q_OBJECT
+
+public:
+ TR();
+ TR(const TR&);
+ ~TR() override;
+
+ TR& operator=(const TR& other);
+};