Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 1 | #ifndef T_FUNCTION_H |
| 2 | #define T_FUNCTION_H |
| 3 | |
| 4 | #include <string> |
| 5 | #include "t_type.h" |
| 6 | #include "t_struct.h" |
| 7 | |
| 8 | /** |
| 9 | * Representation of a function. Key parst are return type, function name, |
Mark Slee | 52f643d | 2006-08-09 00:03:43 +0000 | [diff] [blame^] | 10 | * optional modifiers, and an argument list. |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 11 | * |
| 12 | * @author Mark Slee <mcslee@facebook.com> |
| 13 | */ |
| 14 | class t_function { |
| 15 | public: |
Mark Slee | 52f643d | 2006-08-09 00:03:43 +0000 | [diff] [blame^] | 16 | t_function(t_type* returntype, |
| 17 | std::string name, |
| 18 | t_struct* arglist, |
| 19 | bool async=false) : |
| 20 | returntype_(returntype), |
| 21 | name_(name), |
| 22 | arglist_(arglist), |
| 23 | async_(async) {} |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 24 | |
| 25 | ~t_function() {} |
| 26 | |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 27 | t_type* get_returntype() const { return returntype_; } |
| 28 | const std::string& get_name() const { return name_; } |
| 29 | t_struct* get_arglist() const { return arglist_; } |
Mark Slee | 52f643d | 2006-08-09 00:03:43 +0000 | [diff] [blame^] | 30 | bool is_async() const { return async_; } |
Mark Slee | b15a68b | 2006-06-07 06:46:24 +0000 | [diff] [blame] | 31 | |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 32 | private: |
| 33 | t_type* returntype_; |
| 34 | std::string name_; |
| 35 | t_struct* arglist_; |
Mark Slee | 52f643d | 2006-08-09 00:03:43 +0000 | [diff] [blame^] | 36 | bool async_; |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | #endif |