Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_attr_init.cpp
blob5808490dcfcb7781729922f8c43c27da7ba2306c
1 #include "be_visitor_attr_init.h"
2 #include "be_visitor_context.h"
3 #include "be_helper.h"
4 #include "be_array.h"
5 #include "be_component.h"
6 #include "be_enum.h"
7 #include "be_eventtype.h"
8 #include "be_home.h"
9 #include "be_predefined_type.h"
10 #include "be_sequence.h"
11 #include "be_string.h"
12 #include "be_structure.h"
13 #include "be_typedef.h"
14 #include "be_union.h"
15 #include "be_valuebox.h"
16 #include "be_valuetype.h"
18 be_visitor_attr_init::be_visitor_attr_init (
19 be_visitor_context *ctx)
20 : be_visitor_decl (ctx),
21 os_ (*ctx->stream ())
25 be_visitor_attr_init::~be_visitor_attr_init (void)
29 int
30 be_visitor_attr_init::visit_array (be_array *)
32 return 0;
35 int
36 be_visitor_attr_init::visit_component (be_component *node)
38 return this->visit_interface (node);
41 int
42 be_visitor_attr_init::visit_enum (be_enum *node)
44 os_ << "static_cast< ::" << node->full_name () << "> (0UL)";
46 return 0;
49 int
50 be_visitor_attr_init::visit_eventtype (be_eventtype *node)
52 return this->visit_valuetype (node);
55 int
56 be_visitor_attr_init::visit_home (be_home *node)
58 return this->visit_interface (node);
61 int
62 be_visitor_attr_init::visit_interface (be_interface *)
64 return 0;
67 int
68 be_visitor_attr_init::visit_predefined_type (be_predefined_type *node)
70 switch (node->pt ())
72 case AST_PredefinedType::PT_boolean:
73 os_ << "false";
74 break;
75 case AST_PredefinedType::PT_octet:
76 case AST_PredefinedType::PT_char:
77 case AST_PredefinedType::PT_wchar:
78 case AST_PredefinedType::PT_short:
79 case AST_PredefinedType::PT_ushort:
80 case AST_PredefinedType::PT_long:
81 case AST_PredefinedType::PT_ulong:
82 case AST_PredefinedType::PT_longlong:
83 case AST_PredefinedType::PT_ulonglong:
84 case AST_PredefinedType::PT_value:
85 case AST_PredefinedType::PT_any:
86 os_ << "0";
87 break;
88 case AST_PredefinedType::PT_float:
89 os_ << "0.0f";
90 break;
91 case AST_PredefinedType::PT_double:
92 os_ << "0.0";
93 break;
94 case AST_PredefinedType::PT_longdouble:
95 os_ << "ACE_CDR_LONG_DOUBLE_INITIALIZER";
96 break;
97 case AST_PredefinedType::PT_object:
98 os_ << " ::CORBA::Object::_nil ()";
99 break;
100 case AST_PredefinedType::PT_abstract:
101 os_ << " ::CORBA::AbstractBase::_nil ()";
102 break;
103 case AST_PredefinedType::PT_pseudo:
104 os_ << " ::CORBA::TypeCode::_nil ()";
105 break;
106 default: // PT_void not handled.
107 break;
110 return 0;
114 be_visitor_attr_init::visit_sequence (be_sequence *)
116 return 0;
120 be_visitor_attr_init::visit_string (be_string *)
122 return 0;
126 be_visitor_attr_init::visit_structure (be_structure *)
128 return 0;
132 be_visitor_attr_init::visit_typedef (be_typedef *node)
134 return node->primitive_base_type ()->accept (this);
138 be_visitor_attr_init::visit_union (be_union *)
140 return 0;
144 be_visitor_attr_init::visit_valuebox (be_valuebox *node)
146 os_ << "static_cast< ::" << node->full_name ()
147 << " *> (0)";
149 return 0;
153 be_visitor_attr_init::visit_valuetype (be_valuetype *)
155 return 0;