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