• 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 #ifndef OHOS_DISTRIBUTED_DATA_RELATIONAL_STORE_FRAMEWORKS_NATIVE_ICU_MANAGER_H
16 #define OHOS_DISTRIBUTED_DATA_RELATIONAL_STORE_FRAMEWORKS_NATIVE_ICU_MANAGER_H
17 #include <functional>
18 #include <mutex>
19 #include <string>
20 struct sqlite3;
21 namespace OHOS {
22 namespace NativeRdb {
23 class RdbICUManager {
24 public:
25     static RdbICUManager &GetInstance();
26     int32_t ConfigLocale(sqlite3 *, const std::string &);
27 private:
28     RdbICUManager();
29     ~RdbICUManager();
30     int32_t CleanUp();
31     using ConfigICULocaleFunc = int32_t(*)(sqlite3 *, const std::string &);
32     using CleanUpFunc = int32_t(*)();
33     struct ICUAPIInfo {
34         ConfigICULocaleFunc configIcuLocaleFunc = nullptr;
35         CleanUpFunc cleanUpFunc = nullptr;
36     };
37     ICUAPIInfo GetApiInfo();
38     std::mutex mutex_;
39     void *handle_ = nullptr;
40     ICUAPIInfo apiInfo_;
41 };
42 
43 } // namespace NativeRdb
44 } // namespace OHOS
45 #endif //LDBPROJ_RDB_ICU_MANAGER_H
46