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); |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame^] | 29 | static std::string GetJavaSignature(const std::vector<TypedVar *> &args); |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 30 | |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 31 | void dumpAnnotations(Formatter &out) const; |
| 32 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 33 | private: |
| 34 | std::string mName; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 35 | std::vector<TypedVar *> *mArgs; |
| 36 | std::vector<TypedVar *> *mResults; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 37 | KeyedVector<std::string, Annotation *> *mAnnotationsByName; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(Method); |
| 40 | }; |
| 41 | |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 42 | struct TypedVar { |
| 43 | TypedVar(const char *name, Type *type); |
| 44 | |
| 45 | std::string name() const; |
| 46 | const Type &type() const; |
| 47 | |
| 48 | private: |
| 49 | std::string mName; |
| 50 | Type *mType; |
| 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(TypedVar); |
| 53 | }; |
| 54 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 55 | } // namespace android |
| 56 | |
| 57 | #endif // METHOD_H_ |
| 58 | |