Christopher Wiley | 89eaab5 | 2015-09-15 14:46:46 -0700 | [diff] [blame] | 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 | |
Christopher Wiley | 89e3586 | 2015-08-30 10:57:07 -0700 | [diff] [blame] | 17 | #ifndef AIDL_AIDL_H_ |
| 18 | #define AIDL_AIDL_H_ |
| 19 | |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 20 | #include <limits> |
Christopher Wiley | 90be4e3 | 2015-10-20 14:55:25 -0700 | [diff] [blame] | 21 | #include <memory> |
| 22 | #include <string> |
| 23 | #include <vector> |
| 24 | |
Casey Dahlin | 2cc9316 | 2015-10-02 16:14:17 -0700 | [diff] [blame] | 25 | #include "aidl_language.h" |
Christopher Wiley | 4a2884b | 2015-10-07 11:27:45 -0700 | [diff] [blame] | 26 | #include "io_delegate.h" |
Christopher Wiley | 89e3586 | 2015-08-30 10:57:07 -0700 | [diff] [blame] | 27 | #include "options.h" |
Casey Dahlin | 2cc9316 | 2015-10-02 16:14:17 -0700 | [diff] [blame] | 28 | #include "type_namespace.h" |
Christopher Wiley | 89e3586 | 2015-08-30 10:57:07 -0700 | [diff] [blame] | 29 | |
Christopher Wiley | fdeb0f4 | 2015-09-11 15:38:22 -0700 | [diff] [blame] | 30 | namespace android { |
| 31 | namespace aidl { |
| 32 | |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 33 | enum class AidlError { |
| 34 | UNKOWN = std::numeric_limits<int32_t>::min(), |
| 35 | BAD_PRE_PROCESSED_FILE, |
| 36 | PARSE_ERROR, |
| 37 | FOUND_PARCELABLE, |
| 38 | BAD_PACKAGE, |
| 39 | BAD_IMPORT, |
| 40 | BAD_TYPE, |
| 41 | BAD_METHOD_ID, |
| 42 | GENERATION_ERROR, |
Christopher Wiley | 69b44cf | 2016-05-03 13:43:33 -0700 | [diff] [blame] | 43 | BAD_CONSTANTS, |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 44 | |
| 45 | OK = 0, |
| 46 | }; |
| 47 | |
Christopher Wiley | 4a2884b | 2015-10-07 11:27:45 -0700 | [diff] [blame] | 48 | int compile_aidl_to_cpp(const CppOptions& options, |
| 49 | const IoDelegate& io_delegate); |
| 50 | int compile_aidl_to_java(const JavaOptions& options, |
| 51 | const IoDelegate& io_delegate); |
Casey Dahlin | c1f39b4 | 2015-11-24 10:34:34 -0800 | [diff] [blame] | 52 | bool preprocess_aidl(const JavaOptions& options, |
| 53 | const IoDelegate& io_delegate); |
Christopher Wiley | 89e3586 | 2015-08-30 10:57:07 -0700 | [diff] [blame] | 54 | |
Casey Dahlin | 2cc9316 | 2015-10-02 16:14:17 -0700 | [diff] [blame] | 55 | namespace internals { |
| 56 | |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 57 | AidlError load_and_validate_aidl( |
Chih-Hung Hsieh | f05cc26 | 2016-07-27 11:42:51 -0700 | [diff] [blame] | 58 | const std::vector<std::string>& preprocessed_files, |
| 59 | const std::vector<std::string>& import_paths, |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 60 | const std::string& input_file_name, |
Martijn Coenen | b06c829 | 2018-02-21 21:06:23 +0100 | [diff] [blame] | 61 | const bool generate_traces, |
Christopher Wiley | 632801d | 2015-11-05 14:15:49 -0800 | [diff] [blame] | 62 | const IoDelegate& io_delegate, |
| 63 | TypeNamespace* types, |
| 64 | std::unique_ptr<AidlInterface>* returned_interface, |
| 65 | std::vector<std::unique_ptr<AidlImport>>* returned_imports); |
Casey Dahlin | 2cc9316 | 2015-10-02 16:14:17 -0700 | [diff] [blame] | 66 | |
Christopher Wiley | ef14093 | 2015-11-03 09:29:19 -0800 | [diff] [blame] | 67 | bool parse_preprocessed_file(const IoDelegate& io_delegate, |
| 68 | const std::string& filename, TypeNamespace* types); |
| 69 | |
Casey Dahlin | 2cc9316 | 2015-10-02 16:14:17 -0700 | [diff] [blame] | 70 | } // namespace internals |
| 71 | |
Christopher Wiley | fdeb0f4 | 2015-09-11 15:38:22 -0700 | [diff] [blame] | 72 | } // namespace android |
| 73 | } // namespace aidl |
| 74 | |
Christopher Wiley | 89e3586 | 2015-08-30 10:57:07 -0700 | [diff] [blame] | 75 | #endif // AIDL_AIDL_H_ |