xref: /aoo41x/main/udkapi/com/sun/star/container/XMap.idl (revision cdf0e10c)
1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ***********************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_container_XMap_idl__
29*cdf0e10cSrcweir#define __com_sun_star_container_XMap_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#include <com/sun/star/beans/IllegalTypeException.idl>
32*cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
33*cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl>
34*cdf0e10cSrcweir#include <com/sun/star/lang/NoSupportException.idl>
35*cdf0e10cSrcweir#include <com/sun/star/container/XElementAccess.idl>
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir//=============================================================================
38*cdf0e10cSrcweir
39*cdf0e10cSrcweirmodule com { module sun { module star { module container {
40*cdf0e10cSrcweir
41*cdf0e10cSrcweir//=============================================================================
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir/** describes a map between keys and values.
44*cdf0e10cSrcweir
45*cdf0e10cSrcweir    <p>Keys in the map are unique, and each key maps to exactly one value.</p>
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir    <p>Locating elements in the map, both values and keys, requires a notion of equality of two objects.
48*cdf0e10cSrcweir    In conformance with the <a href="http://udk.openoffice.org/common/man/typesystem.html">UNO type system</a>,
49*cdf0e10cSrcweir    two values are said to be equal if and only if they have the same type, and both denote the same element of this
50*cdf0e10cSrcweir    type's value set.</p>
51*cdf0e10cSrcweir
52*cdf0e10cSrcweir    @see <type>Map</type> for a default implementation of this interface
53*cdf0e10cSrcweir*/
54*cdf0e10cSrcweirinterface XMap
55*cdf0e10cSrcweir{
56*cdf0e10cSrcweir    interface XElementAccess;
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir    /** denotes the type of the keys in the map.
59*cdf0e10cSrcweir
60*cdf0e10cSrcweir        <p>Implementations are free to accept any supertype of <code>KeyType</code> as keys.</p>
61*cdf0e10cSrcweir    */
62*cdf0e10cSrcweir    [attribute, readonly]   type    KeyType;
63*cdf0e10cSrcweir
64*cdf0e10cSrcweir    /** denotes the type of the values in the map.
65*cdf0e10cSrcweir
66*cdf0e10cSrcweir        <p>Implementations are free to accept any supertype of the <code>ValueType</code> as values.</p>
67*cdf0e10cSrcweir    */
68*cdf0e10cSrcweir    [attribute, readonly]   type    ValueType;
69*cdf0e10cSrcweir
70*cdf0e10cSrcweir    /** clears the map, removing all key-value pairs from it.
71*cdf0e10cSrcweir
72*cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
73*cdf0e10cSrcweir            if the map is not mutable.
74*cdf0e10cSrcweir    */
75*cdf0e10cSrcweir    void clear()
76*cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException );
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir    /** determines whether a mapping for he given key exists in the map
79*cdf0e10cSrcweir
80*cdf0e10cSrcweir        @param Key
81*cdf0e10cSrcweir            is the key whose presence in the map is to be tested.
82*cdf0e10cSrcweir        @return
83*cdf0e10cSrcweir            <TRUE/> if and only if the map contains a mapping for the given key.
84*cdf0e10cSrcweir
85*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
86*cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
87*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
88*cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
89*cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
90*cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
91*cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
92*cdf0e10cSrcweir            behavior with respect to equality.
93*cdf0e10cSrcweir    */
94*cdf0e10cSrcweir    boolean containsKey( [in] any Key )
95*cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
96*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
97*cdf0e10cSrcweir
98*cdf0e10cSrcweir    /** determines whether the map contains a mapping to a given value.
99*cdf0e10cSrcweir
100*cdf0e10cSrcweir        @param Value
101*cdf0e10cSrcweir            is the value whose presence in the map is to be tested.
102*cdf0e10cSrcweir        @return
103*cdf0e10cSrcweir            <TRUE/> if and only one or more keys map to the given value.
104*cdf0e10cSrcweir
105*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
106*cdf0e10cSrcweir            if the given value is not of a type which is accepted by the map. It's up to the service
107*cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
108*cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <code>Double.NaN</code>
109*cdf0e10cSrcweir            (<em>not a number</em>) to due its problematic behavior with respect to equality.
110*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
111*cdf0e10cSrcweir            if the given value is not supported to be put into the map.
112*cdf0e10cSrcweir    */
113*cdf0e10cSrcweir    boolean containsValue( [in] any Value )
114*cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
115*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir    /** gets the value to which a given key maps.
118*cdf0e10cSrcweir
119*cdf0e10cSrcweir        @param Key
120*cdf0e10cSrcweir            they key whose associated value is to be returned.
121*cdf0e10cSrcweir        @return
122*cdf0e10cSrcweir            the value which is associated with the given key.
123*cdf0e10cSrcweir
124*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
125*cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
126*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalArgumentException
127*cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
128*cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
129*cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
130*cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
131*cdf0e10cSrcweir            behavior with respect to equality.
132*cdf0e10cSrcweir        @throws ::com::sun::star::container::NoSuchElementException
133*cdf0e10cSrcweir            if there is no value associated with the given key
134*cdf0e10cSrcweir    */
135*cdf0e10cSrcweir    any     get( [in] any Key )
136*cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
137*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException,
138*cdf0e10cSrcweir                ::com::sun::star::container::NoSuchElementException );
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir    /** associates a given key with a given value
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir        <p>If the map already contains a mapping for the given key, then the old value is replaced by the
143*cdf0e10cSrcweir        given new value.</p>
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir        @param Key
146*cdf0e10cSrcweir            is the key which the given value should be associated with
147*cdf0e10cSrcweir        @param Value
148*cdf0e10cSrcweir            is the value which should be associated with the given key
149*cdf0e10cSrcweir        @return
150*cdf0e10cSrcweir            the value which was previously associated with the given key, or <VOID/>
151*cdf0e10cSrcweir            if there was no such previous association.
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
154*cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
155*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
156*cdf0e10cSrcweir            if the given key, or the given value, is not supported to be put into the map. It's up to
157*cdf0e10cSrcweir            the service implementing the <code>XMap</code> interface to specify which special values
158*cdf0e10cSrcweir            are not supported.<br/>
159*cdf0e10cSrcweir            For instances, implementations might decide to not allow <VOID/> keys or values, or to
160*cdf0e10cSrcweir            reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic behavior
161*cdf0e10cSrcweir            with respect to equality.
162*cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
163*cdf0e10cSrcweir            if the map does not support putting new mappings into it
164*cdf0e10cSrcweir    */
165*cdf0e10cSrcweir    any     put( [in] any Key, [in] any Value )
166*cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException,
167*cdf0e10cSrcweir                ::com::sun::star::beans::IllegalTypeException,
168*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
169*cdf0e10cSrcweir
170*cdf0e10cSrcweir    /** removes a key-value mapping, given by key, from the map.
171*cdf0e10cSrcweir
172*cdf0e10cSrcweir        @param Key
173*cdf0e10cSrcweir            is the key whose mapping should be removed from the map
174*cdf0e10cSrcweir        @return
175*cdf0e10cSrcweir            the value which was associated with the given key before the removal
176*cdf0e10cSrcweir
177*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
178*cdf0e10cSrcweir            if the given key is not of a type which is accepted by the map
179*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
180*cdf0e10cSrcweir            if the given key is not supported to be put into the map. It's up to the service
181*cdf0e10cSrcweir            implementing the <code>XMap</code> interface to specify which special values are not
182*cdf0e10cSrcweir            supported. For instances, implementations might decide to not allow <VOID/> keys, or
183*cdf0e10cSrcweir            to reject <code>Double.NaN</code> (<em>not a number</em>) to due its problematic
184*cdf0e10cSrcweir            behavior with respect to equality.
185*cdf0e10cSrcweir        @throws ::com::sun::star::beans::NoSupportException
186*cdf0e10cSrcweir            if the map does not support removing mappings
187*cdf0e10cSrcweir        @throws ::com::sun::star::container::NoSuchElementException
188*cdf0e10cSrcweir            if there is no value associated with the given key
189*cdf0e10cSrcweir    */
190*cdf0e10cSrcweir    any     remove( [in] any Key )
191*cdf0e10cSrcweir        raises( ::com::sun::star::lang::NoSupportException,
192*cdf0e10cSrcweir                ::com::sun::star::beans::IllegalTypeException,
193*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException,
194*cdf0e10cSrcweir                ::com::sun::star::container::NoSuchElementException );
195*cdf0e10cSrcweir};
196*cdf0e10cSrcweir
197*cdf0e10cSrcweir//=============================================================================
198*cdf0e10cSrcweir
199*cdf0e10cSrcweir}; }; }; };
200*cdf0e10cSrcweir
201*cdf0e10cSrcweir//=============================================================================
202*cdf0e10cSrcweir
203*cdf0e10cSrcweir#endif
204