blob: ddff137490cb84c84951ce4f900281aad229304c [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 Huberc9410c72016-07-28 12:18:40 -070024
Andreas Huber6cb08cf2016-08-03 15:44:51 -070025 const Interface *superType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070026
Andreas Huber881227d2016-08-02 14:20:21 -070027 const std::vector<Method *> &methods() const;
28
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070029 const AnnotationVector &annotations() const;
Zhuoyao Zhangba7e6e92016-08-10 12:19:02 -070030
Andreas Huber881227d2016-08-02 14:20:21 -070031 std::string getCppType(StorageMode mode, std::string *extra) const override;
32
Andreas Huber2831d512016-08-15 09:33:47 -070033 std::string getJavaType() const override;
34
Andreas Huber881227d2016-08-02 14:20:21 -070035 void emitReaderWriter(
36 Formatter &out,
37 const std::string &name,
38 const std::string &parcelObj,
39 bool parcelObjIsPointer,
40 bool isReader,
41 ErrorMode mode) const override;
42
Andreas Huber2831d512016-08-15 09:33:47 -070043 void emitJavaReaderWriter(
44 Formatter &out,
45 const std::string &parcelObj,
46 const std::string &argName,
47 bool isReader) const override;
48
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070049 status_t emitVtsArgumentType(Formatter &out) const override;
50
Andreas Huberc9410c72016-07-28 12:18:40 -070051private:
Andreas Huber6cb08cf2016-08-03 15:44:51 -070052 Interface *mSuperType;
Andreas Huber881227d2016-08-02 14:20:21 -070053 std::vector<Method *> mMethods;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070054 AnnotationVector *mAnnotationsByName;
Andreas Huberc9410c72016-07-28 12:18:40 -070055
56 DISALLOW_COPY_AND_ASSIGN(Interface);
57};
58
59} // namespace android
60
61#endif // INTERFACE_H_
62