xref: /aoo42x/main/udkapi/com/sun/star/container/XMap.idl (revision 408a4873)
1*408a4873SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*408a4873SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*408a4873SAndrew Rist * distributed with this work for additional information
6*408a4873SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance
9*408a4873SAndrew Rist * with the License.  You may obtain a copy of the License at
10*408a4873SAndrew Rist *
11*408a4873SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*408a4873SAndrew Rist *
13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*408a4873SAndrew Rist * software distributed under the License is distributed on an
15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*408a4873SAndrew Rist * KIND, either express or implied.  See the License for the
17*408a4873SAndrew Rist * specific language governing permissions and limitations
18*408a4873SAndrew Rist * under the License.
19*408a4873SAndrew Rist *
20*408a4873SAndrew Rist *************************************************************/
21*408a4873SAndrew Rist
22*408a4873SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_container_XMap_idl__
25cdf0e10cSrcweir#define __com_sun_star_container_XMap_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#include <com/sun/star/beans/IllegalTypeException.idl>
28cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
29cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl>
30cdf0e10cSrcweir#include <com/sun/star/lang/NoSupportException.idl>
31cdf0e10cSrcweir#include <com/sun/star/container/XElementAccess.idl>
32cdf0e10cSrcweir
33cdf0e10cSrcweir//=============================================================================
34cdf0e10cSrcweir
35cdf0e10cSrcweirmodule com { module sun { module star { module container {
36cdf0e10cSrcweir
37cdf0e10cSrcweir//=============================================================================
38cdf0e10cSrcweir
39cdf0e10cSrcweir/** describes a map between keys and values.
40cdf0e10cSrcweir
41cdf0e10cSrcweir    <p>Keys in the map are unique, and each key maps to exactly one value.</p>
42cdf0e10cSrcweir
43cdf0e10cSrcweir    <p>Locating elements in the map, both values and keys, requires a notion of equality of two objects.
44cdf0e10cSrcweir    In conformance with the <a href="http://udk.openoffice.org/common/man/typesystem.html">UNO type system</a>,
45cdf0e10cSrcweir    two values are said to be equal if and only if they have the same type, and both denote the same element of this
46cdf0e10cSrcweir    type's value set.</p>
47cdf0e10cSrcweir
48cdf0e10cSrcweir    @see <type>Map</type> for a default implementation of this interface
49cdf0e10cSrcweir*/
50cdf0e10cSrcweirinterface XMap
51cdf0e10cSrcweir{
52cdf0e10cSrcweir    interface XElementAccess;
53cdf0e10cSrcweir
54cdf0e10cSrcweir    /** denotes the type of the keys in the map.
55cdf0e10cSrcweir
56cdf0e10cSrcweir        <p>Implementations are free to accept any supertype of <code>KeyType</code> as keys.</p>
57cdf0e10cSrcweir    */
58cdf0e10cSrcweir    [attribute, readonly]   type    KeyType;
59cdf0e10cSrcweir
60cdf0e10cSrcweir    /** denotes the type of the values in the map.
61cdf0e10cSrcweir
62cdf0e10cSrcweir        <p>Implementations are free to accept any supertype of the <code>ValueType</code> as values.</p>
63cdf0e10cSrcweir    */
64cdf0e10cSrcweir    [attribute, readonly]   type    ValueType;
65cdf0e10cSrcweir
66cdf0e10cSrcweir    /** clears the map, removing all key-value pairs from it.
67cdf0e10cSrcweir
68cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
69cdf0e10cSrcweir            if the map is not mutable.
70cdf0e10cSrcweir    */
71cdf0e10cSrcweir    void clear()
72cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException );
73cdf0e10cSrcweir
74cdf0e10cSrcweir    /** determines whether a mapping for he given key exists in the map
75cdf0e10cSrcweir
76cdf0e10cSrcweir        @param Key
77cdf0e10cSrcweir            is the key whose presence in the map is to be tested.
78cdf0e10cSrcweir        @return
79cdf0e10cSrcweir            <TRUE/> if and only if the map contains a mapping for the given key.
80cdf0e10cSrcweir
81cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
82cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
83cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
84cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
85cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
86cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
87cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
88cdf0e10cSrcweir            behavior with respect to equality.
89cdf0e10cSrcweir    */
90cdf0e10cSrcweir    boolean containsKey( [in] any Key )
91cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
92cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
93cdf0e10cSrcweir
94cdf0e10cSrcweir    /** determines whether the map contains a mapping to a given value.
95cdf0e10cSrcweir
96cdf0e10cSrcweir        @param Value
97cdf0e10cSrcweir            is the value whose presence in the map is to be tested.
98cdf0e10cSrcweir        @return
99cdf0e10cSrcweir            <TRUE/> if and only one or more keys map to the given value.
100cdf0e10cSrcweir
101cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
102cdf0e10cSrcweir            if the given value is not of a type which is accepted by the map. It's up to the service
103cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
104cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <code>Double.NaN</code>
105cdf0e10cSrcweir            (<em>not a number</em>) to due its problematic behavior with respect to equality.
106cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
107cdf0e10cSrcweir            if the given value is not supported to be put into the map.
108cdf0e10cSrcweir    */
109cdf0e10cSrcweir    boolean containsValue( [in] any Value )
110cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
111cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
112cdf0e10cSrcweir
113cdf0e10cSrcweir    /** gets the value to which a given key maps.
114cdf0e10cSrcweir
115cdf0e10cSrcweir        @param Key
116cdf0e10cSrcweir            they key whose associated value is to be returned.
117cdf0e10cSrcweir        @return
118cdf0e10cSrcweir            the value which is associated with the given key.
119cdf0e10cSrcweir
120cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
121cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
122cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalArgumentException
123cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
124cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
125cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
126cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
127cdf0e10cSrcweir            behavior with respect to equality.
128cdf0e10cSrcweir        @throws ::com::sun::star::container::NoSuchElementException
129cdf0e10cSrcweir            if there is no value associated with the given key
130cdf0e10cSrcweir    */
131cdf0e10cSrcweir    any     get( [in] any Key )
132cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
133cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException,
134cdf0e10cSrcweir                ::com::sun::star::container::NoSuchElementException );
135cdf0e10cSrcweir
136cdf0e10cSrcweir    /** associates a given key with a given value
137cdf0e10cSrcweir
138cdf0e10cSrcweir        <p>If the map already contains a mapping for the given key, then the old value is replaced by the
139cdf0e10cSrcweir        given new value.</p>
140cdf0e10cSrcweir
141cdf0e10cSrcweir        @param Key
142cdf0e10cSrcweir            is the key which the given value should be associated with
143cdf0e10cSrcweir        @param Value
144cdf0e10cSrcweir            is the value which should be associated with the given key
145cdf0e10cSrcweir        @return
146cdf0e10cSrcweir            the value which was previously associated with the given key, or <VOID/>
147cdf0e10cSrcweir            if there was no such previous association.
148cdf0e10cSrcweir
149cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
150cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
151cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
152cdf0e10cSrcweir            if the given key, or the given value, is not supported to be put into the map. It's up to
153cdf0e10cSrcweir            the service implementing the <code>XMap</code> interface to specify which special values
154cdf0e10cSrcweir            are not supported.<br/>
155cdf0e10cSrcweir            For instances, implementations might decide to not allow <VOID/> keys or values, or to
156cdf0e10cSrcweir            reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic behavior
157cdf0e10cSrcweir            with respect to equality.
158cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
159cdf0e10cSrcweir            if the map does not support putting new mappings into it
160cdf0e10cSrcweir    */
161cdf0e10cSrcweir    any     put( [in] any Key, [in] any Value )
162cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException,
163cdf0e10cSrcweir                ::com::sun::star::beans::IllegalTypeException,
164cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
165cdf0e10cSrcweir
166cdf0e10cSrcweir    /** removes a key-value mapping, given by key, from the map.
167cdf0e10cSrcweir
168cdf0e10cSrcweir        @param Key
169cdf0e10cSrcweir            is the key whose mapping should be removed from the map
170cdf0e10cSrcweir        @return
171cdf0e10cSrcweir            the value which was associated with the given key before the removal
172cdf0e10cSrcweir
173cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
174cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
175cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
176cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
177cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
178cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
179cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
180cdf0e10cSrcweir            behavior with respect to equality.
181cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
182cdf0e10cSrcweir            if the map does not support removing mappings
183cdf0e10cSrcweir        @throws ::com::sun::star::container::NoSuchElementException
184cdf0e10cSrcweir            if there is no value associated with the given key
185cdf0e10cSrcweir    */
186cdf0e10cSrcweir    any     remove( [in] any Key )
187cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException,
188cdf0e10cSrcweir                ::com::sun::star::beans::IllegalTypeException,
189cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException,
190cdf0e10cSrcweir                ::com::sun::star::container::NoSuchElementException );
191cdf0e10cSrcweir};
192cdf0e10cSrcweir
193cdf0e10cSrcweir//=============================================================================
194cdf0e10cSrcweir
195cdf0e10cSrcweir}; }; }; };
196cdf0e10cSrcweir
197cdf0e10cSrcweir//=============================================================================
198cdf0e10cSrcweir
199cdf0e10cSrcweir#endif
200