/src/libreoffice/include/comphelper/namedvaluecollection.hxx
Line | Count | Source |
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 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX |
21 | | #define INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX |
22 | | |
23 | | #include <comphelper/comphelperdllapi.h> |
24 | | |
25 | | #include <com/sun/star/uno/Sequence.hxx> |
26 | | #include <com/sun/star/uno/Any.hxx> |
27 | | #include <com/sun/star/beans/PropertyValue.hpp> |
28 | | #include <com/sun/star/beans/NamedValue.hpp> |
29 | | |
30 | | #include <vector> |
31 | | #include <unordered_map> |
32 | | |
33 | | namespace comphelper |
34 | | { |
35 | | |
36 | | |
37 | | // = NamedValueCollection |
38 | | |
39 | | /** a collection of named values, packed in various formats. |
40 | | */ |
41 | | class COMPHELPER_DLLPUBLIC NamedValueCollection |
42 | | { |
43 | | std::unordered_map< OUString, css::uno::Any > maValues; |
44 | | public: |
45 | 5.41k | NamedValueCollection() = default; |
46 | | |
47 | 0 | NamedValueCollection( const NamedValueCollection& _rCopySource ) = default; |
48 | | NamedValueCollection(NamedValueCollection&& _rCopySource) noexcept = default; |
49 | | |
50 | | NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource ) = default; |
51 | 0 | NamedValueCollection& operator=(NamedValueCollection&& i_rCopySource) noexcept = default; |
52 | | |
53 | | /** constructs a collection |
54 | | @param _rElements |
55 | | the wrapped elements of the collection. The @c Any might contain a sequence of |
56 | | property values, a sequence of named values, or directly a property value or named value. |
57 | | All other cases are worth an assertion in non-product builds. |
58 | | */ |
59 | | NamedValueCollection( const css::uno::Any& _rElements ); |
60 | | |
61 | | /** constructs a collection |
62 | | @param _rArguments |
63 | | a sequence of Any's containing either PropertyValue's or NamedValue's. |
64 | | */ |
65 | | NamedValueCollection( const css::uno::Sequence< css::uno::Any >& _rArguments ); |
66 | | |
67 | | /** constructs a collection |
68 | | @param _rArguments |
69 | | a sequence of PropertyValues's |
70 | | */ |
71 | | NamedValueCollection( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ); |
72 | | |
73 | | /** constructs a collection |
74 | | @param _rArguments |
75 | | a sequence of NamedValue's |
76 | | */ |
77 | | NamedValueCollection( const css::uno::Sequence< css::beans::NamedValue >& _rArguments ); |
78 | | |
79 | | void assign( const css::uno::Sequence< css::uno::Any >& _rArguments ) |
80 | 0 | { |
81 | 0 | impl_assign( _rArguments ); |
82 | 0 | } |
83 | | |
84 | | void clear() |
85 | 0 | { |
86 | 0 | impl_assign( css::uno::Sequence< css::beans::NamedValue >() ); |
87 | 0 | } |
88 | | |
89 | | /** determines whether or not named values can be extracted from the given value |
90 | | |
91 | | @return |
92 | | true if and only if the given @c Any contains a @c NamedValue, a |
93 | | @c PropertyValue, or a sequence thereof. |
94 | | */ |
95 | | static bool canExtractFrom( css::uno::Any const & i_value ); |
96 | | |
97 | | /// returns the number of elements in the collection |
98 | | size_t size() const; |
99 | | |
100 | | /// determines whether the collection is empty |
101 | | bool empty() const; |
102 | | |
103 | | /** returns the names of all elements in the collection |
104 | | */ |
105 | | ::std::vector< OUString > |
106 | | getNames() const; |
107 | | |
108 | | /** merges the content of another collection into @c this |
109 | | @param _rAdditionalValues |
110 | | the collection whose values are to be merged |
111 | | @param _bOverwriteExisting |
112 | | defines whether or not elements which are already present in @c this |
113 | | should be overwritten (true) or preserved (false). |
114 | | @return @c *this |
115 | | */ |
116 | | NamedValueCollection& |
117 | | merge( |
118 | | const NamedValueCollection& _rAdditionalValues, |
119 | | bool _bOverwriteExisting |
120 | | ); |
121 | | |
122 | | /** retrieves a value with a given name from the collection, if it is present |
123 | | |
124 | | @param _pAsciiValueName |
125 | | the ASCII name of the value to retrieve |
126 | | |
127 | | @param _out_rValue |
128 | | is the output parameter taking the desired value upon successful return. If |
129 | | a value with the given name is not present in the collection, or if a wrong-typed |
130 | | value is present, then this parameter will not be touched. |
131 | | |
132 | | @retval |
133 | | true if there is a value with the given name, which could successfully |
134 | | be extracted. In this case, @c _out_rValue will contain the requested |
135 | | value. |
136 | | @retval |
137 | | false, if there is no value with the given name. |
138 | | |
139 | | @throws IllegalArgumentException |
140 | | in case there is a value with the given name, but it cannot legally assigned to |
141 | | _out_rValue. |
142 | | */ |
143 | | template < typename VALUE_TYPE > |
144 | | bool get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const |
145 | 57.1k | { |
146 | 57.1k | return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() ); |
147 | 57.1k | } bool comphelper::NamedValueCollection::get_ensureType<bool>(rtl::OUString const&, bool&) const Line | Count | Source | 145 | 38.7k | { | 146 | 38.7k | return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() ); | 147 | 38.7k | } |
bool comphelper::NamedValueCollection::get_ensureType<short>(rtl::OUString const&, short&) const Line | Count | Source | 145 | 9.15k | { | 146 | 9.15k | return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() ); | 147 | 9.15k | } |
bool comphelper::NamedValueCollection::get_ensureType<rtl::OUString>(rtl::OUString const&, rtl::OUString&) const Line | Count | Source | 145 | 9.28k | { | 146 | 9.28k | return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() ); | 147 | 9.28k | } |
Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::frame::XController> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::frame::XFrame> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::awt::XWindow> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindow>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<unsigned long>(rtl::OUString const&, unsigned long&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::ucb::XCommandProcessor> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandProcessor>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Sequence<signed char> >(rtl::OUString const&, com::sun::star::uno::Sequence<signed char>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::frame::XModel2> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel2>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Reference<com::sun::star::ui::XSidebar> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ui::XSidebar>&) const Unexecuted instantiation: bool comphelper::NamedValueCollection::get_ensureType<com::sun::star::uno::Sequence<com::sun::star::uno::Type> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Type>&) const |
148 | | |
149 | | /** retrieves a value with a given name, or defaults it to a given value, if it's not present |
150 | | in the collection |
151 | | */ |
152 | | template < typename VALUE_TYPE > |
153 | | VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const |
154 | 57.1k | { |
155 | 57.1k | VALUE_TYPE retVal( _rDefault ); |
156 | 57.1k | get_ensureType( _rValueName, retVal ); |
157 | 57.1k | return retVal; |
158 | 57.1k | } bool comphelper::NamedValueCollection::getOrDefault<bool>(rtl::OUString const&, bool const&) const Line | Count | Source | 154 | 38.7k | { | 155 | 38.7k | VALUE_TYPE retVal( _rDefault ); | 156 | 38.7k | get_ensureType( _rValueName, retVal ); | 157 | 38.7k | return retVal; | 158 | 38.7k | } |
short comphelper::NamedValueCollection::getOrDefault<short>(rtl::OUString const&, short const&) const Line | Count | Source | 154 | 9.15k | { | 155 | 9.15k | VALUE_TYPE retVal( _rDefault ); | 156 | 9.15k | get_ensureType( _rValueName, retVal ); | 157 | 9.15k | return retVal; | 158 | 9.15k | } |
rtl::OUString comphelper::NamedValueCollection::getOrDefault<rtl::OUString>(rtl::OUString const&, rtl::OUString const&) const Line | Count | Source | 154 | 9.28k | { | 155 | 9.28k | VALUE_TYPE retVal( _rDefault ); | 156 | 9.28k | get_ensureType( _rValueName, retVal ); | 157 | 9.28k | return retVal; | 158 | 9.28k | } |
Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::frame::XController> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::frame::XController> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::frame::XFrame> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::frame::XFrame> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::awt::XWindow> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::awt::XWindow> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&) const Unexecuted instantiation: unsigned long comphelper::NamedValueCollection::getOrDefault<unsigned long>(rtl::OUString const&, unsigned long const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> const&) const Unexecuted instantiation: com::sun::star::uno::Sequence<signed char> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Sequence<signed char> >(rtl::OUString const&, com::sun::star::uno::Sequence<signed char> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::frame::XModel2> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::frame::XModel2> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel2> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::ui::XSidebar> comphelper::NamedValueCollection::getOrDefault<com::sun::star::uno::Reference<com::sun::star::ui::XSidebar> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ui::XSidebar> const&) const |
159 | | |
160 | | /** Retrieves a value with a given name, or defaults it to a given value, if it's not present |
161 | | in the collection. |
162 | | For when you only need a single value from a Sequence<PropertyValue>. |
163 | | */ |
164 | | template < typename VALUE_TYPE > |
165 | | static VALUE_TYPE getOrDefault( const css::uno::Sequence<css::beans::PropertyValue> & rPropSeq, |
166 | | std::u16string_view _rValueName, const VALUE_TYPE& _rDefault ) |
167 | 4.57k | { |
168 | 4.57k | VALUE_TYPE retVal( _rDefault ); |
169 | 4.57k | get_ensureType( rPropSeq, _rValueName, &retVal, ::cppu::UnoType< VALUE_TYPE >::get() ); |
170 | 4.57k | return retVal; |
171 | 4.57k | } Unexecuted instantiation: bool comphelper::NamedValueCollection::getOrDefault<bool>(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, std::__1::basic_string_view<char16_t, std::__1::char_traits<char16_t> >, bool const&) short comphelper::NamedValueCollection::getOrDefault<short>(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, std::__1::basic_string_view<char16_t, std::__1::char_traits<char16_t> >, short const&) Line | Count | Source | 167 | 4.57k | { | 168 | 4.57k | VALUE_TYPE retVal( _rDefault ); | 169 | 4.57k | get_ensureType( rPropSeq, _rValueName, &retVal, ::cppu::UnoType< VALUE_TYPE >::get() ); | 170 | 4.57k | return retVal; | 171 | 4.57k | } |
Unexecuted instantiation: rtl::OUString comphelper::NamedValueCollection::getOrDefault<rtl::OUString>(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, std::__1::basic_string_view<char16_t, std::__1::char_traits<char16_t> >, rtl::OUString const&) |
172 | | |
173 | | /** retrieves a (untyped) value with a given name |
174 | | |
175 | | If the collection does not contain a value with the given name, an empty |
176 | | Any is returned. |
177 | | */ |
178 | | const css::uno::Any& get( const OUString& _rValueName ) const |
179 | 4 | { |
180 | 4 | return impl_get( _rValueName ); |
181 | 4 | } |
182 | | |
183 | | /** retrieves a (untyped) value with a given name. For when you only need a single value from a Sequence<PropertyValue>. |
184 | | |
185 | | If the collection does not contain a value with the given name, an empty |
186 | | Any is returned. |
187 | | */ |
188 | | static const css::uno::Any& get( const css::uno::Sequence<css::beans::PropertyValue>& rPropSeq, std::u16string_view _rValueName ); |
189 | | |
190 | | /// determines whether a value with a given name is present in the collection |
191 | | bool has( const OUString& _rValueName ) const |
192 | 0 | { |
193 | 0 | return impl_has( _rValueName ); |
194 | 0 | } |
195 | | |
196 | | /** puts a value into the collection |
197 | | |
198 | | @return true if and only if a value was already present previously, in |
199 | | which case it has been overwritten. |
200 | | */ |
201 | | template < typename VALUE_TYPE > |
202 | | bool put( const OUString& _rValueName, const VALUE_TYPE& _rValue ) |
203 | 10.9k | { |
204 | 10.9k | return impl_put( _rValueName, css::uno::Any( _rValue ) ); |
205 | 10.9k | } bool comphelper::NamedValueCollection::put<rtl::OUString>(rtl::OUString const&, rtl::OUString const&) Line | Count | Source | 203 | 5.55k | { | 204 | 5.55k | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 5.55k | } |
bool comphelper::NamedValueCollection::put<int>(rtl::OUString const&, int const&) Line | Count | Source | 203 | 5.33k | { | 204 | 5.33k | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 5.33k | } |
Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::frame::XModel> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<unsigned short>(rtl::OUString const&, unsigned short const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<bool>(rtl::OUString const&, bool const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::awt::XWindow> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<short>(rtl::OUString const&, short const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler2> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler2> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::frame::XFrame> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::ucb::OpenCommandArgument2>(rtl::OUString const&, com::sun::star::ucb::OpenCommandArgument2 const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProviderInterceptor> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProviderInterceptor> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::embed::XStorage> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Sequence<rtl::OUString> >(rtl::OUString const&, com::sun::star::uno::Sequence<rtl::OUString> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::io::XInputStream> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&) Unexecuted instantiation: bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::util::XCloseable> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::util::XCloseable> const&) bool comphelper::NamedValueCollection::put<rtl::OUStringLiteral<76ul> >(rtl::OUString const&, rtl::OUStringLiteral<76ul> const&) Line | Count | Source | 203 | 15 | { | 204 | 15 | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 15 | } |
bool comphelper::NamedValueCollection::put<rtl::OUStringLiteral<77ul> >(rtl::OUString const&, rtl::OUStringLiteral<77ul> const&) Line | Count | Source | 203 | 15 | { | 204 | 15 | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 15 | } |
bool comphelper::NamedValueCollection::put<rtl::OUStringLiteral<74ul> >(rtl::OUString const&, rtl::OUStringLiteral<74ul> const&) Line | Count | Source | 203 | 15 | { | 204 | 15 | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 15 | } |
bool comphelper::NamedValueCollection::put<rtl::OUStringLiteral<79ul> >(rtl::OUString const&, rtl::OUStringLiteral<79ul> const&) Line | Count | Source | 203 | 15 | { | 204 | 15 | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 15 | } |
bool comphelper::NamedValueCollection::put<com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> const&) Line | Count | Source | 203 | 26 | { | 204 | 26 | return impl_put( _rValueName, css::uno::Any( _rValue ) ); | 205 | 26 | } |
|
206 | | |
207 | | bool put( const OUString& _rValueName, const css::uno::Any& _rValue ) |
208 | 0 | { |
209 | 0 | return impl_put( _rValueName, _rValue ); |
210 | 0 | } |
211 | | |
212 | | /** removes the value with the given name from the collection |
213 | | |
214 | | @return true if and only if a value with the given name existed in the collection. |
215 | | */ |
216 | | bool remove( const OUString& _rValueName ) |
217 | 0 | { |
218 | 0 | return impl_remove( _rValueName ); |
219 | 0 | } |
220 | | |
221 | | /** transforms the collection to a sequence of PropertyValues |
222 | | |
223 | | @return |
224 | | the number of elements in the sequence |
225 | | */ |
226 | | sal_Int32 operator >>= ( css::uno::Sequence< css::beans::PropertyValue >& _out_rValues ) const; |
227 | | |
228 | | /** transforms the collection to a sequence of NamedValues |
229 | | |
230 | | @return |
231 | | the number of elements in the sequence |
232 | | */ |
233 | | sal_Int32 operator >>= ( css::uno::Sequence< css::beans::NamedValue >& _out_rValues ) const; |
234 | | |
235 | | /** transforms the collection into a sequence of PropertyValues |
236 | | */ |
237 | | css::uno::Sequence< css::beans::PropertyValue > |
238 | | getPropertyValues() const |
239 | 17 | { |
240 | 17 | css::uno::Sequence< css::beans::PropertyValue > aValues; |
241 | 17 | *this >>= aValues; |
242 | 17 | return aValues; |
243 | 17 | } |
244 | | |
245 | | /** returns a Sequence< Any >, containing PropertyValues |
246 | | */ |
247 | | css::uno::Sequence< css::uno::Any > |
248 | | getWrappedPropertyValues() const |
249 | 5.33k | { |
250 | 5.33k | return impl_wrap< css::beans::PropertyValue >(); |
251 | 5.33k | } |
252 | | |
253 | | /** returns a Sequence< Any >, containing NamedValues |
254 | | */ |
255 | | css::uno::Sequence< css::uno::Any > |
256 | | getWrappedNamedValues() const |
257 | 0 | { |
258 | 0 | return impl_wrap< css::beans::NamedValue >(); |
259 | 0 | } |
260 | | |
261 | | /** transforms the collection into a sequence of NamedValues |
262 | | */ |
263 | | css::uno::Sequence< css::beans::NamedValue > |
264 | | getNamedValues() const |
265 | 60 | { |
266 | 60 | css::uno::Sequence< css::beans::NamedValue > aValues; |
267 | 60 | *this >>= aValues; |
268 | 60 | return aValues; |
269 | 60 | } |
270 | | |
271 | | private: |
272 | | void impl_assign( const css::uno::Any& i_rWrappedElements ); |
273 | | void impl_assign( const css::uno::Sequence< css::uno::Any >& _rArguments ); |
274 | | void impl_assign( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ); |
275 | | void impl_assign( const css::uno::Sequence< css::beans::NamedValue >& _rArguments ); |
276 | | |
277 | | bool get_ensureType( |
278 | | const OUString& _rValueName, |
279 | | void* _pValueLocation, |
280 | | const css::uno::Type& _rExpectedValueType |
281 | | ) const; |
282 | | |
283 | | static bool get_ensureType( |
284 | | const css::uno::Sequence<css::beans::PropertyValue> & rPropSeq, |
285 | | std::u16string_view _rValueName, |
286 | | void* _pValueLocation, |
287 | | const css::uno::Type& _rExpectedValueType |
288 | | ); |
289 | | |
290 | | const css::uno::Any& |
291 | | impl_get( const OUString& _rValueName ) const; |
292 | | |
293 | | bool impl_has( const OUString& _rValueName ) const; |
294 | | |
295 | | bool impl_put( const OUString& _rValueName, const css::uno::Any& _rValue ); |
296 | | |
297 | | bool impl_remove( const OUString& _rValueName ); |
298 | | |
299 | | template< class VALUE_TYPE > |
300 | | css::uno::Sequence< css::uno::Any > impl_wrap() const |
301 | 5.33k | { |
302 | 5.33k | css::uno::Sequence< VALUE_TYPE > aValues; |
303 | 5.33k | *this >>= aValues; |
304 | 5.33k | css::uno::Sequence< css::uno::Any > aWrappedValues( aValues.getLength() ); |
305 | 5.33k | std::transform(aValues.begin(), aValues.end(), aWrappedValues.getArray(), |
306 | 10.6k | [](const auto& val) { return css::uno::Any(val); });auto comphelper::NamedValueCollection::impl_wrap<com::sun::star::beans::PropertyValue>() const::{lambda(auto:1 const&)#1}::operator()<com::sun::star::beans::PropertyValue>(com::sun::star::beans::PropertyValue const&) constLine | Count | Source | 306 | 10.6k | [](const auto& val) { return css::uno::Any(val); }); |
Unexecuted instantiation: auto comphelper::NamedValueCollection::impl_wrap<com::sun::star::beans::NamedValue>() const::{lambda(auto:1 const&)#1}::operator()<com::sun::star::beans::NamedValue>(com::sun::star::beans::NamedValue const&) const |
307 | | |
308 | 5.33k | return aWrappedValues; |
309 | 5.33k | } com::sun::star::uno::Sequence<com::sun::star::uno::Any> comphelper::NamedValueCollection::impl_wrap<com::sun::star::beans::PropertyValue>() const Line | Count | Source | 301 | 5.33k | { | 302 | 5.33k | css::uno::Sequence< VALUE_TYPE > aValues; | 303 | 5.33k | *this >>= aValues; | 304 | 5.33k | css::uno::Sequence< css::uno::Any > aWrappedValues( aValues.getLength() ); | 305 | 5.33k | std::transform(aValues.begin(), aValues.end(), aWrappedValues.getArray(), | 306 | 5.33k | [](const auto& val) { return css::uno::Any(val); }); | 307 | | | 308 | 5.33k | return aWrappedValues; | 309 | 5.33k | } |
Unexecuted instantiation: com::sun::star::uno::Sequence<com::sun::star::uno::Any> comphelper::NamedValueCollection::impl_wrap<com::sun::star::beans::NamedValue>() const |
310 | | }; |
311 | | |
312 | | |
313 | | } // namespace comphelper |
314 | | |
315 | | |
316 | | #endif // INCLUDED_COMPHELPER_NAMEDVALUECOLLECTION_HXX |
317 | | |
318 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |