xref: /aoo41x/main/idlc/test/union.idl (revision 540d5e64)
1*540d5e64SAndrew Rist/**************************************************************
2*540d5e64SAndrew Rist *
3*540d5e64SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*540d5e64SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*540d5e64SAndrew Rist * distributed with this work for additional information
6*540d5e64SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*540d5e64SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*540d5e64SAndrew Rist * "License"); you may not use this file except in compliance
9*540d5e64SAndrew Rist * with the License.  You may obtain a copy of the License at
10*540d5e64SAndrew Rist *
11*540d5e64SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*540d5e64SAndrew Rist *
13*540d5e64SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*540d5e64SAndrew Rist * software distributed under the License is distributed on an
15*540d5e64SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*540d5e64SAndrew Rist * KIND, either express or implied.  See the License for the
17*540d5e64SAndrew Rist * specific language governing permissions and limitations
18*540d5e64SAndrew Rist * under the License.
19*540d5e64SAndrew Rist *
20*540d5e64SAndrew Rist *************************************************************/
21*540d5e64SAndrew Rist
22cdf0e10cSrcweirmodule idlc
23cdf0e10cSrcweir{
24cdf0e10cSrcweirmodule test
25cdf0e10cSrcweir{
26cdf0e10cSrcweir
27cdf0e10cSrcweirunion UnionTest switch (long) {
28cdf0e10cSrcweir  case 1: long x;
29cdf0e10cSrcweir  case 2: byte y;
30cdf0e10cSrcweir  case 3: string z;
31cdf0e10cSrcweir  case 4:
32cdf0e10cSrcweir  case 5: short w;
33cdf0e10cSrcweir  case 6: long array[ 10 ][ 20 ];
34cdf0e10cSrcweir  case 7: sequence<long> seq;
35cdf0e10cSrcweir default: any a;
36cdf0e10cSrcweir};
37cdf0e10cSrcweir
38cdf0e10cSrcweirtypedef enum E {
39cdf0e10cSrcweir  A,
40cdf0e10cSrcweir  B
41cdf0e10cSrcweir} EAlias;
42cdf0e10cSrcweir
43cdf0e10cSrcweir// Union with no default label
44cdf0e10cSrcweirunion U2 switch(EAlias) {
45cdf0e10cSrcweir  case E::A : long x;
46cdf0e10cSrcweir  case E::B : short y;
47cdf0e10cSrcweir};
48cdf0e10cSrcweir
49cdf0e10cSrcweirunion U3 switch(char) {
50cdf0e10cSrcweir  case 2 : long x;
51cdf0e10cSrcweir  case 4 : short y;
52cdf0e10cSrcweir};
53cdf0e10cSrcweir
54cdf0e10cSrcweir};
55cdf0e10cSrcweir};
56cdf0e10cSrcweir
57