LibreOffice Module comphelper (master)  1
Public Types | Public Member Functions | Private Attributes | List of all members
comphelper::SequenceAsHashMap Class Reference

#include <sequenceashashmap.hxx>

Public Types

using iterator = SequenceAsHashMapBase::iterator
 
using const_iterator = SequenceAsHashMapBase::const_iterator
 

Public Member Functions

 SequenceAsHashMap ()
 creates an empty hash map. More...
 
 SequenceAsHashMap (const css::uno::Any &aSource)
 
 SequenceAsHashMap (const css::uno::Sequence< css::uno::Any > &lSource)
 
 SequenceAsHashMap (const css::uno::Sequence< css::beans::PropertyValue > &lSource)
 
 SequenceAsHashMap (const css::uno::Sequence< css::beans::NamedValue > &lSource)
 
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.beans.PropertyValue" or "css.beans.NamedValue". More...
 
void operator<< (const css::uno::Sequence< css::uno::Any > &lSource)
 fill this map from the given sequence, where every Any must contain an item from type "css.beans.PropertyValue" "css.beans.NamedValue". More...
 
void operator<< (const css::uno::Sequence< css::beans::PropertyValue > &lSource)
 fill this map from the given PropertyValue sequence. More...
 
void operator<< (const css::uno::Sequence< css::beans::NamedValue > &lSource)
 fill this map from the given NamedValue sequence. More...
 
void operator>> (css::uno::Sequence< css::beans::PropertyValue > &lDestination) const
 converts this map instance to an PropertyValue sequence. More...
 
void operator>> (css::uno::Sequence< css::beans::NamedValue > &lDestination) const
 converts this map instance to an NamedValue sequence. More...
 
css::uno::Any getAsConstAny (bool bAsPropertyValue) const
 return this map instance as an Any, which can be used in const environments only. More...
 
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. More...
 
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. More...
 
template<class TValueType >
TValueType getUnpackedValueOrDefault (const OUString &sKey, const TValueType &aDefault) const
 check if the specified item exists and return its (unpacked!) value or it returns the specified default value otherwise. More...
 
css::uno::Any getValue (const OUString &sKey) const
 check if the specified item exists and return its value or it returns an empty css::uno::Any. More...
 
template<class TValueType >
bool createItemIfMissing (const OUString &sKey, const TValueType &aValue)
 creates a new item with the specified name and value only in case such item name does not already exist. More...
 
bool match (const SequenceAsHashMap &rCheck) const
 check if all items of given map exists in these called map also. More...
 
void update (const SequenceAsHashMap &rSource)
 merge all values from the given map into this one. More...
 
css::uno::Any & operator[] (const OUString &rKey)
 
void clear ()
 
size_t size () const
 
bool empty () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (const OUString &rKey)
 
const_iterator find (const OUString &rKey) const
 
iterator erase (iterator it)
 
size_t erase (const OUString &rKey)
 

Private Attributes

SequenceAsHashMapBase m_aMap
 

Detailed Description

Definition at line 44 of file sequenceashashmap.hxx.

Member Typedef Documentation

using comphelper::SequenceAsHashMap::const_iterator = SequenceAsHashMapBase::const_iterator

Definition at line 324 of file sequenceashashmap.hxx.

using comphelper::SequenceAsHashMap::iterator = SequenceAsHashMapBase::iterator

Definition at line 323 of file sequenceashashmap.hxx.

Constructor & Destructor Documentation

comphelper::SequenceAsHashMap::SequenceAsHashMap ( )

creates an empty hash map.

Definition at line 30 of file sequenceashashmap.cxx.

comphelper::SequenceAsHashMap::SequenceAsHashMap ( const css::uno::Any &  aSource)
See also
operator<<(const css::uno::Any&)

Definition at line 34 of file sequenceashashmap.cxx.

comphelper::SequenceAsHashMap::SequenceAsHashMap ( const css::uno::Sequence< css::uno::Any > &  lSource)
comphelper::SequenceAsHashMap::SequenceAsHashMap ( const css::uno::Sequence< css::beans::PropertyValue > &  lSource)
comphelper::SequenceAsHashMap::SequenceAsHashMap ( const css::uno::Sequence< css::beans::NamedValue > &  lSource)

Member Function Documentation

iterator comphelper::SequenceAsHashMap::begin ( )
inline

Definition at line 341 of file sequenceashashmap.hxx.

Referenced by operator>>().

const_iterator comphelper::SequenceAsHashMap::begin ( ) const
inline

Definition at line 346 of file sequenceashashmap.hxx.

void comphelper::SequenceAsHashMap::clear ( )
inline

Definition at line 326 of file sequenceashashmap.hxx.

Referenced by operator<<().

template<class TValueType >
bool comphelper::SequenceAsHashMap::createItemIfMissing ( const OUString &  sKey,
const TValueType &  aValue 
)
inline

creates a new item with the specified name and value only in case such item name does not already exist.

To check if the property already exists only its name is used for compare. Its value isn't checked!

Parameters
sKeykey name of the property.
aValuethe new (unpacked!) value. Note: This value will be transformed to an Any internally, because only Any values can be part of a PropertyValue or NamedValue structure.
Returns
TRUE if this property was added as new item; FALSE if it already exists.

Definition at line 275 of file sequenceashashmap.hxx.

bool comphelper::SequenceAsHashMap::empty ( ) const
inline

Definition at line 336 of file sequenceashashmap.hxx.

iterator comphelper::SequenceAsHashMap::end ( )
inline

Definition at line 351 of file sequenceashashmap.hxx.

Referenced by match(), and operator>>().

const_iterator comphelper::SequenceAsHashMap::end ( ) const
inline

Definition at line 356 of file sequenceashashmap.hxx.

iterator comphelper::SequenceAsHashMap::erase ( iterator  it)
inline

Definition at line 371 of file sequenceashashmap.hxx.

size_t comphelper::SequenceAsHashMap::erase ( const OUString &  rKey)
inline

Definition at line 376 of file sequenceashashmap.hxx.

iterator comphelper::SequenceAsHashMap::find ( const OUString &  rKey)
inline

Definition at line 361 of file sequenceashashmap.hxx.

Referenced by match().

const_iterator comphelper::SequenceAsHashMap::find ( const OUString &  rKey) const
inline

Definition at line 366 of file sequenceashashmap.hxx.

css::uno::Any comphelper::SequenceAsHashMap::getAsConstAny ( bool  bAsPropertyValue) const

return this map instance as an Any, which can be used in const environments only.

It's made const to prevent using of the return value directly as an in/out parameter! usage: myMethod(stlDequeAdapter.getAsAnyList());

Parameters
bAsPropertyValueswitch between using of PropertyValue or NamedValue as value type.
Returns
A const Any, which contains all items of this map.

Definition at line 183 of file sequenceashashmap.cxx.

References getAsConstNamedValueList(), and getAsConstPropertyValueList().

css::uno::Sequence< css::beans::NamedValue > comphelper::SequenceAsHashMap::getAsConstNamedValueList ( ) const

return this map instance to as a NamedValue sequence, which can be used in const environments only.

It's made const to prevent using of the return value directly as an in/out parameter! usage: myMethod(stlDequeAdapter.getAsNamedValueList());

Returns
A const sequence of type NamedValue, which contains all items of this map.

Definition at line 193 of file sequenceashashmap.cxx.

Referenced by getAsConstAny().

css::uno::Sequence< css::beans::PropertyValue > comphelper::SequenceAsHashMap::getAsConstPropertyValueList ( ) const

return this map instance to as a PropertyValue sequence, which can be used in const environments only.

It's made const to prevent using of the return value directly as an in/out parameter! usage: myMethod(stlDequeAdapter.getAsPropertyValueList());

Returns
A const sequence of type PropertyValue, which contains all items of this map.

Definition at line 200 of file sequenceashashmap.cxx.

Referenced by getAsConstAny().

template<class TValueType >
TValueType comphelper::SequenceAsHashMap::getUnpackedValueOrDefault ( const OUString &  sKey,
const TValueType &  aDefault 
) const
inline

check if the specified item exists and return its (unpacked!) value or it returns the specified default value otherwise.

If a value should be extracted only in case the requested property exists really (without creating of new items as it the index operator of a hash map does!) this method can be used.

Parameters
sKeykey name of the item.
aDefaultthe default value, which is returned if the specified item could not be found.
Returns
The (unpacked!) value of the specified property or the given default value otherwise.
Attention:
"unpacked" means the Any content of every iterator->second!

Definition at line 215 of file sequenceashashmap.hxx.

Referenced by comphelper::MimeConfigurationHelper::GetDefaultFilterFromServiceName(), comphelper::MimeConfigurationHelper::GetExportFilterFromImportFilter(), and comphelper::MimeConfigurationHelper::SearchForFilter().

css::uno::Any comphelper::SequenceAsHashMap::getValue ( const OUString &  sKey) const
inline

check if the specified item exists and return its value or it returns an empty css::uno::Any.

If a value should be extracted only in case the requested property exists really (without creating of new items as the index operator of a hash map does!) this method can be used.

Parameters
sKeykey name of the item.
Returns
The value of the specified property or an empty css::uno::Any.

Definition at line 244 of file sequenceashashmap.hxx.

bool comphelper::SequenceAsHashMap::match ( const SequenceAsHashMap rCheck) const

check if all items of given map exists in these called map also.

Every item of the given map must exists with same name and value inside these map. But these map can contain additional items which are not part of the search-map.

Parameters
rCheckthe map containing all items for checking.
Returns
TRUE if all items of Rcheck could be found in these map; FALSE otherwise.

Definition at line 207 of file sequenceashashmap.cxx.

References end(), and find().

void comphelper::SequenceAsHashMap::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.beans.PropertyValue" or "css.beans.NamedValue".

Attention:
If the given Any is an empty one (if it's set to VOID), no exception is thrown. In such case this instance will be created as an empty one too!
Parameters
aSourcecontains the new items for this map.
Exceptions
Acss::lang::IllegalArgumentException is thrown, if the given Any does not contain a suitable sequence ... but not if it's a VOID Any!

Definition at line 55 of file sequenceashashmap.cxx.

References clear().

void comphelper::SequenceAsHashMap::operator<< ( const css::uno::Sequence< css::uno::Any > &  lSource)

fill this map from the given sequence, where every Any must contain an item from type "css.beans.PropertyValue" "css.beans.NamedValue".

Parameters
lSourcecontains the new items for this map.
Exceptions
Acss::lang::IllegalArgumentException is thrown, if the given Any sequence uses wrong types for its items. VOID Any will be ignored!

Definition at line 84 of file sequenceashashmap.cxx.

References i.

void comphelper::SequenceAsHashMap::operator<< ( const css::uno::Sequence< css::beans::PropertyValue > &  lSource)

fill this map from the given PropertyValue sequence.

Parameters
lSourcecontains the new items for this map.

Definition at line 127 of file sequenceashashmap.cxx.

References i.

void comphelper::SequenceAsHashMap::operator<< ( const css::uno::Sequence< css::beans::NamedValue > &  lSource)

fill this map from the given NamedValue sequence.

Parameters
lSourcecontains the new items for this map.

Definition at line 138 of file sequenceashashmap.cxx.

References i.

void comphelper::SequenceAsHashMap::operator>> ( css::uno::Sequence< css::beans::PropertyValue > &  lDestination) const

converts this map instance to an PropertyValue sequence.

Parameters
lDestinationtarget sequence for converting.

Definition at line 149 of file sequenceashashmap.cxx.

References begin(), end(), i, and size().

void comphelper::SequenceAsHashMap::operator>> ( css::uno::Sequence< css::beans::NamedValue > &  lDestination) const

converts this map instance to an NamedValue sequence.

Parameters
lDestinationtarget sequence for converting.

Definition at line 166 of file sequenceashashmap.cxx.

References begin(), end(), i, and size().

css::uno::Any& comphelper::SequenceAsHashMap::operator[] ( const OUString &  rKey)
inline

Definition at line 318 of file sequenceashashmap.hxx.

size_t comphelper::SequenceAsHashMap::size ( ) const
inline

Definition at line 331 of file sequenceashashmap.hxx.

Referenced by operator>>().

void comphelper::SequenceAsHashMap::update ( const SequenceAsHashMap rSource)

merge all values from the given map into this one.

Existing items will be overwritten ... missing items will be created new ... but non specified items will stay alive !

Parameters
rSourcethe map containing all items for the update.

Definition at line 226 of file sequenceashashmap.cxx.

References sName.

Member Data Documentation

SequenceAsHashMapBase comphelper::SequenceAsHashMap::m_aMap
private

Definition at line 382 of file sequenceashashmap.hxx.


The documentation for this class was generated from the following files: