1 /*
2  * Copyright (C) 2020 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 <error/Result.h>
20 
21 namespace android {
22 // `ConversionResult` is always defined in the `::android` namespace,
23 // so that it can be found from any nested namespace.
24 // See below for the convenience alias specific to the NDK backend.
25 template <typename T>
26 using ConversionResult = ::android::error::Result<T>;
27 }  // namespace android
28 
29 // Include 'AidlConversionUtil.h' once if 'BACKEND_NDK' is defined,
30 // or no 'BACKEND_*' is defined (C++ backend). Include twice if
31 // 'BACKEND_CPP_NDK' is defined: once with 'BACKEND_NDK_IMPL', once w/o defines.
32 
33 #if defined(BACKEND_CPP_NDK) || defined(BACKEND_NDK)
34 #define BACKEND_NDK_IMPL
35 #include <media/AidlConversionUtil-impl.h>
36 #undef BACKEND_NDK_IMPL
37 #endif
38 
39 #if defined(BACKEND_CPP_NDK) || !defined(BACKEND_NDK)
40 #include <media/AidlConversionUtil-impl.h>
41 #endif
42