1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ARK_WEB_CPPTOC_MACROS_H_
17 #define ARK_WEB_CPPTOC_MACROS_H_
18 #pragma once
19 
20 #include "base/include/ark_web_errno.h"
21 #include "base/include/ark_web_log_utils.h"
22 
23 #define ARK_WEB_CPPTOC_DV_LOG(fmt, ...) ARK_WEB_BASE_DV_LOG(fmt, ##__VA_ARGS__)
24 
25 #define ARK_WEB_CPPTOC_REF_LOG(fmt, ...) ARK_WEB_BASE_REF_LOG(fmt, ##__VA_ARGS__)
26 
27 #define ARK_WEB_CPPTOC_DEBUG_LOG(fmt, ...) ARK_WEB_BASE_DEBUG_LOG(fmt, ##__VA_ARGS__)
28 
29 #define ARK_WEB_CPPTOC_INFO_LOG(fmt, ...) ARK_WEB_BASE_INFO_LOG(fmt, ##__VA_ARGS__)
30 
31 #define ARK_WEB_CPPTOC_WARN_LOG(fmt, ...) ARK_WEB_BASE_WARN_LOG(fmt, ##__VA_ARGS__)
32 
33 #define ARK_WEB_CPPTOC_ERROR_LOG(fmt, ...) ARK_WEB_BASE_ERROR_LOG(fmt, ##__VA_ARGS__)
34 
35 #define ARK_WEB_CPPTOC_CHECK_PARAM(param, result)     \
36     {                                                 \
37         ArkWebSetErrno(RESULT_OK);                    \
38         if (!(param)) {                               \
39             ArkWebSetErrno(RESULT_CPPTOC_ERROR);      \
40             ARK_WEB_CPPTOC_WARN_LOG("param is null"); \
41             return result;                            \
42         }                                             \
43     }
44 
45 #endif // ARK_WEB_CPPTOC_MACROS_H_
46