Home | History | Annotate | Download | only in aidl
      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 class JavaOptions;
     30 
     31 namespace java {
     32 
     33 class JavaTypeNamespace;
     34 
     35 int generate_java(const std::string& filename, const std::string& originalSrc,
     36                   AidlInterface* iface, java::JavaTypeNamespace* types,
     37                   const IoDelegate& io_delegate, const JavaOptions& options);
     38 
     39 android::aidl::java::Class* generate_binder_interface_class(
     40     const AidlInterface* iface, java::JavaTypeNamespace* types,
     41     const JavaOptions& options);
     42 
     43 }  // namespace java
     44 
     45 class VariableFactory {
     46  public:
     47   using Variable = ::android::aidl::java::Variable;
     48   using Type = ::android::aidl::java::Type;
     49 
     50   explicit VariableFactory(const std::string& base); // base must be short
     51   Variable* Get(const Type* type);
     52   Variable* Get(int index);
     53 
     54  private:
     55   std::vector<Variable*> vars_;
     56   std::string base_;
     57   int index_;
     58 
     59   DISALLOW_COPY_AND_ASSIGN(VariableFactory);
     60 };
     61 
     62 }  // namespace android
     63 }  // namespace aidl
     64 
     65 #endif // AIDL_GENERATE_JAVA_H_
     66