Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #ifndef INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
11 : #define INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
12 :
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>
18 :
19 : namespace comphelper
20 : {
21 110 : inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > InitPropertySequence(
22 : ::std::initializer_list< ::std::pair< OUString, ::com::sun::star::uno::Any > > vInit)
23 : {
24 110 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> vResult{static_cast<sal_Int32>(vInit.size())};
25 110 : size_t nCount{0};
26 310 : for(const auto& aEntry : vInit)
27 : {
28 200 : vResult[nCount].Name = aEntry.first;
29 200 : vResult[nCount].Value = aEntry.second;
30 200 : ++nCount;
31 : }
32 110 : return vResult;
33 : }
34 : } // namespace comphelper
35 :
36 :
37 :
38 : #endif // INCLUDED_COMPHELPER_PROPERTYSEQUENCE_HXX
39 :
40 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|