1 20 21 package org.jacorb.idl; 22 23 27 28 import java.io.PrintWriter ; 29 import java.util.*; 30 31 public class TypeDeclaration 32 extends Declaration 33 { 34 boolean typedefd = false; 35 36 public TypeDeclaration type_decl; 37 38 public TypeDeclaration( int num ) 39 { 40 super( num ); 41 pack_name = ""; 42 } 43 44 public Object clone() 45 { 46 return type_decl.clone(); 47 } 48 49 50 public TypeDeclaration declaration() 51 { 52 return type_decl; 53 }; 54 55 public String typeName() 56 { 57 return type_decl.typeName(); 58 } 59 60 63 64 public String getJavaTypeName() 65 { 66 return type_decl.getJavaTypeName(); 67 } 68 69 70 73 74 public String getIDLTypeName() 75 { 76 return type_decl.getIDLTypeName(); 77 } 78 79 80 81 85 86 public void markTypeDefd( String alias ) 87 { 88 type_decl.markTypeDefd( alias ); 89 } 90 91 public String getRecursiveTypeCodeExpression() 92 { 93 if( type_decl == null ) 94 return "org.omg.CORBA.ORB.init().create_recursive_tc " 95 + "(\"" + id() + "\")"; 96 else 97 return type_decl.getRecursiveTypeCodeExpression(); 98 } 99 100 105 106 public String getTypeCodeExpression( Set knownTypes ) 107 { 108 if( type_decl instanceof Value ) 109 return type_decl.getTypeCodeExpression( knownTypes ); 110 else 111 return type_decl.getTypeCodeExpression(); 112 } 113 114 118 public String getTypeCodeExpression() 119 { 120 return type_decl.getTypeCodeExpression(); 121 } 122 123 public boolean basic() 124 { 125 return type_decl.basic(); 126 } 127 128 public void setPackage( String s ) 129 { 130 s = parser.pack_replace( s ); 131 type_decl.setPackage( s ); 132 } 133 134 public void set_included( boolean i ) 135 { 136 included = i; 137 type_decl.set_included( i ); 138 } 139 140 public void parse() 141 { 142 type_decl.parse(); 143 } 144 145 public String holderName() 146 { 147 return type_decl.holderName(); 148 } 149 150 public void print( PrintWriter ps ) 151 { 152 type_decl.print( ps ); 153 } 154 155 public String toString() 156 { 157 return type_decl.toString(); 158 } 159 160 public void setEnclosingSymbol( IdlSymbol s ) 161 { 162 if( enclosing_symbol != null && enclosing_symbol != s ) 163 { 164 logger.error("was " + enclosing_symbol.getClass().getName() + " now: " + s.getClass().getName() ); 165 throw new RuntimeException ( "Compiler Error: trying to reassign container for " + name ); 166 } 167 enclosing_symbol = s; 168 type_decl.setEnclosingSymbol( s ); 169 } 170 171 public String printReadExpression( String streamname ) 172 { 173 return type_decl.printReadExpression( streamname ); 174 } 175 176 public String printReadStatement( String var_name, String streamname ) 177 { 178 return var_name + "=" + printReadExpression( streamname ) + ";"; 179 } 180 181 public String printWriteStatement( String var_name, String streamname ) 182 { 183 return type_decl.printWriteStatement( var_name, streamname ); 184 } 185 186 public void accept( IDLTreeVisitor visitor ) 187 { 188 type_decl.accept( visitor ); 189 } 190 } 191 | Popular Tags |