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_PROPERTYVALUE_HXX
11 : #define INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
12 :
13 : #include <com/sun/star/beans/PropertyValue.hpp>
14 :
15 : namespace comphelper
16 : {
17 :
18 : /**
19 : * Creates a beans::PropertyValue easily, i.e. you can write:
20 : *
21 : * function(comphelper::makePropertyValue("Foo", nBar));
22 : *
23 : * instead of writing 3 extra lines to set the name and value of the beans::PropertyValue.
24 : */
25 253996 : template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, const T& rValue)
26 : {
27 253996 : css::beans::PropertyValue aValue;
28 253996 : aValue.Name = rName;
29 253996 : aValue.Value <<= rValue;
30 253996 : return aValue;
31 : }
32 :
33 : }
34 :
35 : #endif // INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
36 :
37 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|