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_TYPE_DESCRIPTOR_H 17 #define UDMF_TYPE_DESCRIPTOR_H 18 19 #include <string> 20 #include <set> 21 #include <vector> 22 #include <map> 23 #include "error_code.h" 24 #include "utd_common.h" 25 #include "visibility.h" 26 namespace OHOS { 27 namespace UDMF { 28 class API_EXPORT TypeDescriptor { 29 public: 30 TypeDescriptor(const std::string &typeId, const std::vector<std::string> &belongingToTypes, 31 const std::vector<std::string> &filenameExtensions, const std::vector<std::string> &mimeTypes, 32 const std::string &description, const std::string &referenceURL, const std::string &iconFile); 33 TypeDescriptor(const TypeDescriptorCfg& typeDescriptorCfg); 34 ~TypeDescriptor(); 35 Status BelongsTo(const std::string &typeId, bool &checkResult); 36 Status IsLowerLevelType(const std::string &typeId, bool &checkResult); 37 Status IsHigherLevelType(const std::string &typeId, bool &checkResult); 38 39 bool Equals(std::shared_ptr<TypeDescriptor> descriptor); 40 const std::string& GetTypeId() const; 41 std::vector<std::string> GetBelongingToTypes(); 42 std::string GetIconFile(); 43 std::string GetDescription(); 44 std::string GetReferenceURL(); 45 std::vector<std::string> GetFilenameExtensions(); 46 std::vector<std::string> GetMimeTypes(); 47 48 private: 49 bool CmpFlexibleTypeLevel(const std::string higherLevelTypeId, bool isFlexibleType); 50 51 std::string typeId_; 52 std::vector<std::string> belongingToTypes_; 53 std::vector<std::string> filenameExtensions_; 54 std::vector<std::string> mimeTypes_; 55 std::string description_; 56 std::string referenceURL_; 57 std::string iconFile_; 58 bool isFlexibleType_ = false; 59 }; 60 } // namespace UDMF 61 } // namespace OHOS 62 #endif // UDMF_TYPE_DESCRIPTOR_H 63