Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 1 | #ifndef METHOD_H_ |
| 2 | |
| 3 | #define METHOD_H_ |
| 4 | |
| 5 | #include <android-base/macros.h> |
| 6 | #include <string> |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 7 | #include <utils/KeyedVector.h> |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 8 | #include <vector> |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 9 | |
| 10 | namespace android { |
| 11 | |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 12 | struct Annotation; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 13 | struct Formatter; |
| 14 | struct Type; |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 15 | struct TypedVar; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 16 | |
| 17 | struct Method { |
| 18 | Method(const char *name, |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 19 | std::vector<TypedVar *> *args, |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 20 | std::vector<TypedVar *> *results, |
| 21 | KeyedVector<std::string, Annotation *> *annotations); |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 22 | |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 23 | std::string name() const; |
| 24 | const std::vector<TypedVar *> &args() const; |
| 25 | const std::vector<TypedVar *> &results() const; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 26 | const KeyedVector<std::string, Annotation *> &annotations() const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 27 | |
| 28 | static std::string GetSignature(const std::vector<TypedVar *> &args); |
| 29 | |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 30 | void dumpAnnotations(Formatter &out) const; |
| 31 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 32 | private: |
| 33 | std::string mName; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 34 | std::vector<TypedVar *> *mArgs; |
| 35 | std::vector<TypedVar *> *mResults; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame^] | 36 | KeyedVector<std::string, Annotation *> *mAnnotationsByName; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 37 | |
| 38 | DISALLOW_COPY_AND_ASSIGN(Method); |
| 39 | }; |
| 40 | |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 41 | struct TypedVar { |
| 42 | TypedVar(const char *name, Type *type); |
| 43 | |
| 44 | std::string name() const; |
| 45 | const Type &type() const; |
| 46 | |
| 47 | private: |
| 48 | std::string mName; |
| 49 | Type *mType; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(TypedVar); |
| 52 | }; |
| 53 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 54 | } // namespace android |
| 55 | |
| 56 | #endif // METHOD_H_ |
| 57 | |