• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "wallpaper_cjson_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
WallpaperMgrCjsonMock()22 WallpaperMgrCjsonMock::WallpaperMgrCjsonMock()
23 {
24 }
25 
~WallpaperMgrCjsonMock()26 WallpaperMgrCjsonMock::~WallpaperMgrCjsonMock()
27 {
28 }
29 
30 extern "C" {
cJSON_AddNumberToObject(cJSON * const object,const char * const name,const double number)31 cJSON *cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number)
32 {
33     if (WallpaperMgrCjson::wallpaperMgrCjson == nullptr) {
34         return nullptr;
35     }
36     return WallpaperMgrCjson::wallpaperMgrCjson->cJSON_AddNumberToObject(object, name, number);
37 }
38 
cJSON_Print(const cJSON * item)39 char *cJSON_Print(const cJSON *item)
40 {
41     if (WallpaperMgrCjson::wallpaperMgrCjson == nullptr) {
42         return nullptr;
43     }
44     return WallpaperMgrCjson::wallpaperMgrCjson->cJSON_Print(item);
45 }
46 
cJSON_Parse(const char * item)47 cJSON *cJSON_Parse(const char *item)
48 {
49     if (WallpaperMgrCjson::wallpaperMgrCjson == nullptr) {
50         return nullptr;
51     }
52     return WallpaperMgrCjson::wallpaperMgrCjson->cJSON_Parse(item);
53 }
54 
cJSON_GetObjectItemCaseSensitive(const cJSON * const object,const char * const string)55 cJSON *cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string)
56 {
57     if (WallpaperMgrCjson::wallpaperMgrCjson == nullptr) {
58         return nullptr;
59     }
60     return WallpaperMgrCjson::wallpaperMgrCjson->cJSON_GetObjectItemCaseSensitive(object, string);
61 }
62 }
63 } // namespace OHOS