xref: /AOO41X/main/udkapi/com/sun/star/container/EnumerableMap.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_Map_idl__
29*cdf0e10cSrcweir#define __com_sun_star_container_Map_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#include <com/sun/star/beans/IllegalTypeException.idl>
32*cdf0e10cSrcweir#include <com/sun/star/beans/Pair.idl>
33*cdf0e10cSrcweir#include <com/sun/star/container/XEnumerableMap.idl>
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir//=============================================================================
36*cdf0e10cSrcweir
37*cdf0e10cSrcweirmodule com { module sun { module star { module container {
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir//=============================================================================
40*cdf0e10cSrcweir
41*cdf0e10cSrcweir/** provides a default <type>XEnumerableMap</type> implementation
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir    <p>For the keys put into the map using <member>XMap::put</member> or <member>createImmutable</member>,
44*cdf0e10cSrcweir    the following rules apply:
45*cdf0e10cSrcweir    <a name="keyrules"></a>
46*cdf0e10cSrcweir    <ul><li>A <VOID/> key is not allowed.</li>
47*cdf0e10cSrcweir        <li>If the key type is <code>BOOLEAN</code>, <code>CHAR</code>, <code>FLOAT</code>, <code>DOUBLE</code>,
48*cdf0e10cSrcweir            <code>STRING</code>, <code>TYPE</code>, or <code>UNSIGNED HYPER</code>, then only keys of exactly this
49*cdf0e10cSrcweir            type are accepted.</li>
50*cdf0e10cSrcweir        <li>If the key type is <code>DOUBLE</code> or <code>FLOAT</code>, then <code>Double.NaN</code> respectively
51*cdf0e10cSrcweir            <code>Float.NaN</code> is not accepted as key.</li>
52*cdf0e10cSrcweir        <li>If the key type's class is <member scope="com::sun::star::uno">TypeClass::ENUM</member>, then only keys
53*cdf0e10cSrcweir            of exactly this type are accepted.</li>
54*cdf0e10cSrcweir        <li>If the key type is any of <code>BYTE</code>, <code>SHORT</code>, <code>UNSIGNED SHORT</code>,
55*cdf0e10cSrcweir            <code>LONG</code>, <code>UNSIGNED LONG</code>, or <code>HYPER</code>, then all keys which can losslessly
56*cdf0e10cSrcweir            be converted to this type (possibly using widening conversions) are accepted.</li>
57*cdf0e10cSrcweir        <li>If the key type is an interface type, then all key values denoting objects which can be queried for
58*cdf0e10cSrcweir            the given interface are accepted.</li>
59*cdf0e10cSrcweir        <li>All other key types are rejected.</li>
60*cdf0e10cSrcweir    </ul></p>
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir    <p>For the values put into the map using <member>XMap::put</member> or <member>createImmutable</member>,
63*cdf0e10cSrcweir    the following rules apply:
64*cdf0e10cSrcweir    <a name="valuerules"></a>
65*cdf0e10cSrcweir    <ul><li>The <VOID/> value will be accepted to be put into the map.</p>
66*cdf0e10cSrcweir        <li>If the value type's class is <member scope="com::sun::star::uno">TypeClass::ANY</member>, any value
67*cdf0e10cSrcweir            will be accepted.</li>
68*cdf0e10cSrcweir        <li>If the value type is an interface type, then all values denoting objects which can be queried for
69*cdf0e10cSrcweir            the given interface are accepted.</li>
70*cdf0e10cSrcweir        <li>If the value type's class is <member scope="com::sun::star::uno">TypeClass::EXCEPTION</member>
71*cdf0e10cSrcweir            or <member scope="com::sun::star::uno">TypeClass::STRUCT</member>, then values whose type equals the
72*cdf0e10cSrcweir            value type, or is a sub class of the value type, are accepted.</li>
73*cdf0e10cSrcweir        <li>For all other value types, only values whose type matches exactly are accepted.</li>
74*cdf0e10cSrcweir        <li>If the value type is <code>DOUBLE</code> or <code>FLOAT</code>, then <code>Double.NaN</code> respectively
75*cdf0e10cSrcweir            <code>Float.NaN</code> is not accepted.</li>
76*cdf0e10cSrcweir    </ul></p>
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir    <p>The factory methods of the <code>XEnumerableMap</code> interface support both <em>isolated</em>
79*cdf0e10cSrcweir    and <em>non-isolated</em> enumerators. The latter one will be automatically disposed when the map changes
80*cdf0e10cSrcweir    after enumerator creation, so every attempt to use them will result in a
81*cdf0e10cSrcweir    <type scope="com::sun::star::lang">DisposedException</type> being thrown.</p>
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir    @see http://udk.openoffice.org/common/man/typesystem.html
84*cdf0e10cSrcweir*/
85*cdf0e10cSrcweirservice EnumerableMap : XEnumerableMap
86*cdf0e10cSrcweir{
87*cdf0e10cSrcweir    /** creates an instance mapping from the given key type to the given value type
88*cdf0e10cSrcweir
89*cdf0e10cSrcweir        @param KeyType
90*cdf0e10cSrcweir            denotes the type of the keys in the to-be-created map
91*cdf0e10cSrcweir        @param ValueType
92*cdf0e10cSrcweir            denotes the type of the values in the to-be-created map
93*cdf0e10cSrcweir
94*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
95*cdf0e10cSrcweir            if <arg>KeyType</arg> or <arg>ValueType</arg> are unsupported types.
96*cdf0e10cSrcweir            For values, all type classes except <member scope="com::sun::star::uno">TypeClass::VOID</member>
97*cdf0e10cSrcweir            and <member scope="com::sun::star::uno">TypeClass::UNKNOWN</member> are accepted.
98*cdf0e10cSrcweir            For keys, scalar types, strings, <type scope="com::sun::star::uno">Type</type> itself, and interface
99*cdf0e10cSrcweir            types are accepted.
100*cdf0e10cSrcweir    */
101*cdf0e10cSrcweir    create( [in] type KeyType, [in] type ValueType )
102*cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException );
103*cdf0e10cSrcweir
104*cdf0e10cSrcweir    /** creates an instance mapping from the given key type to the given value type
105*cdf0e10cSrcweir
106*cdf0e10cSrcweir        <p>The resulting map is immutable, so later alter operations on it will fail
107*cdf0e10cSrcweir        with a <type scope="com::sun::star::lang">NoSupportException</type>.</p>
108*cdf0e10cSrcweir
109*cdf0e10cSrcweir        @param KeyType
110*cdf0e10cSrcweir            denotes the type of the keys in the to-be-created map
111*cdf0e10cSrcweir        @param ValueType
112*cdf0e10cSrcweir            denotes the type of the values in the to-be-created map
113*cdf0e10cSrcweir        @param Values
114*cdf0e10cSrcweir            denote the values contained in the to-be-created map
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir        @throws ::com::sun::star::beans::IllegalTypeException
117*cdf0e10cSrcweir            if <arg>KeyType</arg> or <arg>ValueType</arg> are unsupported types.
118*cdf0e10cSrcweir            For values, all type classes except <member scope="com::sun::star::uno">TypeClass::VOID</member>
119*cdf0e10cSrcweir            are accepted.<br/>
120*cdf0e10cSrcweir            For keys, scalar types, strings, <type scope="com::sun::star::uno">Type</type> itself, and interface
121*cdf0e10cSrcweir            types are accepted.
122*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
123*cdf0e10cSrcweir            if any of the given values or keys violates the <a href="#keyrules">key rules</a> or
124*cdf0e10cSrcweir            <a href="#valuerules">value rules</a>.
125*cdf0e10cSrcweir    */
126*cdf0e10cSrcweir    createImmutable(
127*cdf0e10cSrcweir        [in] type KeyType,
128*cdf0e10cSrcweir        [in] type ValueType,
129*cdf0e10cSrcweir        [in] sequence< ::com::sun::star::beans::Pair< any, any > > Values
130*cdf0e10cSrcweir    )
131*cdf0e10cSrcweir        raises( ::com::sun::star::beans::IllegalTypeException,
132*cdf0e10cSrcweir                ::com::sun::star::lang::IllegalArgumentException );
133*cdf0e10cSrcweir};
134*cdf0e10cSrcweir
135*cdf0e10cSrcweir//=============================================================================
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir}; }; }; };
138*cdf0e10cSrcweir
139*cdf0e10cSrcweir//=============================================================================
140*cdf0e10cSrcweir
141*cdf0e10cSrcweir#endif
142