summaryrefslogtreecommitdiff
path: root/TAO/tests/IDL_Test/enum_in_struct.idl
blob: cd0d4ee97f54e881ef4d5d85ba627b09a290e292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

//=============================================================================
/**
 *  @file    enum_in_struct.idl
 *
 *  This file contains examples of IDL code that has
 *  caused problems in the past for the TAO IDL
 *  compiler. This test is to make sure the problems
 *  stay fixed.
 *
 *
 *  @author Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
 */
//=============================================================================


// Tests for correct parsing and code generation for
// both named and anonymous enums in a struct.

enum UnNamed
  {
    UNNAMED_FIRST,
    UNNAMED_SECOND,
    UNNAMED_THIRD
  };

struct HoldsEnum
{
  enum Named
    {
      NAMED_FIRST,
      NAMED_SECOND,
      NAMED_THIRD
    } named_enum;

  UnNamed unnamed_enum;
};

// Test for anonymous arrays of member declarations

struct decl_heavy_struct
{
  enum str_en
  {
    a,
    b,
    c
  } m_en[10];

  struct st
  {
    long a;
    char b;
  } m_st[10];

  union un switch (long)
  {
    case 1: long a;
    case 2: char b;
  } m_un[10];
};

// Similar case for exception included here - no sense
// in making a separate file for exceptions, which are
// almost the same as structs.

exception ErrorException
{
  enum ReasonCode
  {
    RESOURCE,
    COMMUNICATION,
    ASSERTION,
    STATE,
    ALREADY,
    OTHER
  } reason;
};