001: /*
002: * JacORB - a free Java ORB
003: *
004: * Copyright (C) 1997-2004 Gerald Brose.
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Library General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Library General Public License for more details.
015: *
016: * You should have received a copy of the GNU Library General Public
017: * License along with this library; if not, write to the Free
018: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
019: */
020:
021: package org.jacorb.idl;
022:
023: /**
024: * @author Gerald Brose
025: * @version $Id: Value.java,v 1.22 2004/05/06 12:39:59 nicolas Exp $
026: */
027:
028: import java.io.PrintWriter;
029:
030: public class Value extends TypeDeclaration {
031: private Value value;
032:
033: public Value(int num) {
034: super (num);
035: pack_name = "";
036: }
037:
038: public Object clone() {
039: return value.clone();
040: }
041:
042: public void setValue(Value value) {
043: this .value = value;
044: }
045:
046: public TypeDeclaration declaration() {
047: return value;
048: };
049:
050: public String typeName() {
051: return value.typeName();
052: }
053:
054: /**
055: * @return a string for an expression of type TypeCode
056: * that describes this type
057: */
058:
059: public String getTypeCodeExpression() {
060: return value.getTypeCodeExpression();
061: }
062:
063: public boolean basic() {
064: return value.basic();
065: }
066:
067: public void setPackage(String s) {
068: s = parser.pack_replace(s);
069: value.setPackage(s);
070: }
071:
072: public void set_included(boolean i) {
073: included = i;
074: value.set_included(i);
075: }
076:
077: public void parse() {
078: value.parse();
079: }
080:
081: public String holderName() {
082: return value.holderName();
083: }
084:
085: public void print(PrintWriter ps) {
086: value.print(ps);
087: }
088:
089: public String toString() {
090: return value.toString();
091: }
092:
093: public void setEnclosingSymbol(IdlSymbol s) {
094: if (enclosing_symbol != null && enclosing_symbol != s) {
095: logger.error("was " + enclosing_symbol.getClass().getName()
096: + " now: " + s.getClass().getName());
097: throw new RuntimeException(
098: "Compiler Error: trying to reassign container for "
099: + name);
100: }
101: if (s == null)
102: throw new RuntimeException(
103: "Compiler Error: enclosing symbol is null!");
104:
105: enclosing_symbol = s;
106: value.setEnclosingSymbol(s);
107: }
108:
109: public String printReadExpression(String streamname) {
110: return value.printReadExpression(streamname);
111: }
112:
113: public String printReadStatement(String var_name, String streamname) {
114: return value.printReadStatement(var_name, streamname);
115: }
116:
117: public String printWriteStatement(String var_name, String streamname) {
118: return value.printWriteStatement(var_name, streamname);
119: }
120:
121: /**
122: */
123:
124: public void accept(IDLTreeVisitor visitor) {
125: value.accept(visitor);
126: }
127:
128: }
|