• 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 UDMF_CUSTOM_UTD_STORE_H
17 #define UDMF_CUSTOM_UTD_STORE_H
18 #include <string>
19 #include <vector>
20 #include <set>
21 #include <map>
22 #include <cstdint>
23 #include "visibility.h"
24 #include "utd_common.h"
25 #include "custom_utd_json_parser.h"
26 namespace OHOS {
27 namespace UDMF {
28 class CustomUtdStore {
29 public:
30     static CustomUtdStore &GetInstance();
31     std::vector<TypeDescriptorCfg> GetTypeCfgs(const std::string &cfgFilePath);
32     int32_t SaveTypeCfgs(const std::vector<TypeDescriptorCfg> &customUtdTypes, const std::string &cfgFilePath);
33 
34 private:
35     CustomUtdStore();
36     ~CustomUtdStore();
37     int32_t SavaCfgFile(const std::string &jsonData, const std::string &cfgFilePath);
38     bool CreateDirectory(const std::string &path) const;
39 
40     CustomUtdJsonParser utdJsonParser_;
41 };
42 } // namespace UDMF
43 } // namespace OHOS
44 #endif // UDMF_CUSTOM_UTD_STORE_H