• 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 #ifndef ACCESS_TOKEN_DB_LOADER_H
17 #define ACCESS_TOKEN_DB_LOADER_H
18 
19 #include "atm_data_type.h"
20 #include "generic_values.h"
21 
22 namespace OHOS {
23 namespace Security {
24 namespace AccessToken {
25 class AccessTokenDbLoaderInterface {
26 public:
AccessTokenDbLoaderInterface()27     AccessTokenDbLoaderInterface() {}
~AccessTokenDbLoaderInterface()28     virtual ~AccessTokenDbLoaderInterface() {}
29 
30     virtual void InitRdbHelper() = 0;
31     virtual int32_t Modify(const AtmDataType type, const GenericValues& modifyValue,
32         const GenericValues& conditionValue) = 0;
33     virtual int32_t Find(AtmDataType type, const GenericValues& conditionValue,
34         std::vector<GenericValues>& results) = 0;
35     virtual int32_t DeleteAndInsertValues(const std::vector<DelInfo>& delInfoVec,
36         const std::vector<AddInfo>& addInfoVec) = 0;
37     virtual bool DestroyRdbHelper() = 0;
38 };
39 
40 class AccessTokenDbLoader final: public AccessTokenDbLoaderInterface {
41 public:
42     AccessTokenDbLoader();
43     virtual ~AccessTokenDbLoader();
44 
45     void InitRdbHelper() override;
46     int32_t Modify(const AtmDataType type, const GenericValues& modifyValue,
47         const GenericValues& conditionValue) override;
48     int32_t Find(AtmDataType type, const GenericValues& conditionValue,
49         std::vector<GenericValues>& results) override;
50     int32_t DeleteAndInsertValues(const std::vector<DelInfo>& delInfoVec,
51         const std::vector<AddInfo>& addInfoVec) override;
52     bool DestroyRdbHelper() override;
53 };
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58     void* Create();
59     void Destroy(void* loaderPtr);
60 #ifdef __cplusplus
61 }
62 #endif
63 } // namespace AccessToken
64 } // namespace Security
65 } // namespace OHOS
66 #endif // ACCESS_TOKEN_DB_LOADER_H
67