blob: da76519cd4bf7dade3d48187f011b2227058861d [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(
Andreas Huber9ed827c2016-08-22 12:31:13 -070018 const char *localName,
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070019 Interface *super,
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070020 AnnotationVector *annotations);
Andreas Huberc9410c72016-07-28 12:18:40 -070021
22 void addMethod(Method *method);
23
Andreas Hubera2723d22016-07-29 15:36:07 -070024 bool isInterface() const override;
Andreas Huber295ad302016-08-16 11:35:00 -070025 bool isBinder() const override;
Andreas Huberc9410c72016-07-28 12:18:40 -070026
Andreas Huber6cb08cf2016-08-03 15:44:51 -070027 const Interface *superType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070028
Andreas Huber881227d2016-08-02 14:20:21 -070029 const std::vector<Method *> &methods() const;
30
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070031 const AnnotationVector &annotations() const;
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070032
Andreas Huber881227d2016-08-02 14:20:21 -070033 std::string getCppType(StorageMode mode, std::string *extra) const override;
34
Andreas Huber2831d512016-08-15 09:33:47 -070035 std::string getJavaType() const override;
36
Andreas Huber881227d2016-08-02 14:20:21 -070037 void emitReaderWriter(
38 Formatter &out,
39 const std::string &name,
40 const std::string &parcelObj,
41 bool parcelObjIsPointer,
42 bool isReader,
43 ErrorMode mode) const override;
44
Andreas Huber2831d512016-08-15 09:33:47 -070045 void emitJavaReaderWriter(
46 Formatter &out,
47 const std::string &parcelObj,
48 const std::string &argName,
49 bool isReader) const override;
50
Zhuoyao Zhang864c7712016-08-16 15:35:28 -070051 status_t emitVtsAttributeType(Formatter &out) const override;
52
53 status_t emitVtsAttributeDeclaration(Formatter &out) const;
54 status_t emitVtsMethodDeclaration(Formatter &out) const;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070055
Andreas Huber70a59e12016-08-16 12:57:01 -070056 bool isJavaCompatible() const override;
57
Andreas Huberc9410c72016-07-28 12:18:40 -070058private:
Andreas Huber6cb08cf2016-08-03 15:44:51 -070059 Interface *mSuperType;
Andreas Huber881227d2016-08-02 14:20:21 -070060 std::vector<Method *> mMethods;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070061 AnnotationVector *mAnnotationsByName;
Andreas Huberea081b32016-08-17 15:57:47 -070062 mutable bool mIsJavaCompatibleInProgress;
Andreas Huberc9410c72016-07-28 12:18:40 -070063
64 DISALLOW_COPY_AND_ASSIGN(Interface);
65};
66
67} // namespace android
68
69#endif // INTERFACE_H_
70