• 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 UTD_CLIENT_H
17 #define UTD_CLIENT_H
18 
19 #include <string>
20 #include <vector>
21 #include <map>
22 #include "utd_common.h"
23 #include "preset_type_descriptors.h"
24 #include "type_descriptor.h"
25 #include "error_code.h"
26 
27 namespace OHOS {
28 namespace UDMF {
29 class TypeDescriptor;
30 class UtdClient {
31 public:
32     static UtdClient &GetInstance();
33     Status GetTypeDescriptor(const std::string &typeId, std::shared_ptr<TypeDescriptor> &descriptor);
34     Status GetUniformDataTypeByFilenameExtension(const std::string &fileExtension, std::string &typeId,
35                                                  std::string belongsTo = DEFAULT_TYPE_ID);
36     Status GetUniformDataTypeByMIMEType(const std::string &mimeType, std::string &typeId,
37                                         std::string belongsTo = DEFAULT_TYPE_ID);
38 
39 private:
40     UtdClient();
41     ~UtdClient();
42     UtdClient(const UtdClient &obj) = delete;
43     UtdClient &operator=(const UtdClient &obj) = delete;
44     void Init();
45     static constexpr const char* DEFAULT_TYPE_ID = "#default";
46     std::vector<TypeDescriptorCfg> descriptorCfgs_;
47 };
48 } // namespace UDMF
49 } // namespace OHOS
50 #endif // UTD_CLIENT_H