• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef GENERIC_VALUES_H
17 #define GENERIC_VALUES_H
18 
19 #include <map>
20 #include <string>
21 #include "variant_value.h"
22 #include <vector>
23 
24 namespace OHOS {
25 namespace Security::SecurityGuard {
26 class GenericValues final {
27 public:
28     GenericValues() = default;
29     virtual ~GenericValues() = default;
30 
31     void Put(const std::string &key, int32_t value);
32 
33     void Put(const std::string &key, int64_t value);
34 
35     void Put(const std::string &key, const std::string &value);
36 
37     void Put(const std::string &key, const VariantValue &value);
38 
39     std::vector<std::string> GetAllKeys() const;
40 
41     VariantValue Get(const std::string &key) const;
42 
43     int32_t GetInt(const std::string &key) const;
44 
45     int64_t GetInt64(const std::string &key) const;
46 
47     std::string GetString(const std::string &key) const;
48 
49     void Remove(const std::string &key);
50 private:
51     std::map<std::string, VariantValue> map_;
52 };
53 } // namespace Security::SecurityGuard
54 } // namespace OHOS
55 #endif // GENERIC_VALUES_H