1 /*
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 
17 #ifndef AIDL_GENERATE_JAVA_H_
18 #define AIDL_GENERATE_JAVA_H_
19 
20 #include <string>
21 
22 #include "aidl_language.h"
23 #include "ast_java.h"
24 #include "io_delegate.h"
25 
26 namespace android {
27 namespace aidl {
28 
29 namespace java {
30 
31 class JavaTypeNamespace;
32 
33 int generate_java(const std::string& filename, const std::string& originalSrc,
34                   AidlInterface* iface, java::JavaTypeNamespace* types,
35                   const IoDelegate& io_delegate);
36 
37 android::aidl::java::Class* generate_binder_interface_class(
38     const AidlInterface* iface, java::JavaTypeNamespace* types);
39 
40 }  // namespace java
41 
42 class VariableFactory {
43  public:
44   using Variable = ::android::aidl::java::Variable;
45   using Type = ::android::aidl::java::Type;
46 
47   VariableFactory(const std::string& base); // base must be short
48   Variable* Get(const Type* type);
49   Variable* Get(int index);
50 
51  private:
52   std::vector<Variable*> vars_;
53   std::string base_;
54   int index_;
55 
56   DISALLOW_COPY_AND_ASSIGN(VariableFactory);
57 };
58 
59 }  // namespace android
60 }  // namespace aidl
61 
62 #endif // AIDL_GENERATE_JAVA_H_
63