Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 1 | #ifndef T_STRUCT_H |
| 2 | #define T_STRUCT_H |
| 3 | |
| 4 | #include <vector> |
| 5 | #include <string> |
| 6 | |
| 7 | #include "t_type.h" |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 8 | #include "t_field.h" |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 9 | |
| 10 | class t_struct : public t_type { |
| 11 | public: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 12 | t_struct() {} |
Mark Slee | b15a68b | 2006-06-07 06:46:24 +0000 | [diff] [blame^] | 13 | t_struct(const std::string& name) : t_type(name) {} |
| 14 | |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 15 | ~t_struct() {} |
| 16 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 17 | /** Set the struct name */ |
| 18 | void set_name(const std::string& name) { name_ = name; } |
| 19 | |
| 20 | /** Add a new field to the list */ |
| 21 | void append(t_field* elem) { members_.push_back(elem); } |
| 22 | |
| 23 | const std::vector<t_field*>& get_members() { return members_; } |
| 24 | bool is_struct() const { return true; } |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 25 | |
| 26 | private: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 27 | std::vector<t_field*> members_; |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | #endif |