summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-02-23 02:38:18 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-02-23 18:02:00 +0100
commitf9632ab04288909c9ff4de56171c31acb7f2c573 (patch)
tree628c4bc6a351bccbed6e6cd7d03566d7c9e7e770 /include/comphelper
parentcaebcd5d12f8d2798f32f72fd0bcfdc12f9f2c4f (diff)
use init lists for property sequences
Change-Id: I8b3b2b839c37b584e1a4036e49af7ff2737ea7f6
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/propertysequence.hxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/comphelper/propertysequence.hxx b/include/comphelper/propertysequence.hxx
new file mode 100644
index 000000000000..ce28e4f813ce
--- /dev/null
+++ b/include/comphelper/propertysequence.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+#define INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+
+#include <utility>
+#include <initializer_list>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+namespace comphelper
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > InitPropertySequence(
+ ::std::initializer_list< ::std::pair< OUString, ::com::sun::star::uno::Any > > vInit)
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> vResult{static_cast<sal_Int32>(vInit.size())};
+ size_t nCount{0};
+ for(auto aEntry : vInit)
+ {
+ vResult[nCount].Name = std::move(aEntry.first);
+ vResult[nCount].Value = std::move(aEntry.second);
+ ++nCount;
+ }
+ return std::move(vResult);
+ }
+} // namespace comphelper
+
+
+
+#endif // INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */