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