blob: f61598a31f6afe332eb337b35585aca2caf44298 [file] [log] [blame]
Andreas Huberc9410c72016-07-28 12:18:40 -07001#ifndef INTERFACE_H_
2
3#define INTERFACE_H_
4
Zhuoyao Zhang5158db42016-08-10 10:25:20 -07005#include "Method.h"
Andreas Huberc9410c72016-07-28 12:18:40 -07006#include "Scope.h"
7
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -07008#include <utils/KeyedVector.h>
Andreas Huber881227d2016-08-02 14:20:21 -07009#include <vector>
Andreas Huberc9410c72016-07-28 12:18:40 -070010
11namespace android {
12
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070013struct Annotation;
Andreas Huberc9410c72016-07-28 12:18:40 -070014struct Method;
15
16struct Interface : public Scope {
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070017 Interface(
18 Interface *super,
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070019 AnnotationVector *annotations);
Andreas Huberc9410c72016-07-28 12:18:40 -070020
21 void addMethod(Method *method);
22
Andreas Hubera2723d22016-07-29 15:36:07 -070023 bool isInterface() const override;
Andreas Huber295ad302016-08-16 11:35:00 -070024 bool isBinder() const override;
Andreas Huberc9410c72016-07-28 12:18:40 -070025
Andreas Huber6cb08cf2016-08-03 15:44:51 -070026 const Interface *superType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070027
Andreas Huber881227d2016-08-02 14:20:21 -070028 const std::vector<Method *> &methods() const;
29
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070030 const AnnotationVector &annotations() const;
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070031
Andreas Huber881227d2016-08-02 14:20:21 -070032 std::string getCppType(StorageMode mode, std::string *extra) const override;
33
Andreas Huber2831d512016-08-15 09:33:47 -070034 std::string getJavaType() const override;
35
Andreas Huber881227d2016-08-02 14:20:21 -070036 void emitReaderWriter(
37 Formatter &out,
38 const std::string &name,
39 const std::string &parcelObj,
40 bool parcelObjIsPointer,
41 bool isReader,
42 ErrorMode mode) const override;
43
Andreas Huber2831d512016-08-15 09:33:47 -070044 void emitJavaReaderWriter(
45 Formatter &out,
46 const std::string &parcelObj,
47 const std::string &argName,
48 bool isReader) const override;
49
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070050 status_t emitVtsArgumentType(Formatter &out) const override;
51
Andreas Huber70a59e12016-08-16 12:57:01 -070052 bool isJavaCompatible() const override;
53
Andreas Huberc9410c72016-07-28 12:18:40 -070054private:
Andreas Huber6cb08cf2016-08-03 15:44:51 -070055 Interface *mSuperType;
Andreas Huber881227d2016-08-02 14:20:21 -070056 std::vector<Method *> mMethods;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070057 AnnotationVector *mAnnotationsByName;
Andreas Huberc9410c72016-07-28 12:18:40 -070058
59 DISALLOW_COPY_AND_ASSIGN(Interface);
60};
61
62} // namespace android
63
64#endif // INTERFACE_H_
65