| 1 |
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
package com.eprosima.idl.parser.tree; |
| 16 |
|
| 17 |
import com.eprosima.idl.context.Context; |
| 18 |
import com.eprosima.idl.parser.typecode.TypeCode; |
| 19 |
|
| 20 |
import org.antlr.v4.runtime.Token; |
| 21 |
|
| 22 |
public class ConstDeclaration extends DefinitionContainer implements Definition, Export |
| 23 |
{ |
| 24 |
public ConstDeclaration( |
| 25 |
String scopeFile, |
| 26 |
boolean isInScope, |
| 27 |
String scope, |
| 28 |
String name, |
| 29 |
TypeCode typecode, |
| 30 |
String value, |
| 31 |
String evaluated_value, |
| 32 |
Token token) |
| 33 |
{ |
| 34 |
super(scopeFile, isInScope, scope, name, token); |
| 35 |
|
| 36 |
m_typecode = typecode; |
| 37 |
m_value = value; |
| 38 |
evaluated_value_ = evaluated_value; |
| 39 |
// Set as parent to the Typecode. |
| 40 |
m_typecode.setParent(this); |
| 41 |
} |
| 42 |
|
| 43 |
public TypeCode getTypeCode() |
| 44 |
{ |
| 45 |
return m_typecode; |
| 46 |
} |
| 47 |
|
| 48 |
public String getEvaluatedValue() |
| 49 |
{ |
| 50 |
return evaluated_value_; |
| 51 |
} |
| 52 |
|
| 53 |
public String getValue() |
| 54 |
{ |
| 55 |
return m_value; |
| 56 |
} |
| 57 |
|
| 58 |
public void setParent(Object obj) |
| 59 |
{ |
| 60 |
m_parent = obj; |
| 61 |
} |
| 62 |
|
| 63 |
public Object getParent() |
| 64 |
{ |
| 65 |
return m_parent; |
| 66 |
} |
| 67 |
|
| 68 |
@Override |
| 69 |
public boolean isIsModule() |
| 70 |
{ |
| 71 |
return false; |
| 72 |
} |
| 73 |
|
| 74 |
@Override |
| 75 |
public boolean isIsOperation() |
| 76 |
{ |
| 77 |
return false; |
| 78 |
} |
| 79 |
|
| 80 |
@Override |
| 81 |
public boolean isIsException() |
| 82 |
{ |
| 83 |
return false; |
| 84 |
} |
| 85 |
|
| 86 |
@Override |
| 87 |
public boolean isIsInterface() |
| 88 |
{ |
| 89 |
return false; |
| 90 |
} |
| 91 |
|
| 92 |
@Override |
| 93 |
public boolean isIsTypeDeclaration() |
| 94 |
{ |
| 95 |
return false; |
| 96 |
} |
| 97 |
|
| 98 |
@Override |
| 99 |
public boolean isIsConstDeclaration() |
| 100 |
{ |
| 101 |
return true; |
| 102 |
} |
| 103 |
|
| 104 |
@Override |
| 105 |
public boolean resolve(Context ctx) |
| 106 |
{ |
| 107 |
return true; |
| 108 |
} |
| 109 |
|
| 110 |
@Override |
| 111 |
public boolean isIsAnnotation() |
| 112 |
{ |
| 113 |
return false; |
| 114 |
} |
| 115 |
|
| 116 |
private String evaluated_value_ = null; |
| 117 |
private TypeCode m_typecode = null; |
| 118 |
private String m_value = null; |
| 119 |
private Object m_parent = null; |
| 120 |
} |