blob: 1c793e70463d6c4c81ba5a6c6bd50632a6a6e627 [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Andreas Huberc9410c72016-07-28 12:18:40 -070017#ifndef INTERFACE_H_
18
19#define INTERFACE_H_
20
21#include "Scope.h"
22
Andreas Huberc9410c72016-07-28 12:18:40 -070023namespace android {
24
25struct Method;
26
27struct Interface : public Scope {
Andreas Huber7c5ddfb2016-09-29 13:45:22 -070028 Interface(const char *localName, Interface *super);
Andreas Huberc9410c72016-07-28 12:18:40 -070029
30 void addMethod(Method *method);
31
Andreas Hubera2723d22016-07-29 15:36:07 -070032 bool isInterface() const override;
Andreas Huber295ad302016-08-16 11:35:00 -070033 bool isBinder() const override;
Andreas Huberc9410c72016-07-28 12:18:40 -070034
Andreas Huber6cb08cf2016-08-03 15:44:51 -070035 const Interface *superType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070036
Andreas Huber881227d2016-08-02 14:20:21 -070037 const std::vector<Method *> &methods() const;
38
Steven Moreland40786312016-08-16 10:29:40 -070039 std::string getBaseName() const;
40
Andreas Huber4c865b72016-09-14 15:26:27 -070041 std::string getCppType(
42 StorageMode mode,
43 std::string *extra,
44 bool specifyNamespaces) const override;
Andreas Huber881227d2016-08-02 14:20:21 -070045
Andreas Huber4c865b72016-09-14 15:26:27 -070046 std::string getJavaType(
47 std::string *extra, bool forInitializer) const override;
Andreas Huber2831d512016-08-15 09:33:47 -070048
Andreas Huber881227d2016-08-02 14:20:21 -070049 void emitReaderWriter(
50 Formatter &out,
51 const std::string &name,
52 const std::string &parcelObj,
53 bool parcelObjIsPointer,
54 bool isReader,
55 ErrorMode mode) const override;
56
Andreas Huber2831d512016-08-15 09:33:47 -070057 void emitJavaReaderWriter(
58 Formatter &out,
59 const std::string &parcelObj,
60 const std::string &argName,
61 bool isReader) const override;
62
Zhuoyao Zhang864c7712016-08-16 15:35:28 -070063 status_t emitVtsAttributeType(Formatter &out) const override;
64
65 status_t emitVtsAttributeDeclaration(Formatter &out) const;
66 status_t emitVtsMethodDeclaration(Formatter &out) const;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070067
Steven Moreland69e7c702016-09-09 11:16:32 -070068 bool hasOnewayMethods() const;
69
Andreas Huber70a59e12016-08-16 12:57:01 -070070 bool isJavaCompatible() const override;
71
Andreas Huberc9410c72016-07-28 12:18:40 -070072private:
Andreas Huber6cb08cf2016-08-03 15:44:51 -070073 Interface *mSuperType;
Andreas Huber881227d2016-08-02 14:20:21 -070074 std::vector<Method *> mMethods;
Andreas Huberea081b32016-08-17 15:57:47 -070075 mutable bool mIsJavaCompatibleInProgress;
Andreas Huberc9410c72016-07-28 12:18:40 -070076
77 DISALLOW_COPY_AND_ASSIGN(Interface);
78};
79
80} // namespace android
81
82#endif // INTERFACE_H_
83