Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame^] | 1 | #ifndef T_CONST_H |
| 2 | #define T_CONST_H |
| 3 | |
| 4 | #include "t_type.h" |
| 5 | #include "t_const_value.h" |
| 6 | |
| 7 | /** |
| 8 | * A const is a constant value defined across languages that has a type and |
| 9 | * a value. The trick here is that the declared type might not match the type |
| 10 | * of the value object, since that is not determined until after parsing the |
| 11 | * whole thing out. |
| 12 | * |
| 13 | * @author Mark Slee <mcslee@facebook.com> |
| 14 | */ |
| 15 | class t_const { |
| 16 | public: |
| 17 | t_const(t_type* type, std::string name, t_const_value* value) : |
| 18 | type_(type), |
| 19 | name_(name), |
| 20 | value_(value) {} |
| 21 | |
| 22 | t_type* get_type() const { |
| 23 | return type_; |
| 24 | } |
| 25 | |
| 26 | std::string get_name() const { |
| 27 | return name_; |
| 28 | } |
| 29 | |
| 30 | t_const_value* get_value() const { |
| 31 | return value_; |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | t_type* type_; |
| 36 | std::string name_; |
| 37 | t_const_value* value_; |
| 38 | }; |
| 39 | |
| 40 | #endif |
| 41 | |