1 2 21 22 package org.jacorb.idl; 23 24 28 29 import java.io.PrintWriter ; 30 import java.util.*; 31 32 public class ConstrTypeSpec 33 extends TypeSpec 34 { 35 public TypeDeclaration c_type_spec; 36 37 public ConstrTypeSpec( int num ) 38 { 39 super( num ); 40 } 41 42 public ConstrTypeSpec( TypeDeclaration c ) 43 { 44 super( new_num() ); 45 c_type_spec = c; 46 } 47 48 public void set_name( String n ) 49 { 50 c_type_spec.set_name( n ); 51 } 52 53 public Object clone() 54 { 55 ConstrTypeSpec cts = new ConstrTypeSpec( new_num() ); 56 cts.c_type_spec = (TypeDeclaration)c_type_spec.clone(); 57 return cts; 58 } 59 60 public TypeDeclaration declaration() 61 { 62 return c_type_spec; 63 } 64 65 public void setEnclosingSymbol( IdlSymbol s ) 66 { 67 if( enclosing_symbol != null && enclosing_symbol != s ) 68 throw new RuntimeException ( "Compiler Error: trying to reassign container for " + name ); 69 enclosing_symbol = s; 70 c_type_spec.setEnclosingSymbol( s ); 71 } 72 73 public String toString() 74 { 75 String n = typeName(); 76 if( !n.startsWith( "org.omg" ) ) 77 { 78 return omgPrefix() + n; 79 } 80 else 81 return n; 82 } 83 84 public String typeName() 85 { 86 return c_type_spec.typeName(); 87 } 88 89 public String full_name() 90 { 91 return c_type_spec.full_name(); 92 } 93 94 98 99 public String omgPrefix() 100 { 101 return c_type_spec.omg_package_prefix; 102 } 103 104 public TypeSpec typeSpec() 105 { 106 return this; 107 } 108 109 public boolean basic() 110 { 111 return c_type_spec.basic(); 112 } 113 114 public void parse() 115 { 116 c_type_spec.parse(); 117 } 118 119 public void setPackage( String s ) 120 { 121 s = parser.pack_replace( s ); 122 c_type_spec.setPackage( s ); 123 } 124 125 126 public String getTypeCodeExpression( Set knownTypeSpecs ) 127 { 128 return c_type_spec.getTypeCodeExpression( knownTypeSpecs ); 129 } 130 131 134 public String getTypeCodeExpression() 135 { 136 return c_type_spec.getTypeCodeExpression(); 137 } 138 139 140 public void print( PrintWriter ps ) 141 { 142 c_type_spec.print( ps ); 143 } 144 145 public String holderName() 146 { 147 return c_type_spec.holderName(); 148 } 149 150 public String printReadExpression( String streamname ) 151 { 152 return c_type_spec.printReadExpression( streamname ); 153 } 154 155 public String printWriteStatement( String var_name, String streamname ) 156 { 157 return c_type_spec.printWriteStatement( var_name, streamname ); 158 } 159 160 public String printInsertExpression() 161 { 162 throw new RuntimeException ( "Should not be called" ); 163 } 164 165 public String printExtractExpression() 166 { 167 throw new RuntimeException ( "Should not be called" ); 168 } 169 170 public String id() 171 { 172 return c_type_spec.declaration().id(); 173 } 174 175 177 178 public void accept( IDLTreeVisitor visitor ) 179 { 180 c_type_spec.declaration().accept( visitor ); 181 } 182 183 184 } 185 | Popular Tags |