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: |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame^] | 14 | t_enum(t_program* program) : |
| 15 | t_type(program) {} |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 16 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 17 | void set_name(std::string name) { |
| 18 | name_ = name; |
| 19 | } |
| 20 | |
| 21 | void append(t_constant* constant) { |
| 22 | constants_.push_back(constant); |
| 23 | } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 24 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 25 | const std::vector<t_constant*>& get_constants() { |
| 26 | return constants_; |
| 27 | } |
| 28 | |
| 29 | bool is_enum() const { |
| 30 | return true; |
| 31 | } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 32 | |
| 33 | private: |
| 34 | std::vector<t_constant*> constants_; |
| 35 | }; |
| 36 | |
| 37 | #endif |