Steven Moreland | b0057e7 | 2018-08-27 01:44:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018, 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 | #pragma once |
| 18 | |
| 19 | #include <string> |
| 20 | |
| 21 | #include "aidl_language.h" |
| 22 | |
| 23 | // This is used to help generate code targetting C++ (the language) whether using the libbinder or |
| 24 | // libbinder_ndk backend. |
| 25 | |
| 26 | namespace android { |
| 27 | namespace aidl { |
| 28 | namespace cpp { |
| 29 | |
| 30 | // These roughly correspond to the various class names in the C++ hierarchy: |
| 31 | enum class ClassNames { |
| 32 | BASE, // Foo (not a real class, but useful in some circumstances). |
| 33 | CLIENT, // BpFoo |
| 34 | SERVER, // BnFoo |
| 35 | INTERFACE, // IFoo |
| 36 | DEFAULT_IMPL, // IFooDefault |
Jiyong Park | 5b7e532 | 2019-04-03 20:05:01 +0900 | [diff] [blame^] | 37 | RAW, // (as shown in the file) |
Steven Moreland | b0057e7 | 2018-08-27 01:44:11 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | string ClassName(const AidlDefinedType& defined_type, ClassNames type); |
| 41 | |
| 42 | // Generate the relative path to a header file. If |use_os_sep| we'll use the |
| 43 | // operating system specific path separator rather than C++'s expected '/' when |
| 44 | // including headers. |
| 45 | std::string HeaderFile(const AidlDefinedType& defined_type, ClassNames class_type, |
| 46 | bool use_os_sep = true); |
| 47 | |
| 48 | void EnterNamespace(CodeWriter& out, const AidlDefinedType& defined_type); |
| 49 | void LeaveNamespace(CodeWriter& out, const AidlDefinedType& defined_type); |
| 50 | |
Steven Moreland | 3b1325f | 2018-09-20 14:45:40 -0700 | [diff] [blame] | 51 | string BuildVarName(const AidlArgument& a); |
| 52 | |
Steven Moreland | b0057e7 | 2018-08-27 01:44:11 -0700 | [diff] [blame] | 53 | } // namespace cpp |
| 54 | } // namespace aidl |
| 55 | } // namespace android |