1 /* 2 * Copyright (C) 2015, 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_CPP_H_ 18 #define AIDL_GENERATE_CPP_H_ 19 20 #include <memory> 21 #include <string> 22 23 #include "aidl_language.h" 24 #include "ast_cpp.h" 25 #include "options.h" 26 #include "type_cpp.h" 27 28 namespace android { 29 namespace aidl { 30 namespace cpp { 31 32 bool GenerateCpp(const CppOptions& options, 33 const cpp::TypeNamespace& types, 34 const AidlInterface& parsed_doc, 35 const IoDelegate& io_delegate); 36 37 // These roughly correspond to the various class names in the C++ hierarchy: 38 enum class ClassNames { 39 BASE, // Foo (not a real class, but useful in some circumstances). 40 CLIENT, // BpFoo 41 SERVER, // BnFoo 42 INTERFACE, // IFoo 43 }; 44 45 // Generate the relative path to a header file. If |use_os_sep| we'll use the 46 // operating system specific path separator rather than C++'s expected '/' when 47 // including headers. 48 std::string HeaderFile(const AidlInterface& interface, ClassNames class_type, 49 bool use_os_sep = true); 50 51 namespace internals { 52 std::unique_ptr<Document> BuildClientSource(const TypeNamespace& types, 53 const AidlInterface& parsed_doc); 54 std::unique_ptr<Document> BuildServerSource(const TypeNamespace& types, 55 const AidlInterface& parsed_doc); 56 std::unique_ptr<Document> BuildInterfaceSource(const TypeNamespace& types, 57 const AidlInterface& parsed_doc); 58 std::unique_ptr<Document> BuildClientHeader(const TypeNamespace& types, 59 const AidlInterface& parsed_doc); 60 std::unique_ptr<Document> BuildServerHeader(const TypeNamespace& types, 61 const AidlInterface& parsed_doc); 62 std::unique_ptr<Document> BuildInterfaceHeader(const TypeNamespace& types, 63 const AidlInterface& parsed_doc); 64 } 65 } // namespace cpp 66 } // namespace aidl 67 } // namespace android 68 69 #endif // AIDL_GENERATE_CPP_H_ 70