blob: 6719030fcfaf60dd771d514cca57a658e7156e71 [file] [log] [blame]
Christopher Wiley3a9da172016-01-29 11:10:49 -08001/*
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
Christopher Wiley89e35862015-08-30 10:57:07 -070017#ifndef AIDL_GENERATE_JAVA_H_
18#define AIDL_GENERATE_JAVA_H_
Adam Lesinskiffa16862014-01-23 18:17:42 -080019
Adam Lesinskiffa16862014-01-23 18:17:42 -080020#include <string>
21
Christopher Wiley038485e2015-09-12 11:14:14 -070022#include "aidl_language.h"
23#include "ast_java.h"
Christopher Wileya30a45e2015-10-17 10:56:59 -070024#include "io_delegate.h"
Christopher Wiley038485e2015-09-12 11:14:14 -070025
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070026namespace android {
27namespace aidl {
28
Christopher Wileydb154a52015-09-28 16:32:25 -070029namespace java {
30
Christopher Wiley84c1eac2015-09-23 13:29:28 -070031class JavaTypeNamespace;
32
Christopher Wiley3a9da172016-01-29 11:10:49 -080033int generate_java(const std::string& filename, const std::string& originalSrc,
Christopher Wileya30a45e2015-10-17 10:56:59 -070034 AidlInterface* iface, java::JavaTypeNamespace* types,
35 const IoDelegate& io_delegate);
Adam Lesinskiffa16862014-01-23 18:17:42 -080036
Christopher Wileydb154a52015-09-28 16:32:25 -070037android::aidl::java::Class* generate_binder_interface_class(
Casey Dahlin1ae2bc52015-10-07 18:49:10 -070038 const AidlInterface* iface, java::JavaTypeNamespace* types);
Christopher Wileydb154a52015-09-28 16:32:25 -070039
40} // namespace java
Adam Lesinskiffa16862014-01-23 18:17:42 -080041
Christopher Wiley3a9da172016-01-29 11:10:49 -080042class VariableFactory {
43 public:
44 using Variable = ::android::aidl::java::Variable;
45 using Type = ::android::aidl::java::Type;
Adam Lesinskiffa16862014-01-23 18:17:42 -080046
Christopher Wiley12e894a2016-01-29 11:55:07 -080047 VariableFactory(const std::string& base); // base must be short
Christopher Wiley3a9da172016-01-29 11:10:49 -080048 Variable* Get(const Type* type);
49 Variable* Get(int index);
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070050
Christopher Wiley3a9da172016-01-29 11:10:49 -080051 private:
52 std::vector<Variable*> vars_;
53 std::string base_;
54 int index_;
55
56 DISALLOW_COPY_AND_ASSIGN(VariableFactory);
Adam Lesinskiffa16862014-01-23 18:17:42 -080057};
58
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070059} // namespace android
60} // namespace aidl
Adam Lesinskiffa16862014-01-23 18:17:42 -080061
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070062#endif // AIDL_GENERATE_JAVA_H_