UTIConverter.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import <UIKit/UIKit.h>
  22. #import <MobileCoreServices/MobileCoreServices.h>
  23. #define UTTYPE_IMAGE ((NSString *)kUTTypeImage)
  24. #define UTTYPE_GIF_IMAGE ((NSString *)kUTTypeGIF)
  25. #define UTTYPE_VIDEO ((NSString *)kUTTypeVideo)
  26. #define UTTYPE_MOVIE ((NSString *)kUTTypeMovie)
  27. #define UTTYPE_AUDIO ((NSString *)kUTTypeAudio)
  28. #define UTTYPE_PLAIN_TEXT ((NSString *)kUTTypePlainText)
  29. #define UTTYPE_URL ((NSString *)kUTTypeURL)
  30. #define UTTYPE_FILE_URL ((NSString *)kUTTypeFileURL)
  31. #define UTTYPE_VCARD ((NSString *)kUTTypeVCard)
  32. #define UTTYPE_ITEM ((NSString *)kUTTypeItem)
  33. #define UTTYPE_DATA ((NSString *)kUTTypeData)
  34. #define UTTYPE_CONTENT ((NSString *)kUTTypeContent)
  35. #define UTTYPE_ARCHIVE ((NSString *)kUTTypeArchive)
  36. #define UTTYPE_CONTACT ((NSString *)kUTTypeContact)
  37. #define UTTYPE_MESSAGE ((NSString *)kUTTypeMessage)
  38. @interface UTIConverter : NSObject
  39. + (NSString *)mimeTypeFromUTI:(NSString *)uti;
  40. + (NSString *)utiFromMimeType:(NSString *)mimeType;
  41. + (NSString *)utiForFileURL:(NSURL *)url;
  42. + (NSString *)preferedFileExtensionForMimeType:(NSString *)mimeType;
  43. + (BOOL)isImageMimeType:(NSString *)mimeType;
  44. + (BOOL)isRenderingImageMimeType:(NSString *)mimeType;
  45. + (BOOL)isPNGImageMimeType:(NSString *)mimeType;
  46. + (BOOL)isGifMimeType:(NSString *)mimeType;
  47. + (BOOL)isAudioMimeType:(NSString *)mimeType;
  48. + (BOOL)isRenderingAudioMimeType:(NSString *)mimeType;
  49. + (BOOL)isVideoMimeType:(NSString *)mimeType;
  50. + (BOOL)isMovieMimeType:(NSString *)mimeType;
  51. + (BOOL)isRenderingVideoMimeType:(NSString *)mimeType;
  52. + (BOOL)isPDFMimeType:(NSString *)mimeType;
  53. + (BOOL)isContactMimeType:(NSString *)mimeType;
  54. + (BOOL)isCalendarMimeType:(NSString *)mimeType;
  55. + (BOOL)isArchiveMimeType:(NSString *)mimeType;
  56. + (BOOL)isPublicContentMimeType:(NSString *)mimeType;
  57. + (BOOL)isPublicCompositeContentMimeType:(NSString *)mimeType;
  58. + (BOOL)isWordMimeType:(NSString *)mimeType;
  59. + (BOOL)isPowerpointMimeType:(NSString *)mimeType;
  60. + (BOOL)isExcelMimeType:(NSString *)mimeType;
  61. + (BOOL)isTextMimeType:(NSString *)mimeType;
  62. + (BOOL)isPassMimeType:(NSString *)mimeType;
  63. + (BOOL)type:(NSString *)type conformsTo:(NSString *)referenceType;
  64. + (BOOL)conformsToMovieType:(NSString *)mimeType;
  65. + (BOOL)conformsToImageType:(NSString *)mimeType;
  66. + (UIImage *)getDefaultThumbnailForMimeType:(NSString *)mimeType;
  67. + (NSString *)localizedDescriptionForMimeType:(NSString *)mimeType;
  68. @end