1 /*
2 * Copyright (c) 2021-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 "hap_resource.h"
17
18 using ReadLock = std::shared_lock<std::shared_mutex>;
19 using WriteLock = std::unique_lock<std::shared_mutex>;
20
21 namespace OHOS {
22 namespace Global {
23 namespace Resource {
ValueUnderQualifierDir(const std::pair<std::string,std::string> & resPath,std::shared_ptr<ResConfigImpl> resConfig,bool isOverlay,bool isSystemResource)24 ValueUnderQualifierDir::ValueUnderQualifierDir(const std::pair<std::string, std::string> &resPath,
25 std::shared_ptr<ResConfigImpl> resConfig, bool isOverlay, bool isSystemResource) : indexPath_(resPath.first),
26 resourcePath_(resPath.second), resConfig_(resConfig), isOverlay_(isOverlay), isSystemResource_(isSystemResource)
27 {}
28
~ValueUnderQualifierDir()29 ValueUnderQualifierDir::~ValueUnderQualifierDir()
30 {}
31
GetIdItem() const32 std::shared_ptr<IdItem> ValueUnderQualifierDir::GetIdItem() const
33 {
34 return nullptr;
35 }
36
~IdValues()37 IdValues::~IdValues()
38 {}
39
HapResource(const std::string path,time_t lastModTime)40 HapResource::HapResource(const std::string path, time_t lastModTime) : indexPath_(path), lastModTime_(lastModTime)
41 {}
42
~HapResource()43 HapResource::~HapResource()
44 {
45 lastModTime_ = 0;
46 }
47
IsSystemResource() const48 bool HapResource::IsSystemResource() const
49 {
50 return false;
51 }
52
IsOverlayResource() const53 bool HapResource::IsOverlayResource() const
54 {
55 return false;
56 }
57
GetIdValues(const uint32_t id)58 const std::shared_ptr<IdValues> HapResource::GetIdValues(const uint32_t id)
59 {
60 return nullptr;
61 }
62
GetIdValuesByName(const std::string name,const ResType resType)63 const std::shared_ptr<IdValues> HapResource::GetIdValuesByName(const std::string name, const ResType resType)
64 {
65 return nullptr;
66 }
67
Update(std::shared_ptr<ResConfigImpl> & defaultConfig)68 RState HapResource::Update(std::shared_ptr<ResConfigImpl> &defaultConfig)
69 {
70 return SUCCESS;
71 }
72
GetLimitKeysValue()73 uint32_t HapResource::GetLimitKeysValue()
74 {
75 ReadLock lock(mutex_);
76 return limitKeyValue_;
77 }
78
BuildNameTypeIdMapping()79 std::unordered_map<std::string, std::unordered_map<ResType, uint32_t>> HapResource::BuildNameTypeIdMapping()
80 {
81 return std::unordered_map<std::string, std::unordered_map<ResType, uint32_t>>();
82 }
83 } // namespace Resource
84 } // namespace Global
85 } // namespace OHOS
86