1 /* 2 * Copyright (c) 2023 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 "config_operator.h" 17 #include "security_guard_log.h" 18 #include "config_define.h" 19 20 namespace OHOS::Security::SecurityGuard { ConfigOperator(BaseConfig & config)21ConfigOperator::ConfigOperator(BaseConfig &config) 22 : config_(config) {}; 23 Init() const24bool ConfigOperator::Init() const 25 { 26 bool success = config_.Load(INIT_MODE); 27 if (!success) { 28 return false; 29 } 30 success = config_.Check(); 31 if (!success) { 32 return false; 33 } 34 return config_.Parse(); 35 } 36 Update() const37bool ConfigOperator::Update() const 38 { 39 bool success = config_.Load(UPDATE_MODE); 40 if (!success) { 41 return false; 42 } 43 success = config_.Check(); 44 if (!success) { 45 return false; 46 } 47 return config_.Update(); 48 } 49 } // OHOS::Security::SecurityGuard