1 /*
2 * Copyright (c) 2021 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 #include "parameter_ex.h"
16 #include <cstdint>
17
18 #include <parameters.h>
19
20 namespace OHOS {
21 namespace HiviewDFX {
22 namespace Parameter {
GetString(const std::string & key,const std::string & defaultValue)23 std::string GetString(const std::string& key, const std::string& defaultValue)
24 {
25 return OHOS::system::GetParameter(key, defaultValue);
26 }
27
GetInteger(const std::string & key,const int64_t defaultValue)28 int64_t GetInteger(const std::string& key, const int64_t defaultValue)
29 {
30 return OHOS::system::GetIntParameter(key, defaultValue);
31 }
32
GetUnsignedInteger(const std::string & key,const uint64_t defaultValue)33 uint64_t GetUnsignedInteger(const std::string& key, const uint64_t defaultValue)
34 {
35 return OHOS::system::GetUintParameter(key, defaultValue);
36 }
37
GetBoolean(const std::string & key,const bool defaultValue)38 bool GetBoolean(const std::string& key, const bool defaultValue)
39 {
40 return OHOS::system::GetBoolParameter(key, defaultValue);
41 }
42
SetProperty(const std::string & key,const std::string & defaultValue)43 bool SetProperty(const std::string& key, const std::string& defaultValue)
44 {
45 return OHOS::system::SetParameter(key, defaultValue);
46 }
47 } // namespace Parameter
48 } // namespace HiviewDFX
49 } // namespace OHOS
50