blob: e5fd4ac8403533d45c2de919e16d66d05bca17a6 [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,
43
44 OK = 0,
45};
46
Christopher Wiley4a2884b2015-10-07 11:27:45 -070047int compile_aidl_to_cpp(const CppOptions& options,
48 const IoDelegate& io_delegate);
49int compile_aidl_to_java(const JavaOptions& options,
50 const IoDelegate& io_delegate);
Bart Searseedb29f2015-11-24 06:41:40 +000051int preprocess_aidl(const JavaOptions& options,
52 const IoDelegate& io_delegate);
Christopher Wiley89e35862015-08-30 10:57:07 -070053
Casey Dahlin2cc93162015-10-02 16:14:17 -070054namespace internals {
55
Christopher Wiley632801d2015-11-05 14:15:49 -080056AidlError load_and_validate_aidl(
57 const std::vector<std::string> preprocessed_files,
58 const std::vector<std::string> import_paths,
59 const std::string& input_file_name,
60 const IoDelegate& io_delegate,
61 TypeNamespace* types,
62 std::unique_ptr<AidlInterface>* returned_interface,
63 std::vector<std::unique_ptr<AidlImport>>* returned_imports);
Casey Dahlin2cc93162015-10-02 16:14:17 -070064
Christopher Wileyef140932015-11-03 09:29:19 -080065bool parse_preprocessed_file(const IoDelegate& io_delegate,
66 const std::string& filename, TypeNamespace* types);
67
Casey Dahlin2cc93162015-10-02 16:14:17 -070068} // namespace internals
69
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070070} // namespace android
71} // namespace aidl
72
Christopher Wiley89e35862015-08-30 10:57:07 -070073#endif // AIDL_AIDL_H_