blob: eb260c02b6edf078fe474deda39ba3bcc81d07d0 [file] [log] [blame]
Christopher Wiley89eaab52015-09-15 14:46:46 -07001/*
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 Wiley89e35862015-08-30 10:57:07 -070017#ifndef AIDL_AIDL_H_
18#define AIDL_AIDL_H_
19
Christopher Wiley632801d2015-11-05 14:15:49 -080020#include <limits>
Christopher Wiley90be4e32015-10-20 14:55:25 -070021#include <memory>
22#include <string>
23#include <vector>
24
Casey Dahlin2cc93162015-10-02 16:14:17 -070025#include "aidl_language.h"
Christopher Wiley4a2884b2015-10-07 11:27:45 -070026#include "io_delegate.h"
Christopher Wiley89e35862015-08-30 10:57:07 -070027#include "options.h"
Casey Dahlin2cc93162015-10-02 16:14:17 -070028#include "type_namespace.h"
Christopher Wiley89e35862015-08-30 10:57:07 -070029
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070030namespace android {
31namespace aidl {
32
Christopher Wiley632801d2015-11-05 14:15:49 -080033enum 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 Wiley69b44cf2016-05-03 13:43:33 -070043 BAD_CONSTANTS,
Christopher Wiley632801d2015-11-05 14:15:49 -080044
45 OK = 0,
46};
47
Christopher Wiley4a2884b2015-10-07 11:27:45 -070048int compile_aidl_to_cpp(const CppOptions& options,
49 const IoDelegate& io_delegate);
50int compile_aidl_to_java(const JavaOptions& options,
51 const IoDelegate& io_delegate);
Casey Dahlinc1f39b42015-11-24 10:34:34 -080052bool preprocess_aidl(const JavaOptions& options,
53 const IoDelegate& io_delegate);
Christopher Wiley89e35862015-08-30 10:57:07 -070054
Casey Dahlin2cc93162015-10-02 16:14:17 -070055namespace internals {
56
Christopher Wiley632801d2015-11-05 14:15:49 -080057AidlError load_and_validate_aidl(
Chih-Hung Hsiehf05cc262016-07-27 11:42:51 -070058 const std::vector<std::string>& preprocessed_files,
59 const std::vector<std::string>& import_paths,
Christopher Wiley632801d2015-11-05 14:15:49 -080060 const std::string& input_file_name,
Martijn Coenenb06c8292018-02-21 21:06:23 +010061 const bool generate_traces,
Christopher Wiley632801d2015-11-05 14:15:49 -080062 const IoDelegate& io_delegate,
63 TypeNamespace* types,
64 std::unique_ptr<AidlInterface>* returned_interface,
65 std::vector<std::unique_ptr<AidlImport>>* returned_imports);
Casey Dahlin2cc93162015-10-02 16:14:17 -070066
Christopher Wileyef140932015-11-03 09:29:19 -080067bool parse_preprocessed_file(const IoDelegate& io_delegate,
68 const std::string& filename, TypeNamespace* types);
69
Casey Dahlin2cc93162015-10-02 16:14:17 -070070} // namespace internals
71
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070072} // namespace android
73} // namespace aidl
74
Christopher Wiley89e35862015-08-30 10:57:07 -070075#endif // AIDL_AIDL_H_