Line data Source code
1 : /* 2 : * Licensed to the Apache Software Foundation (ASF) under one 3 : * or more contributor license agreements. See the NOTICE file 4 : * distributed with this work for additional information 5 : * regarding copyright ownership. The ASF licenses this file 6 : * to you under the Apache License, Version 2.0 (the 7 : * "License"); you may not use this file except in compliance 8 : * with the License. You may obtain a copy of the License at 9 : * 10 : * http://www.apache.org/licenses/LICENSE-2.0 11 : * 12 : * Unless required by applicable law or agreed to in writing, 13 : * software distributed under the License is distributed on an 14 : * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 : * KIND, either express or implied. See the License for the 16 : * specific language governing permissions and limitations 17 : * under the License. 18 : */ 19 : 20 : #ifndef T_CONST_H 21 : #define T_CONST_H 22 : 23 : #include "t_type.h" 24 : #include "t_const_value.h" 25 : 26 : /** 27 : * A const is a constant value defined across languages that has a type and 28 : * a value. The trick here is that the declared type might not match the type 29 : * of the value object, since that is not determined until after parsing the 30 : * whole thing out. 31 : * 32 : */ 33 : class t_const : public t_doc { 34 : public: 35 8450 : t_const(t_type* type, std::string name, t_const_value* value) : 36 8450 : type_(type), 37 8450 : name_(name), 38 16900 : value_(value) {} 39 : 40 11499 : t_type* get_type() const { 41 11499 : return type_; 42 : } 43 : 44 7379 : std::string get_name() const { 45 7379 : return name_; 46 : } 47 : 48 9998 : t_const_value* get_value() const { 49 9998 : return value_; 50 : } 51 : 52 : private: 53 : t_type* type_; 54 : std::string name_; 55 : t_const_value* value_; 56 : }; 57 : 58 : #endif 59 :