blob: 002ca8285c1bb43ae08a4b8d27e67772d72c5f3a [file] [log] [blame]
Mark Slee31985722006-05-24 21:45:31 +00001#ifndef T_ENUM_H
2#define T_ENUM_H
3
4#include "t_constant.h"
5#include <vector>
6
Mark Sleef5377b32006-10-10 01:42:59 +00007/**
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 Slee31985722006-05-24 21:45:31 +000012class t_enum : public t_type {
13 public:
Mark Sleef0712dc2006-10-25 19:03:57 +000014 t_enum(t_program* program) :
15 t_type(program) {}
Mark Slee31985722006-05-24 21:45:31 +000016
Mark Sleef5377b32006-10-10 01:42:59 +000017 void set_name(std::string name) {
18 name_ = name;
19 }
20
21 void append(t_constant* constant) {
22 constants_.push_back(constant);
23 }
Mark Slee31985722006-05-24 21:45:31 +000024
Mark Sleef5377b32006-10-10 01:42:59 +000025 const std::vector<t_constant*>& get_constants() {
26 return constants_;
27 }
28
29 bool is_enum() const {
30 return true;
31 }
Mark Slee31985722006-05-24 21:45:31 +000032
33 private:
34 std::vector<t_constant*> constants_;
35};
36
37#endif