blob: 6e87c8c6366c191eb1166e16de6451882903cb9a [file] [log] [blame]
Mark Slee31985722006-05-24 21:45:31 +00001#ifndef T_STRUCT_H
2#define T_STRUCT_H
3
4#include <vector>
5#include <string>
6
7#include "t_type.h"
Mark Sleee8540632006-05-30 09:24:40 +00008#include "t_field.h"
Mark Slee31985722006-05-24 21:45:31 +00009
10class t_struct : public t_type {
11 public:
Mark Sleee8540632006-05-30 09:24:40 +000012 t_struct() {}
Mark Sleeb15a68b2006-06-07 06:46:24 +000013 t_struct(const std::string& name) : t_type(name) {}
14
Mark Slee31985722006-05-24 21:45:31 +000015 ~t_struct() {}
16
Mark Sleee8540632006-05-30 09:24:40 +000017 /** 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 Slee31985722006-05-24 21:45:31 +000025
26 private:
Mark Sleee8540632006-05-30 09:24:40 +000027 std::vector<t_field*> members_;
Mark Slee31985722006-05-24 21:45:31 +000028};
29
30#endif