Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / comphelper / propertysequence.hxx
blob28561a6904d717740beccf6f31b4537251520102
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
11 #define INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
13 #include <utility>
14 #include <initializer_list>
15 #include <com/sun/star/uno/Any.hxx>
16 #include <com/sun/star/uno/Sequence.hxx>
17 #include <com/sun/star/beans/PropertyValue.hpp>
19 namespace comphelper
21 inline css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(
22 ::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
24 css::uno::Sequence< css::beans::PropertyValue> vResult{static_cast<sal_Int32>(vInit.size())};
25 size_t nCount{0};
26 for(const auto& aEntry : vInit)
28 vResult[nCount].Name = aEntry.first;
29 vResult[nCount].Handle = -1;
30 vResult[nCount].Value = aEntry.second;
31 // State is default-initialized to DIRECT_VALUE
32 ++nCount;
34 return vResult;
36 } // namespace comphelper
39 #endif // INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
41 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */