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_AIDL_H_
18#define AIDL_AIDL_H_
19
20#include <limits>
21#include <memory>
22#include <string>
23#include <vector>
24
25#include "aidl_language.h"
26#include "io_delegate.h"
27#include "options.h"
28#include "type_namespace.h"
29
30namespace android {
31namespace aidl {
32
33enum 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
47int 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);
51bool preprocess_aidl(const JavaOptions& options,
52                     const IoDelegate& io_delegate);
53
54namespace internals {
55
56AidlError 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);
64
65bool parse_preprocessed_file(const IoDelegate& io_delegate,
66                             const std::string& filename, TypeNamespace* types);
67
68} // namespace internals
69
70}  // namespace android
71}  // namespace aidl
72
73#endif  // AIDL_AIDL_H_
74