Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 1 | #ifndef T_FIELD_H |
| 2 | #define T_FIELD_H |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | /** |
| 7 | * Class to represent a field in a thrift structure or in a set of arguments |
| 8 | * to a thrift function. |
| 9 | * |
| 10 | * @author Mark Slee <mcslee@facebook.com> |
| 11 | */ |
| 12 | class t_field { |
| 13 | public: |
Mark Slee | b15a68b | 2006-06-07 06:46:24 +0000 | [diff] [blame^] | 14 | t_field(t_type* type, std::string name) : |
| 15 | type_(type), name_(name), key_(0) {} |
| 16 | |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 17 | t_field(t_type* type, std::string name, uint32_t key) : |
| 18 | type_(type), name_(name), key_(key) {} |
| 19 | |
| 20 | ~t_field() {} |
| 21 | |
| 22 | t_type* get_type() const { return type_; } |
| 23 | const std::string& get_name() const { return name_; } |
| 24 | uint32_t get_key() const { return key_; } |
| 25 | |
| 26 | private: |
| 27 | t_type* type_; |
| 28 | std::string name_; |
| 29 | uint32_t key_; |
| 30 | }; |
| 31 | |
| 32 | #endif |