LibreOffice LibreOffice 25.8 SDK API Reference

Exported Interfaces | Public Member Functions | Public Attributes | List of all members
XMap Interface Reference

describes a map between keys and values. More...

`import"XMap.idl";`

Inheritance diagram for XMap:

## Exported Interfaces
interface | XElementAccess

## Public Member Functions
void | clear () raises ( ::com::sun::star::lang::NoSupportException )
| clears the map, removing all key-value pairs from it. More...
boolean | containsKey ([in] any Key) raises ( ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException )
| determines whether a mapping for he given key exists in the map More...
boolean | containsValue ([in] any Value) raises ( ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException )
| determines whether the map contains a mapping to a given value. More...
any | get ([in] any Key) raises ( ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException )
| gets the value to which a given key maps. More...
any | put ([in] any Key, [in] any Value) raises ( ::com::sun::star::lang::NoSupportException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException )
| associates a given key with a given value More...
any | remove ([in] any Key) raises ( ::com::sun::star::lang::NoSupportException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException )
| removes a key-value mapping, given by key, from the map. More...
Public Member Functions inherited from XElementAccess
type | getElementType ()
boolean | hasElements ()
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Public Attributes
type | KeyType
| denotes the type of the keys in the map. More...
type | ValueType
| denotes the type of the values in the map. More...

## Detailed Description

describes a map between keys and values.

Keys in the map are unique, and each key maps to exactly one value.

Locating elements in the map, both values and keys, requires a notion of equality of two objects. In conformance with the UNO type system, two values are said to be equal if and only if they have the same type, and both denote the same element of this type's value set.

See also
  Map for a default implementation of this interface

## Exported Interfaces

## ◆ XElementAccess

interface XElementAccess

## Member Function Documentation

## ◆ clear()

void clear | ( |  | ) |
raises | ( | ::com::sun::star::lang::NoSupportException
| ) |  |

clears the map, removing all key-value pairs from it.

Exceptions

  com::sun::star::lang::NoSupportException | if the map is not mutable.

## ◆ containsKey()

boolean containsKey | ( | [in] any | Key | ) |
raises | ( | ::com::sun::star::beans::IllegalTypeException,
|  | ::com::sun::star::lang::IllegalArgumentException
| ) |  |

determines whether a mapping for he given key exists in the map

Parameters

  Key | is the key whose presence in the map is to be tested.

Returns
  `TRUE` if and only if the map contains a mapping for the given key.

Exceptions

  com::sun::star::beans::IllegalTypeException | if the given key is not of a type which is accepted by the map
  com::sun::star::lang::IllegalArgumentException | if the given key is not supported to be put into the map. It's up to the service implementing the `XMap` interface to specify which special values are not supported. For instances, implementations might decide to not allow `VOID` keys, or to reject `Double.NaN` (not a number) to due its problematic behavior with respect to equality.

## ◆ containsValue()

boolean containsValue | ( | [in] any | Value | ) |
raises | ( | ::com::sun::star::beans::IllegalTypeException,
|  | ::com::sun::star::lang::IllegalArgumentException
| ) |  |

determines whether the map contains a mapping to a given value.

Parameters

  Value | is the value whose presence in the map is to be tested.

Returns
  `TRUE` if and only one or more keys map to the given value.

Exceptions

  com::sun::star::beans::IllegalTypeException | if the given value is not of a type which is accepted by the map. It's up to the service implementing the `XMap` interface to specify which special values are not supported. For instances, implementations might decide to not allow `Double.NaN` (not a number) to due its problematic behavior with respect to equality.
  com::sun::star::lang::IllegalArgumentException | if the given value is not supported to be put into the map.

## ◆ get()

any get | ( | [in] any | Key | ) |
raises | ( | ::com::sun::star::beans::IllegalTypeException,
|  | ::com::sun::star::lang::IllegalArgumentException,
|  | ::com::sun::star::container::NoSuchElementException
| ) |  |

gets the value to which a given key maps.

Parameters

  Key | they key whose associated value is to be returned.

Returns
  the value which is associated with the given key.

Exceptions

  com::sun::star::beans::IllegalTypeException | if the given key is not of a type which is accepted by the map
  com::sun::star::lang::IllegalArgumentException | if the given key is not supported to be put into the map. It's up to the service implementing the `XMap` interface to specify which special values are not supported. For instances, implementations might decide to not allow `VOID` keys, or to reject `Double.NaN` (not a number) to due its problematic behavior with respect to equality.
  com::sun::star::container::NoSuchElementException | if there is no value associated with the given key

## ◆ put()

any put | ( | [in] any | Key,
|  | [in] any | Value
| ) |  |
raises | ( | ::com::sun::star::lang::NoSupportException,
|  | ::com::sun::star::beans::IllegalTypeException,
|  | ::com::sun::star::lang::IllegalArgumentException
| ) |  |

associates a given key with a given value

If the map already contains a mapping for the given key, then the old value is replaced by the given new value.

Parameters

  Key | is the key which the given value should be associated with
  Value | is the value which should be associated with the given key

Returns
  the value which was previously associated with the given key, or `VOID` if there was no such previous association.

Exceptions

  com::sun::star::beans::IllegalTypeException | if the given key is not of a type which is accepted by the map
  com::sun::star::lang::IllegalArgumentException | if the given key, or the given value, is not supported to be put into the map. It's up to the service implementing the `XMap` interface to specify which special values are not supported. For instances, implementations might decide to not allow `VOID` keys or values, or to reject `Double.NaN` (not a number) to due its problematic behavior with respect to equality.
  com::sun::star::lang::NoSupportException | if the map does not support putting new mappings into it

## ◆ remove()

any remove | ( | [in] any | Key | ) |
raises | ( | ::com::sun::star::lang::NoSupportException,
|  | ::com::sun::star::beans::IllegalTypeException,
|  | ::com::sun::star::lang::IllegalArgumentException,
|  | ::com::sun::star::container::NoSuchElementException
| ) |  |

removes a key-value mapping, given by key, from the map.

Parameters

  Key | is the key whose mapping should be removed from the map

Returns
  the value which was associated with the given key before the removal

Exceptions

  com::sun::star::beans::IllegalTypeException | if the given key is not of a type which is accepted by the map
  com::sun::star::lang::IllegalArgumentException | if the given key is not supported to be put into the map. It's up to the service implementing the `XMap` interface to specify which special values are not supported. For instances, implementations might decide to not allow `VOID` keys, or to reject `Double.NaN` (not a number) to due its problematic behavior with respect to equality.
  com::sun::star::lang::NoSupportException | if the map does not support removing mappings
  com::sun::star::container::NoSuchElementException | if there is no value associated with the given key

## Member Data Documentation

## ◆ KeyType

type KeyType
| attribute readonly

denotes the type of the keys in the map.

Implementations are free to accept any supertype of `KeyType` as keys.

## ◆ ValueType

type ValueType
| attribute readonly

denotes the type of the values in the map.

Implementations are free to accept any supertype of the `ValueType` as values.

The documentation for this interface was generated from the following file:

- com/sun/star/container/XMap.idl