/src/libreoffice/include/comphelper/sequenceashashmap.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_SEQUENCEASHASHMAP_HXX |
21 | | #define INCLUDED_COMPHELPER_SEQUENCEASHASHMAP_HXX |
22 | | |
23 | | #include <unordered_map> |
24 | | #include <com/sun/star/uno/Any.hxx> |
25 | | |
26 | | #include <comphelper/comphelperdllapi.h> |
27 | | |
28 | | namespace com::sun::star::beans { struct NamedValue; } |
29 | | namespace com::sun::star::beans { struct PropertyValue; } |
30 | | namespace com::sun::star::uno { template <typename> class Sequence; } |
31 | | |
32 | | namespace comphelper{ |
33 | | |
34 | | |
35 | | /** @short Implements a stl hash map on top of some |
36 | | specialized sequence from type PropertyValue |
37 | | or NamedValue. |
38 | | |
39 | | @descr That provides the possibility to modify |
40 | | such name sequences very easy ... |
41 | | */ |
42 | | |
43 | | /** Cache the hash code since calculating it for every comparison adds up */ |
44 | | struct OUStringAndHashCode |
45 | | { |
46 | | OUString maString; |
47 | | sal_Int32 mnHashCode; |
48 | | |
49 | 13.1M | OUStringAndHashCode(OUString s) : maString(std::move(s)), mnHashCode(maString.hashCode()) {} |
50 | | }; |
51 | | struct OUStringAndHashCodeEqual |
52 | | { |
53 | | bool operator()(const OUStringAndHashCode & lhs, const OUStringAndHashCode & rhs) const |
54 | 775k | { |
55 | 775k | return lhs.mnHashCode == rhs.mnHashCode && lhs.maString == rhs.maString; |
56 | 775k | } |
57 | | }; |
58 | | struct OUStringAndHashCodeHash |
59 | | { |
60 | | size_t operator()(const OUStringAndHashCode & i) const |
61 | 13.2M | { |
62 | 13.2M | return i.mnHashCode; |
63 | 13.2M | } |
64 | | }; |
65 | | using SequenceAsHashMapBase = std::unordered_map<OUStringAndHashCode, css::uno::Any, OUStringAndHashCodeHash, OUStringAndHashCodeEqual>; |
66 | | |
67 | | class SAL_WARN_UNUSED COMPHELPER_DLLPUBLIC SequenceAsHashMap |
68 | | { |
69 | | |
70 | | public: |
71 | | |
72 | | |
73 | | /** @short creates an empty hash map. |
74 | | */ |
75 | | SequenceAsHashMap(); |
76 | | |
77 | | |
78 | | /** @see operator<<(const css::uno::Any&) |
79 | | */ |
80 | | SequenceAsHashMap(const css::uno::Any& aSource); |
81 | | |
82 | | |
83 | | /** @see operator<<(const css::uno::Sequence< css::uno::Any >&) |
84 | | */ |
85 | | SequenceAsHashMap(const css::uno::Sequence< css::uno::Any >& lSource); |
86 | | |
87 | | |
88 | | /** @see operator<<(const css::uno::Sequence< css::beans::PropertyValue >&) |
89 | | */ |
90 | | SequenceAsHashMap(const css::uno::Sequence< css::beans::PropertyValue >& lSource); |
91 | | |
92 | | |
93 | | /** @see operator<<(const css::uno::Sequence< css::beans::NamedValue >&) |
94 | | */ |
95 | | SequenceAsHashMap(const css::uno::Sequence< css::beans::NamedValue >& lSource); |
96 | | |
97 | | |
98 | | /** @short fill this map from the given |
99 | | Any, which of course must contain |
100 | | a suitable sequence of element types |
101 | | "css.beans.PropertyValue" or "css.beans.NamedValue". |
102 | | |
103 | | @attention If the given Any is an empty one |
104 | | (if it's set to VOID), no exception |
105 | | is thrown. In such case this instance will |
106 | | be created as an empty one too! |
107 | | |
108 | | @param aSource |
109 | | contains the new items for this map. |
110 | | |
111 | | @throw A css::lang::IllegalArgumentException |
112 | | is thrown, if the given Any does not contain a suitable sequence ... |
113 | | but not if it's a VOID Any! |
114 | | */ |
115 | | void operator<<(const css::uno::Any& aSource); |
116 | | |
117 | | |
118 | | /** @short fill this map from the given |
119 | | sequence, where every Any must contain |
120 | | an item from type "css.beans.PropertyValue" |
121 | | "css.beans.NamedValue". |
122 | | |
123 | | @param lSource |
124 | | contains the new items for this map. |
125 | | |
126 | | @throw A css::lang::IllegalArgumentException |
127 | | is thrown, if the given Any sequence |
128 | | uses wrong types for its items. VOID Any will be ignored! |
129 | | */ |
130 | | void operator<<(const css::uno::Sequence< css::uno::Any >& lSource); |
131 | | |
132 | | |
133 | | /** @short fill this map from the given |
134 | | PropertyValue sequence. |
135 | | |
136 | | @param lSource |
137 | | contains the new items for this map. |
138 | | */ |
139 | | void operator<<(const css::uno::Sequence< css::beans::PropertyValue >& lSource); |
140 | | |
141 | | |
142 | | /** @short fill this map from the given |
143 | | NamedValue sequence. |
144 | | |
145 | | @param lSource |
146 | | contains the new items for this map. |
147 | | */ |
148 | | void operator<<(const css::uno::Sequence< css::beans::NamedValue >& lSource); |
149 | | |
150 | | |
151 | | /** @short converts this map instance to an |
152 | | PropertyValue sequence. |
153 | | |
154 | | @param lDestination |
155 | | target sequence for converting. |
156 | | */ |
157 | | void operator>>(css::uno::Sequence< css::beans::PropertyValue >& lDestination) const; |
158 | | |
159 | | |
160 | | /** @short converts this map instance to an |
161 | | NamedValue sequence. |
162 | | |
163 | | @param lDestination |
164 | | target sequence for converting. |
165 | | */ |
166 | | void operator>>(css::uno::Sequence< css::beans::NamedValue >& lDestination) const; |
167 | | |
168 | | |
169 | | /** @short return this map instance as an |
170 | | Any, which can be |
171 | | used in const environments only. |
172 | | |
173 | | @descr It's made const to prevent using of the |
174 | | return value directly as an in/out parameter! |
175 | | usage: myMethod(stlDequeAdapter.getAsAnyList()); |
176 | | |
177 | | @param bAsPropertyValue |
178 | | switch between using of PropertyValue or NamedValue as |
179 | | value type. |
180 | | |
181 | | @return A const Any, which |
182 | | contains all items of this map. |
183 | | */ |
184 | | css::uno::Any getAsConstAny(bool bAsPropertyValue) const; |
185 | | |
186 | | |
187 | | /** @short return this map instance to as a |
188 | | NamedValue sequence, which can be |
189 | | used in const environments only. |
190 | | |
191 | | @descr It's made const to prevent using of the |
192 | | return value directly as an in/out parameter! |
193 | | usage: myMethod(stlDequeAdapter.getAsNamedValueList()); |
194 | | |
195 | | @return A const sequence of type NamedValue, which |
196 | | contains all items of this map. |
197 | | */ |
198 | | css::uno::Sequence< css::beans::NamedValue > getAsConstNamedValueList() const; |
199 | | |
200 | | |
201 | | /** @short return this map instance to as a |
202 | | PropertyValue sequence, which can be |
203 | | used in const environments only. |
204 | | |
205 | | @descr It's made const to prevent using of the |
206 | | return value directly as an in/out parameter! |
207 | | usage: myMethod(stlDequeAdapter.getAsPropertyValueList()); |
208 | | |
209 | | @return A const sequence of type PropertyValue, which |
210 | | contains all items of this map. |
211 | | */ |
212 | | css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const; |
213 | | |
214 | | |
215 | | /** @short check if the specified item exists |
216 | | and return its (unpacked!) value or it returns the |
217 | | specified default value otherwise. |
218 | | |
219 | | @descr If a value should be extracted only in case |
220 | | the requested property exists really (without creating |
221 | | of new items as it the index operator of a |
222 | | hash map does!) this method can be used. |
223 | | |
224 | | @param sKey |
225 | | key name of the item. |
226 | | |
227 | | @param aDefault |
228 | | the default value, which is returned |
229 | | if the specified item could not |
230 | | be found. |
231 | | |
232 | | @return The (unpacked!) value of the specified property or |
233 | | the given default value otherwise. |
234 | | |
235 | | @attention "unpacked" means the Any content of every iterator->second! |
236 | | */ |
237 | | template< class TValueType > |
238 | | TValueType getUnpackedValueOrDefault(const OUString& sKey , |
239 | | const TValueType& aDefault) const |
240 | 873k | { |
241 | 873k | auto pIt = m_aMap.find(sKey); |
242 | 873k | if (pIt == m_aMap.end()) |
243 | 652k | return aDefault; |
244 | | |
245 | 220k | TValueType aValue = TValueType(); |
246 | 220k | if (!(pIt->second >>= aValue)) |
247 | 0 | return aDefault; |
248 | | |
249 | 220k | return aValue; |
250 | 220k | } rtl::OUString comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<rtl::OUString>(rtl::OUString const&, rtl::OUString const&) const Line | Count | Source | 240 | 328k | { | 241 | 328k | auto pIt = m_aMap.find(sKey); | 242 | 328k | if (pIt == m_aMap.end()) | 243 | 247k | return aDefault; | 244 | | | 245 | 81.3k | TValueType aValue = TValueType(); | 246 | 81.3k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 81.3k | return aValue; | 250 | 81.3k | } |
Unexecuted instantiation: int comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<int>(rtl::OUString const&, int const&) const Unexecuted instantiation: com::sun::star::uno::Sequence<int> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<int> >(rtl::OUString const&, com::sun::star::uno::Sequence<int> const&) const Unexecuted instantiation: com::sun::star::uno::Sequence<signed char> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<signed char> >(rtl::OUString const&, com::sun::star::uno::Sequence<signed char> const&) const Unexecuted instantiation: short comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<short>(rtl::OUString const&, short const&) const bool comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<bool>(rtl::OUString const&, bool const&) const Line | Count | Source | 240 | 144k | { | 241 | 144k | auto pIt = m_aMap.find(sKey); | 242 | 144k | if (pIt == m_aMap.end()) | 243 | 111k | return aDefault; | 244 | | | 245 | 32.9k | TValueType aValue = TValueType(); | 246 | 32.9k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 32.9k | return aValue; | 250 | 32.9k | } |
com::sun::star::uno::Sequence<rtl::OUString> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<rtl::OUString> >(rtl::OUString const&, com::sun::star::uno::Sequence<rtl::OUString> const&) const Line | Count | Source | 240 | 77.9k | { | 241 | 77.9k | auto pIt = m_aMap.find(sKey); | 242 | 77.9k | if (pIt == m_aMap.end()) | 243 | 0 | return aDefault; | 244 | | | 245 | 77.9k | TValueType aValue = TValueType(); | 246 | 77.9k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 77.9k | return aValue; | 250 | 77.9k | } |
com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&) const Line | Count | Source | 240 | 16.8k | { | 241 | 16.8k | auto pIt = m_aMap.find(sKey); | 242 | 16.8k | if (pIt == m_aMap.end()) | 243 | 16.8k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) const Line | Count | Source | 240 | 29.8k | { | 241 | 29.8k | auto pIt = m_aMap.find(sKey); | 242 | 29.8k | if (pIt == m_aMap.end()) | 243 | 13.0k | return aDefault; | 244 | | | 245 | 16.8k | TValueType aValue = TValueType(); | 246 | 16.8k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 16.8k | return aValue; | 250 | 16.8k | } |
com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<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 Line | Count | Source | 240 | 43.4k | { | 241 | 43.4k | auto pIt = m_aMap.find(sKey); | 242 | 43.4k | if (pIt == m_aMap.end()) | 243 | 40.1k | return aDefault; | 244 | | | 245 | 3.36k | TValueType aValue = TValueType(); | 246 | 3.36k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 3.36k | return aValue; | 250 | 3.36k | } |
Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::ucb::XContent> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::ucb::XContent> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XContent> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::io::XInputStream> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::io::XInputStream> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&) const com::sun::star::uno::Reference<com::sun::star::io::XStream> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::io::XStream> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::io::XStream> const&) const Line | Count | Source | 240 | 16.8k | { | 241 | 16.8k | auto pIt = m_aMap.find(sKey); | 242 | 16.8k | if (pIt == m_aMap.end()) | 243 | 16.8k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<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 Line | Count | Source | 240 | 41.2k | { | 241 | 41.2k | auto pIt = m_aMap.find(sKey); | 242 | 41.2k | if (pIt == m_aMap.end()) | 243 | 33.0k | return aDefault; | 244 | | | 245 | 8.22k | TValueType aValue = TValueType(); | 246 | 8.22k | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 8.22k | return aValue; | 250 | 8.22k | } |
com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<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 Line | Count | Source | 240 | 113k | { | 241 | 113k | auto pIt = m_aMap.find(sKey); | 242 | 113k | if (pIt == m_aMap.end()) | 243 | 113k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
com::sun::star::uno::Reference<com::sun::star::drawing::XShape> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::drawing::XShape> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) const Line | Count | Source | 240 | 29.8k | { | 241 | 29.8k | auto pIt = m_aMap.find(sKey); | 242 | 29.8k | if (pIt == m_aMap.end()) | 243 | 29.8k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
Unexecuted instantiation: com::sun::star::uno::Sequence<com::sun::star::uno::Any> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<com::sun::star::uno::Any> >(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::embed::XStorage> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::embed::XStorage> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) const com::sun::star::uno::Reference<com::sun::star::awt::XWindow> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<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 Line | Count | Source | 240 | 8.22k | { | 241 | 8.22k | auto pIt = m_aMap.find(sKey); | 242 | 8.22k | if (pIt == m_aMap.end()) | 243 | 8.22k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
Unexecuted instantiation: com::sun::star::uno::Reference<com::sun::star::frame::XModel> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::frame::XModel> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&) const com::sun::star::awt::Rectangle comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::awt::Rectangle>(rtl::OUString const&, com::sun::star::awt::Rectangle const&) const Line | Count | Source | 240 | 8.22k | { | 241 | 8.22k | auto pIt = m_aMap.find(sKey); | 242 | 8.22k | if (pIt == m_aMap.end()) | 243 | 8.22k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
Unexecuted instantiation: com::sun::star::uno::Sequence<double> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Sequence<double> >(rtl::OUString const&, com::sun::star::uno::Sequence<double> const&) const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> comphelper::SequenceAsHashMap::getUnpackedValueOrDefault<com::sun::star::uno::Reference<com::sun::star::text::XTextRange> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) const Line | Count | Source | 240 | 13.5k | { | 241 | 13.5k | auto pIt = m_aMap.find(sKey); | 242 | 13.5k | if (pIt == m_aMap.end()) | 243 | 13.5k | return aDefault; | 244 | | | 245 | 0 | TValueType aValue = TValueType(); | 246 | 0 | if (!(pIt->second >>= aValue)) | 247 | 0 | return aDefault; | 248 | | | 249 | 0 | return aValue; | 250 | 0 | } |
|
251 | | |
252 | | /** @short check if the specified item exists |
253 | | and return its value or it returns |
254 | | an empty css::uno::Any. |
255 | | |
256 | | @descr If a value should be extracted only in case |
257 | | the requested property exists really (without creating |
258 | | of new items as the index operator of a |
259 | | hash map does!) this method can be used. |
260 | | |
261 | | @param sKey |
262 | | key name of the item. |
263 | | |
264 | | @return The value of the specified property or |
265 | | an empty css::uno::Any. |
266 | | */ |
267 | | css::uno::Any getValue(const OUString& sKey) const |
268 | 3.90k | { |
269 | 3.90k | auto pIt = m_aMap.find(sKey); |
270 | 3.90k | if (pIt == m_aMap.end()) |
271 | 2.54k | return css::uno::Any(); |
272 | | |
273 | 1.35k | return pIt->second; |
274 | 3.90k | } |
275 | | |
276 | | |
277 | | /** @short creates a new item with the specified |
278 | | name and value only in case such item name |
279 | | does not already exist. |
280 | | |
281 | | @descr To check if the property already exists only |
282 | | its name is used for compare. Its value isn't |
283 | | checked! |
284 | | |
285 | | @param sKey |
286 | | key name of the property. |
287 | | |
288 | | @param aValue |
289 | | the new (unpacked!) value. |
290 | | Note: This value will be transformed to an Any |
291 | | internally, because only Any values can be |
292 | | part of a PropertyValue or NamedValue structure. |
293 | | |
294 | | @return TRUE if this property was added as new item; |
295 | | FALSE if it already exists. |
296 | | */ |
297 | | template< class TValueType > |
298 | | bool createItemIfMissing(const OUString& sKey , |
299 | | const TValueType& aValue) |
300 | 0 | { |
301 | 0 | if (!m_aMap.contains(sKey)) |
302 | 0 | { |
303 | 0 | (*this)[sKey] = css::uno::toAny(aValue); |
304 | 0 | return true; |
305 | 0 | } |
306 | | |
307 | 0 | return false; |
308 | 0 | } Unexecuted instantiation: bool comphelper::SequenceAsHashMap::createItemIfMissing<int>(rtl::OUString const&, int const&) Unexecuted instantiation: bool comphelper::SequenceAsHashMap::createItemIfMissing<com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> >(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> const&) |
309 | | |
310 | | |
311 | | /** @short check if all items of given map |
312 | | exists in these called map also. |
313 | | |
314 | | @descr Every item of the given map must exists |
315 | | with same name and value inside these map. |
316 | | But these map can contain additional items |
317 | | which are not part of the search-map. |
318 | | |
319 | | @param rCheck |
320 | | the map containing all items for checking. |
321 | | |
322 | | @return |
323 | | TRUE if all items of Rcheck could be found |
324 | | in these map; FALSE otherwise. |
325 | | */ |
326 | | bool match(const SequenceAsHashMap& rCheck) const; |
327 | | |
328 | | |
329 | | /** @short merge all values from the given map into |
330 | | this one. |
331 | | |
332 | | @descr Existing items will be overwritten ... |
333 | | missing items will be created new ... |
334 | | but non specified items will stay alive ! |
335 | | |
336 | | @param rSource |
337 | | the map containing all items for the update. |
338 | | */ |
339 | | void update(const SequenceAsHashMap& rSource); |
340 | | |
341 | | css::uno::Any& operator[](const OUString& rKey) |
342 | 11.9M | { |
343 | 11.9M | return m_aMap[rKey]; |
344 | 11.9M | } |
345 | | |
346 | | css::uno::Any& operator[](const OUStringAndHashCode& rKey) |
347 | 0 | { |
348 | 0 | return m_aMap[rKey]; |
349 | 0 | } |
350 | | |
351 | | using iterator = SequenceAsHashMapBase::iterator; |
352 | | using const_iterator = SequenceAsHashMapBase::const_iterator; |
353 | | |
354 | | void clear() |
355 | 1.12M | { |
356 | 1.12M | m_aMap.clear(); |
357 | 1.12M | } |
358 | | |
359 | | size_t size() const |
360 | 573k | { |
361 | 573k | return m_aMap.size(); |
362 | 573k | } |
363 | | |
364 | | bool empty() const |
365 | 40.9k | { |
366 | 40.9k | return m_aMap.empty(); |
367 | 40.9k | } |
368 | | |
369 | | iterator begin() |
370 | 0 | { |
371 | 0 | return m_aMap.begin(); |
372 | 0 | } |
373 | | |
374 | | const_iterator begin() const |
375 | 518k | { |
376 | 518k | return m_aMap.begin(); |
377 | 518k | } |
378 | | |
379 | | iterator end() |
380 | 201k | { |
381 | 201k | return m_aMap.end(); |
382 | 201k | } |
383 | | |
384 | | const_iterator end() const |
385 | 4.24M | { |
386 | 4.24M | return m_aMap.end(); |
387 | 4.24M | } |
388 | | |
389 | | iterator find(const OUString& rKey) |
390 | 278k | { |
391 | 278k | return m_aMap.find(rKey); |
392 | 278k | } |
393 | | |
394 | | const_iterator find(const OUString& rKey) const |
395 | 8.24k | { |
396 | 8.24k | return m_aMap.find(rKey); |
397 | 8.24k | } |
398 | | |
399 | | iterator find(const OUStringAndHashCode& rKey) |
400 | 0 | { |
401 | 0 | return m_aMap.find(rKey); |
402 | 0 | } |
403 | | |
404 | | const_iterator find(const OUStringAndHashCode& rKey) const |
405 | 0 | { |
406 | 0 | return m_aMap.find(rKey); |
407 | 0 | } |
408 | | |
409 | | bool contains(const OUString& rKey) const |
410 | 18.8k | { |
411 | 18.8k | return m_aMap.contains(rKey); |
412 | 18.8k | } |
413 | | |
414 | | iterator erase(iterator it) |
415 | 0 | { |
416 | 0 | return m_aMap.erase(it); |
417 | 0 | } |
418 | | |
419 | | size_t erase(const OUString& rKey) |
420 | 74 | { |
421 | 74 | return m_aMap.erase(rKey); |
422 | 74 | } |
423 | | |
424 | | private: |
425 | | SequenceAsHashMapBase m_aMap; |
426 | | }; |
427 | | |
428 | | } // namespace comphelper |
429 | | |
430 | | #endif // INCLUDED_COMPHELPER_SEQUENCEASHASHMAP_HXX |
431 | | |
432 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |