22 #include <com/sun/star/beans/NamedValue.hpp>
23 #include <com/sun/star/beans/PropertyValue.hpp>
24 #include <com/sun/star/lang/IllegalArgumentException.hpp>
58 if (!aSource.hasValue())
64 css::uno::Sequence< css::beans::NamedValue > lN;
71 css::uno::Sequence< css::beans::PropertyValue > lP;
78 throw css::lang::IllegalArgumentException(
79 "Any contains wrong type.", css::uno::Reference<css::uno::XInterface>(),
84 void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lSource)
86 sal_Int32 c = lSource.getLength();
91 css::beans::PropertyValue lP;
92 if (lSource[i] >>= lP)
95 (lP.Name.isEmpty()) ||
96 (!lP.Value.hasValue())
98 throw css::lang::IllegalArgumentException(
99 "PropertyValue struct contains no useful information.",
100 css::uno::Reference<css::uno::XInterface>(), -1);
101 (*this)[lP.Name] = lP.Value;
105 css::beans::NamedValue lN;
106 if (lSource[i] >>= lN)
109 (lN.Name.isEmpty()) ||
110 (!lN.Value.hasValue())
112 throw css::lang::IllegalArgumentException(
113 "NamedValue struct contains no useful information.",
114 css::uno::Reference<css::uno::XInterface>(), -1);
115 (*this)[lN.Name] = lN.Value;
120 if (lSource[i].hasValue())
121 throw css::lang::IllegalArgumentException(
122 "Any contains wrong type.",
123 css::uno::Reference<css::uno::XInterface>(), -1);
127 void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::beans::PropertyValue >& lSource)
131 sal_Int32 c = lSource.getLength();
132 const css::beans::PropertyValue* pSource = lSource.getConstArray();
134 for (sal_Int32
i=0;
i<c; ++
i)
135 (*
this)[pSource[
i].Name] = pSource[
i].Value;
138 void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::beans::NamedValue >& lSource)
142 sal_Int32 c = lSource.getLength();
143 const css::beans::NamedValue* pSource = lSource.getConstArray();
145 for (sal_Int32
i=0;
i<c; ++
i)
146 (*
this)[pSource[
i].Name] = pSource[
i].Value;
151 sal_Int32 c =
static_cast<sal_Int32
>(
size());
152 lDestination.realloc(c);
153 css::beans::PropertyValue* pDestination = lDestination.getArray();
160 pDestination[i].Name = pThis->first ;
161 pDestination[i].Value = pThis->second;
168 sal_Int32 c =
static_cast<sal_Int32
>(
size());
169 lDestination.realloc(c);
170 css::beans::NamedValue* pDestination = lDestination.getArray();
177 pDestination[i].Name = pThis->first ;
178 pDestination[i].Value = pThis->second;
185 css::uno::Any aDestination;
186 if (bAsPropertyValueList)
195 css::uno::Sequence< css::beans::NamedValue > lReturn;
202 css::uno::Sequence< css::beans::PropertyValue > lReturn;
209 for (
auto const& elem : rCheck)
211 const OUString& sCheckName = elem.first;
212 const css::uno::Any& aCheckValue = elem.second;
218 const css::uno::Any& aFoundValue = pFound->second;
219 if (aFoundValue != aCheckValue)
228 for (
auto const& elem : rUpdate)
230 const OUString&
sName = elem.first;
231 const css::uno::Any& aValue = elem.second;
233 (*this)[sName] = aValue;
SequenceAsHashMapBase::const_iterator const_iterator
void operator<<(const css::uno::Any &aSource)
fill this map from the given Any, which of course must contain a suitable sequence of element types "...
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
return this map instance to as a PropertyValue sequence, which can be used in const environments only...
css::uno::Sequence< css::beans::NamedValue > getAsConstNamedValueList() const
return this map instance to as a NamedValue sequence, which can be used in const environments only...
void update(const SequenceAsHashMap &rSource)
merge all values from the given map into this one.
css::uno::Any getAsConstAny(bool bAsPropertyValue) const
return this map instance as an Any, which can be used in const environments only. ...
iterator find(const OUString &rKey)
SequenceAsHashMap()
creates an empty hash map.
bool match(const SequenceAsHashMap &rCheck) const
check if all items of given map exists in these called map also.
void operator>>(css::uno::Sequence< css::beans::PropertyValue > &lDestination) const
converts this map instance to an PropertyValue sequence.