summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-24 23:48:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-24 23:48:20 +0100
commitd903095d973922761071ea675f380f5c4c3cf2ad (patch)
treec2b8a90cec0bb77dd4d789c96b75ccc694aa79fa /options
parent007f8c41475ddbad34f29593bf0b744ebbca4a2a (diff)
options, compat: instantiate common templates in their .dll's
Diffstat (limited to 'options')
-rw-r--r--options/value.cpp3
-rw-r--r--options/value.hpp29
2 files changed, 25 insertions, 7 deletions
diff --git a/options/value.cpp b/options/value.cpp
index 36e05dac..af0da89f 100644
--- a/options/value.cpp
+++ b/options/value.cpp
@@ -6,6 +6,7 @@
* notice appear in all copies.
*/
+#define OTR_OPTIONS_VALUE_TEMPLATE_UNIT
#include "value.hpp"
namespace options {
@@ -32,4 +33,4 @@ namespace detail
}
}
-}
+} // ns options
diff --git a/options/value.hpp b/options/value.hpp
index 2021bd3e..84416a94 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -8,8 +8,11 @@
#pragma once
-#include "connector.hpp"
+#include "export.hpp"
+
+#include "compat/util.hpp"
+#include "connector.hpp"
#include "bundle.hpp"
#include "slider.hpp"
#include <type_traits>
@@ -135,14 +138,14 @@ template<typename t> using value_element_type_t = typename value_element_type<t>
template<typename t>
class value final : public base_value
{
-public:
- using element_type = detail::value_element_type_t<t>;
-
static bool is_equal(const QVariant& val1, const QVariant& val2)
{
return val1.value<element_type>() == val2.value<element_type>();
}
+public:
+ using element_type = detail::value_element_type_t<t>;
+
t operator=(const t& datum)
{
const element_type tmp = static_cast<element_type>(datum);
@@ -206,5 +209,19 @@ private:
const t def;
};
-
-}
+#ifdef OTR_OPTIONS_VALUE_TEMPLATE_UNIT
+# define OTR_OPTIONS_VALUE_TEMPLATE_EXTERN
+# define OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC OPENTRACK_OPTIONS_EXPORT
+#else
+# define OTR_OPTIONS_VALUE_TEMPLATE_EXTERN extern
+# define OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC
+#endif
+
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<int>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<double>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<bool>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<QString>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<slider_value>;
+OTR_OPTIONS_VALUE_TEMPLATE_EXTERN template class OTR_OPTIONS_VALUE_TEMPLATE_DECLSPEC value<QList<QPointF>>;
+
+} // ns options