David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 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 | */ |
Mark Slee | e9ce01c | 2007-05-16 02:29:53 +0000 | [diff] [blame] | 19 | |
Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame] | 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 | * |
Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame] | 32 | */ |
David Reiss | cdffe26 | 2007-08-14 17:12:31 +0000 | [diff] [blame] | 33 | class t_const : public t_doc { |
Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame] | 34 | public: |
| 35 | t_const(t_type* type, std::string name, t_const_value* value) : |
| 36 | type_(type), |
| 37 | name_(name), |
| 38 | value_(value) {} |
| 39 | |
| 40 | t_type* get_type() const { |
| 41 | return type_; |
| 42 | } |
| 43 | |
| 44 | std::string get_name() const { |
| 45 | return name_; |
| 46 | } |
| 47 | |
| 48 | t_const_value* get_value() const { |
| 49 | return value_; |
| 50 | } |
| 51 | |
| 52 | private: |
| 53 | t_type* type_; |
| 54 | std::string name_; |
| 55 | t_const_value* value_; |
| 56 | }; |
| 57 | |
| 58 | #endif |
| 59 | |