From f9632ab04288909c9ff4de56171c31acb7f2c573 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 23 Feb 2015 02:38:18 +0100 Subject: use init lists for property sequences Change-Id: I8b3b2b839c37b584e1a4036e49af7ff2737ea7f6 --- include/comphelper/propertysequence.hxx | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/comphelper/propertysequence.hxx (limited to 'include/comphelper/propertysequence.hxx') 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 +#include +#include +#include +#include + +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(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: */ -- cgit