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)
 
css::uno::Any & operator[] (const OUStringAndHashCode &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 find (const OUStringAndHashCode &rKey)
 
const_iterator find (const OUStringAndHashCode &rKey) const
 
iterator erase (iterator it)
 
size_t erase (const OUString &rKey)
 

Private Attributes

SequenceAsHashMapBase m_aMap
 

Detailed Description

Definition at line 66 of file sequenceashashmap.hxx.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 351 of file sequenceashashmap.hxx.

◆ iterator

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

Definition at line 350 of file sequenceashashmap.hxx.

Constructor & Destructor Documentation

◆ SequenceAsHashMap() [1/5]

comphelper::SequenceAsHashMap::SequenceAsHashMap ( )

creates an empty hash map.

Definition at line 103 of file sequenceashashmap.cxx.

◆ SequenceAsHashMap() [2/5]

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

Definition at line 107 of file sequenceashashmap.cxx.

◆ SequenceAsHashMap() [3/5]

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

◆ SequenceAsHashMap() [4/5]

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

◆ SequenceAsHashMap() [5/5]

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

Member Function Documentation

◆ begin() [1/2]

iterator comphelper::SequenceAsHashMap::begin ( )
inline

Definition at line 368 of file sequenceashashmap.hxx.

Referenced by operator>>().

◆ begin() [2/2]

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

Definition at line 373 of file sequenceashashmap.hxx.

◆ clear()

void comphelper::SequenceAsHashMap::clear ( )
inline

Definition at line 353 of file sequenceashashmap.hxx.

Referenced by operator<<().

◆ createItemIfMissing()

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.

@descr 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 297 of file sequenceashashmap.hxx.

◆ empty()

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

Definition at line 363 of file sequenceashashmap.hxx.

◆ end() [1/2]

iterator comphelper::SequenceAsHashMap::end ( )
inline

Definition at line 378 of file sequenceashashmap.hxx.

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

◆ end() [2/2]

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

Definition at line 383 of file sequenceashashmap.hxx.

◆ erase() [1/2]

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

Definition at line 413 of file sequenceashashmap.hxx.

◆ erase() [2/2]

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

Definition at line 408 of file sequenceashashmap.hxx.

◆ find() [1/4]

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

Definition at line 388 of file sequenceashashmap.hxx.

Referenced by match().

◆ find() [2/4]

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

Definition at line 393 of file sequenceashashmap.hxx.

◆ find() [3/4]

iterator comphelper::SequenceAsHashMap::find ( const OUStringAndHashCode rKey)
inline

Definition at line 398 of file sequenceashashmap.hxx.

◆ find() [4/4]

const_iterator comphelper::SequenceAsHashMap::find ( const OUStringAndHashCode rKey) const
inline

Definition at line 403 of file sequenceashashmap.hxx.

◆ getAsConstAny()

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

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

@descr 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 259 of file sequenceashashmap.cxx.

References getAsConstNamedValueList(), and getAsConstPropertyValueList().

◆ getAsConstNamedValueList()

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.

@descr 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 269 of file sequenceashashmap.cxx.

Referenced by getAsConstAny().

◆ getAsConstPropertyValueList()

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.

@descr 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 276 of file sequenceashashmap.cxx.

Referenced by getAsConstAny().

◆ getUnpackedValueOrDefault()

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.

@descr 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: \n "unpacked" means the Any content of every iterator->second!

Definition at line 237 of file sequenceashashmap.hxx.

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

◆ getValue()

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.

@descr 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 266 of file sequenceashashmap.hxx.

◆ match()

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

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

@descr 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 283 of file sequenceashashmap.cxx.

References end(), and find().

◆ operator<<() [1/4]

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: \n 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 128 of file sequenceashashmap.cxx.

References clear().

◆ operator<<() [2/4]

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 213 of file sequenceashashmap.cxx.

References clear(), i, and m_aMap.

◆ operator<<() [3/4]

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 201 of file sequenceashashmap.cxx.

References clear(), i, and m_aMap.

◆ operator<<() [4/4]

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 157 of file sequenceashashmap.cxx.

References i, and m_aMap.

◆ operator>>() [1/2]

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 242 of file sequenceashashmap.cxx.

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

◆ operator>>() [2/2]

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 225 of file sequenceashashmap.cxx.

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

◆ operator[]() [1/2]

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

Definition at line 340 of file sequenceashashmap.hxx.

◆ operator[]() [2/2]

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

Definition at line 345 of file sequenceashashmap.hxx.

◆ size()

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

Definition at line 358 of file sequenceashashmap.hxx.

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

◆ update()

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

merge all values from the given map into this one.

@descr 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 302 of file sequenceashashmap.cxx.

References m_aMap, and size().

Member Data Documentation

◆ m_aMap

SequenceAsHashMapBase comphelper::SequenceAsHashMap::m_aMap
private

Definition at line 419 of file sequenceashashmap.hxx.

Referenced by operator<<(), and update().


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