diff options
Diffstat (limited to 'include/comphelper/propertyvalue.hxx')
-rw-r--r-- | include/comphelper/propertyvalue.hxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx index ac4f6886039e..9d0d94d3256a 100644 --- a/include/comphelper/propertyvalue.hxx +++ b/include/comphelper/propertyvalue.hxx @@ -12,6 +12,7 @@ #include <sal/config.h> +#include <type_traits> #include <utility> #include <com/sun/star/beans/PropertyValue.hpp> @@ -25,11 +26,18 @@ namespace comphelper * * instead of writing 3 extra lines to set the name and value of the beans::PropertyValue. */ -template <typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue) +template <typename T, std::enable_if_t<!std::is_arithmetic_v<std::remove_reference_t<T>>, int> = 0> +css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue) { return { rName, 0, css::uno::toAny(std::forward<T>(rValue)), css::beans::PropertyState_DIRECT_VALUE }; } +// Allows to pass e.g. bit fields +template <typename T, std::enable_if_t<std::is_arithmetic_v<std::remove_reference_t<T>>, int> = 0> +css::beans::PropertyValue makePropertyValue(const OUString& rName, T aValue) +{ + return makePropertyValue(rName, css::uno::toAny(aValue)); +} } #endif // INCLUDED_COMPHELPER_PROPERTYVALUE_HXX |