1 20 21 package org.jacorb.idl; 22 23 import java.io.PrintWriter ; 24 import java.util.*; 25 26 30 31 public class AttrDecl 32 extends Declaration 33 { 34 public boolean readOnly; 35 public TypeSpec param_type_spec; 36 public SymbolList declarators; 37 38 private Vector operations = new Vector(); 39 40 public AttrDecl( int num ) 41 { 42 super( num ); 43 } 44 45 public void setPackage( String s ) 46 { 47 s = parser.pack_replace( s ); 48 if( pack_name.length() > 0 ) 49 pack_name = s + "." + pack_name; 50 else 51 pack_name = s; 52 declarators.setPackage( s ); 53 param_type_spec.setPackage( s ); 54 } 55 56 public void parse() 57 { 58 IdlSymbol myInterface = enclosing_symbol; 59 60 if( param_type_spec.typeSpec() instanceof ScopedName ) 61 { 62 TypeSpec ts = 63 ( (ScopedName)param_type_spec.typeSpec() ).resolvedTypeSpec(); 64 if( ts != null ) 65 param_type_spec = ts; 66 67 myInterface.addImportedName( ts.typeName() ); 68 } 69 70 if (parser.strict_attributes) 73 { 74 declarators.parse(); 75 } 76 77 for (Enumeration e = declarators.v.elements(); e.hasMoreElements();) 78 { 79 operations.addElement( 80 new Method( param_type_spec, 81 null, 82 ( (SimpleDeclarator)e.nextElement() ).name(), 83 is_pseudo) 84 ); 85 } 86 87 if (!readOnly) 88 { 89 for( Enumeration e = declarators.v.elements(); e.hasMoreElements(); ) 90 { 91 SimpleDeclarator d = 92 (SimpleDeclarator)e.nextElement(); 93 operations.addElement( 94 new Method( null, 95 param_type_spec, 96 d.name(), 97 is_pseudo ) 98 ); 99 } 100 } 101 } 102 103 public void print( PrintWriter ps ) 104 { 105 } 106 107 public Enumeration getOperations() 108 { 109 return operations.elements(); 110 } 111 112 115 116 public void getIRInfo( Hashtable irInfoTable ) 117 { 118 for( Enumeration e = declarators.v.elements(); e.hasMoreElements(); ) 119 { 120 String fullName = param_type_spec.full_name(); 121 irInfoTable.put( ( (SimpleDeclarator)e.nextElement() ).name(), 122 "attribute" + ( readOnly?"":"-w" ) + ";" + 123 ( fullName != null ? fullName : param_type_spec.typeName() ) ); 124 } 125 } 126 127 128 } 129 130 131 132 133 134 135 136 | Popular Tags |