Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 1 | #ifndef T_ENUM_H |
| 2 | #define T_ENUM_H |
| 3 | |
| 4 | #include "t_constant.h" |
| 5 | #include <vector> |
| 6 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 7 | /** |
| 8 | * An enumerated type. A list of t_constant objects with a name for the type. |
| 9 | * |
| 10 | * @author Mark Slee <mcslee@facebook.com> |
| 11 | */ |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 12 | class t_enum : public t_type { |
| 13 | public: |
| 14 | t_enum() {} |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 15 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 16 | void set_name(std::string name) { |
| 17 | name_ = name; |
| 18 | } |
| 19 | |
| 20 | void append(t_constant* constant) { |
| 21 | constants_.push_back(constant); |
| 22 | } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 23 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 24 | const std::vector<t_constant*>& get_constants() { |
| 25 | return constants_; |
| 26 | } |
| 27 | |
| 28 | bool is_enum() const { |
| 29 | return true; |
| 30 | } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | std::vector<t_constant*> constants_; |
| 34 | }; |
| 35 | |
| 36 | #endif |