OpenShot Audio Library | OpenShotAudio: juce_common_MimeTypes.cpp Source File

OpenShot Audio Library | OpenShotAudio 1.0.0

Loading...
Searching...
No Matches
juce_common_MimeTypes.cpp
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29namespace
30{
31
32struct Entry
33{
34 const char* fileExtension;
35 const char* mimeType;
36};
37
38class Table
39{
40public:
41 void addEntry (const Entry& entry)
42 {
43 typeForExtension.emplace (entry.fileExtension, entry.mimeType);
44 extensionForType.emplace (entry.mimeType, entry.fileExtension);
45 }
46
47 StringArray getTypesForExtension (const String& extension) const
48 {
49 return getValuesForKey (typeForExtension, extension);
50 }
51
52 StringArray getExtensionsForType (const String& type) const
53 {
54 return getValuesForKey (extensionForType, type);
55 }
56
57 static Table& get()
58 {
59 static Table table;
60 return table;
61 }
62
63private:
64 Table() = default;
65
66 static StringArray getValuesForKey (const std::multimap<String, String>& map, const String& key)
67 {
68 const auto [begin, end] = map.equal_range (key);
69
70 StringArray result;
71 std::for_each (begin, end, [&] (const auto& pair) { result.add (pair.second); });
72
73 return result;
74 }
75
76 static inline constexpr Entry initialEntries[]
77 {
78 { "3dm", "x-world/x-3dmf" },
79 { "3dmf", "x-world/x-3dmf" },
80 { "a", "application/octet-stream" },
81 { "aab", "application/x-authorware-bin" },
82 { "aam", "application/x-authorware-map" },
83 { "aas", "application/x-authorware-seg" },
84 { "abc", "text/vnd.abc" },
85 { "acgi", "text/html" },
86 { "afl", "video/animaflex" },
87 { "ai", "application/postscript" },
88 { "aif", "audio/aiff" },
89 { "aif", "audio/x-aiff" },
90 { "aifc", "audio/aiff" },
91 { "aifc", "audio/x-aiff" },
92 { "aiff", "audio/aiff" },
93 { "aiff", "audio/x-aiff" },
94 { "aim", "application/x-aim" },
95 { "aip", "text/x-audiosoft-intra" },
96 { "ani", "application/x-navi-animation" },
97 { "aos", "application/x-nokia-9000-communicator-add-on-software" },
98 { "aps", "application/mime" },
99 { "arc", "application/octet-stream" },
100 { "arj", "application/arj" },
101 { "arj", "application/octet-stream" },
102 { "art", "image/x-jg" },
103 { "asf", "video/x-ms-asf" },
104 { "asm", "text/x-asm" },
105 { "asp", "text/asp" },
106 { "asx", "application/x-mplayer2" },
107 { "asx", "video/x-ms-asf" },
108 { "asx", "video/x-ms-asf-plugin" },
109 { "au", "audio/basic" },
110 { "au", "audio/x-au" },
111 { "avi", "application/x-troff-msvideo" },
112 { "avi", "video/avi" },
113 { "avi", "video/msvideo" },
114 { "avi", "video/x-msvideo" },
115 { "avs", "video/avs-video" },
116 { "bcpio", "application/x-bcpio" },
117 { "bin", "application/mac-binary" },
118 { "bin", "application/macbinary" },
119 { "bin", "application/octet-stream" },
120 { "bin", "application/x-binary" },
121 { "bin", "application/x-macbinary" },
122 { "bm", "image/bmp" },
123 { "bmp", "image/bmp" },
124 { "bmp", "image/x-windows-bmp" },
125 { "boo", "application/book" },
126 { "book", "application/book" },
127 { "boz", "application/x-bzip2" },
128 { "bsh", "application/x-bsh" },
129 { "bz", "application/x-bzip" },
130 { "bz2", "application/x-bzip2" },
131 { "c", "text/plain" },
132 { "c", "text/x-c" },
133 { "c++", "text/plain" },
134 { "cat", "application/vnd.ms-pki.seccat" },
135 { "cc", "text/plain" },
136 { "cc", "text/x-c" },
137 { "ccad", "application/clariscad" },
138 { "cco", "application/x-cocoa" },
139 { "cdf", "application/cdf" },
140 { "cdf", "application/x-cdf" },
141 { "cdf", "application/x-netcdf" },
142 { "cer", "application/pkix-cert" },
143 { "cer", "application/x-x509-ca-cert" },
144 { "cha", "application/x-chat" },
145 { "chat", "application/x-chat" },
146 { "class", "application/java" },
147 { "class", "application/java-byte-code" },
148 { "class", "application/x-java-class" },
149 { "com", "application/octet-stream" },
150 { "com", "text/plain" },
151 { "conf", "text/plain" },
152 { "cpio", "application/x-cpio" },
153 { "cpp", "text/x-c" },
154 { "cpt", "application/mac-compactpro" },
155 { "cpt", "application/x-compactpro" },
156 { "cpt", "application/x-cpt" },
157 { "crl", "application/pkcs-crl" },
158 { "crl", "application/pkix-crl" },
159 { "crt", "application/pkix-cert" },
160 { "crt", "application/x-x509-ca-cert" },
161 { "crt", "application/x-x509-user-cert" },
162 { "csh", "application/x-csh" },
163 { "csh", "text/x-script.csh" },
164 { "css", "application/x-pointplus" },
165 { "css", "text/css" },
166 { "cxx", "text/plain" },
167 { "dcr", "application/x-director" },
168 { "deepv", "application/x-deepv" },
169 { "def", "text/plain" },
170 { "der", "application/x-x509-ca-cert" },
171 { "dif", "video/x-dv" },
172 { "dir", "application/x-director" },
173 { "dl", "video/dl" },
174 { "dl", "video/x-dl" },
175 { "doc", "application/msword" },
176 { "dot", "application/msword" },
177 { "dp", "application/commonground" },
178 { "drw", "application/drafting" },
179 { "dump", "application/octet-stream" },
180 { "dv", "video/x-dv" },
181 { "dvi", "application/x-dvi" },
182 { "dwf", "drawing/x-dwf" },
183 { "dwf", "model/vnd.dwf" },
184 { "dwg", "application/acad" },
185 { "dwg", "image/vnd.dwg" },
186 { "dwg", "image/x-dwg" },
187 { "dxf", "application/dxf" },
188 { "dxf", "image/vnd.dwg" },
189 { "dxf", "image/x-dwg" },
190 { "dxr", "application/x-director" },
191 { "el", "text/x-script.elisp" },
192 { "elc", "application/x-bytecode.elisp" },
193 { "elc", "application/x-elc" },
194 { "env", "application/x-envoy" },
195 { "eps", "application/postscript" },
196 { "es", "application/x-esrehber" },
197 { "etx", "text/x-setext" },
198 { "evy", "application/envoy" },
199 { "evy", "application/x-envoy" },
200 { "exe", "application/octet-stream" },
201 { "f", "text/plain" },
202 { "f", "text/x-fortran" },
203 { "f77", "text/x-fortran" },
204 { "f90", "text/plain" },
205 { "f90", "text/x-fortran" },
206 { "fdf", "application/vnd.fdf" },
207 { "fif", "application/fractals" },
208 { "fif", "image/fif" },
209 { "flac", "audio/flac" },
210 { "fli", "video/fli" },
211 { "fli", "video/x-fli" },
212 { "flo", "image/florian" },
213 { "flx", "text/vnd.fmi.flexstor" },
214 { "fmf", "video/x-atomic3d-feature" },
215 { "for", "text/plain" },
216 { "for", "text/x-fortran" },
217 { "fpx", "image/vnd.fpx" },
218 { "fpx", "image/vnd.net-fpx" },
219 { "frl", "application/freeloader" },
220 { "funk", "audio/make" },
221 { "g", "text/plain" },
222 { "g3", "image/g3fax" },
223 { "gif", "image/gif" },
224 { "gl", "video/gl" },
225 { "gl", "video/x-gl" },
226 { "gsd", "audio/x-gsm" },
227 { "gsm", "audio/x-gsm" },
228 { "gsp", "application/x-gsp" },
229 { "gss", "application/x-gss" },
230 { "gtar", "application/x-gtar" },
231 { "gz", "application/x-compressed" },
232 { "gz", "application/x-gzip" },
233 { "gzip", "application/x-gzip" },
234 { "gzip", "multipart/x-gzip" },
235 { "h", "text/plain" },
236 { "h", "text/x-h" },
237 { "hdf", "application/x-hdf" },
238 { "help", "application/x-helpfile" },
239 { "hgl", "application/vnd.hp-hpgl" },
240 { "hh", "text/plain" },
241 { "hh", "text/x-h" },
242 { "hlb", "text/x-script" },
243 { "hlp", "application/hlp" },
244 { "hlp", "application/x-helpfile" },
245 { "hlp", "application/x-winhelp" },
246 { "hpg", "application/vnd.hp-hpgl" },
247 { "hpgl", "application/vnd.hp-hpgl" },
248 { "hqx", "application/binhex" },
249 { "hqx", "application/binhex4" },
250 { "hqx", "application/mac-binhex" },
251 { "hqx", "application/mac-binhex40" },
252 { "hqx", "application/x-binhex40" },
253 { "hqx", "application/x-mac-binhex40" },
254 { "hta", "application/hta" },
255 { "htc", "text/x-component" },
256 { "htm", "text/html" },
257 { "html", "text/html" },
258 { "htmls", "text/html" },
259 { "htt", "text/webviewhtml" },
260 { "htx", "text/html" },
261 { "ice", "x-conference/x-cooltalk" },
262 { "ico", "image/x-icon" },
263 { "idc", "text/plain" },
264 { "ief", "image/ief" },
265 { "iefs", "image/ief" },
266 { "iges", "application/iges" },
267 { "iges", "model/iges" },
268 { "igs", "application/iges" },
269 { "igs", "model/iges" },
270 { "ima", "application/x-ima" },
271 { "imap", "application/x-httpd-imap" },
272 { "inf", "application/inf" },
273 { "ins", "application/x-internett-signup" },
274 { "ip", "application/x-ip2" },
275 { "isu", "video/x-isvideo" },
276 { "it", "audio/it" },
277 { "iv", "application/x-inventor" },
278 { "ivr", "i-world/i-vrml" },
279 { "ivy", "application/x-livescreen" },
280 { "jam", "audio/x-jam" },
281 { "jav", "text/plain" },
282 { "jav", "text/x-java-source" },
283 { "java", "text/plain" },
284 { "java", "text/x-java-source" },
285 { "jcm", "application/x-java-commerce" },
286 { "jfif", "image/jpeg" },
287 { "jfif", "image/pjpeg" },
288 { "jpe", "image/jpeg" },
289 { "jpe", "image/pjpeg" },
290 { "jpeg", "image/jpeg" },
291 { "jpeg", "image/pjpeg" },
292 { "jpg", "image/jpeg" },
293 { "jpg", "image/pjpeg" },
294 { "jps", "image/x-jps" },
295 { "js", "application/x-javascript" },
296 { "json", "application/json" },
297 { "jut", "image/jutvision" },
298 { "kar", "audio/midi" },
299 { "kar", "music/x-karaoke" },
300 { "ksh", "application/x-ksh" },
301 { "ksh", "text/x-script.ksh" },
302 { "la", "audio/nspaudio" },
303 { "la", "audio/x-nspaudio" },
304 { "lam", "audio/x-liveaudio" },
305 { "latex", "application/x-latex" },
306 { "lha", "application/lha" },
307 { "lha", "application/octet-stream" },
308 { "lha", "application/x-lha" },
309 { "lhx", "application/octet-stream" },
310 { "list", "text/plain" },
311 { "lma", "audio/nspaudio" },
312 { "lma", "audio/x-nspaudio" },
313 { "log", "text/plain" },
314 { "lsp", "application/x-lisp" },
315 { "lsp", "text/x-script.lisp" },
316 { "lst", "text/plain" },
317 { "lsx", "text/x-la-asf" },
318 { "ltx", "application/x-latex" },
319 { "lzh", "application/octet-stream" },
320 { "lzh", "application/x-lzh" },
321 { "lzx", "application/lzx" },
322 { "lzx", "application/octet-stream" },
323 { "lzx", "application/x-lzx" },
324 { "m", "text/plain" },
325 { "m", "text/x-m" },
326 { "m1v", "video/mpeg" },
327 { "m2a", "audio/mpeg" },
328 { "m2v", "video/mpeg" },
329 { "m3u", "audio/x-mpequrl" },
330 { "man", "application/x-troff-man" },
331 { "map", "application/x-navimap" },
332 { "mar", "text/plain" },
333 { "mbd", "application/mbedlet" },
334 { "mc$", "application/x-magic-cap-package-1.0" },
335 { "mcd", "application/mcad" },
336 { "mcd", "application/x-mathcad" },
337 { "mcf", "image/vasa" },
338 { "mcf", "text/mcf" },
339 { "mcp", "application/netmc" },
340 { "me", "application/x-troff-me" },
341 { "mht", "message/rfc822" },
342 { "mhtml", "message/rfc822" },
343 { "mid", "application/x-midi" },
344 { "mid", "audio/midi" },
345 { "mid", "audio/x-mid" },
346 { "mid", "audio/x-midi" },
347 { "mid", "music/crescendo" },
348 { "mid", "x-music/x-midi" },
349 { "midi", "application/x-midi" },
350 { "midi", "audio/midi" },
351 { "midi", "audio/x-mid" },
352 { "midi", "audio/x-midi" },
353 { "midi", "music/crescendo" },
354 { "midi", "x-music/x-midi" },
355 { "mif", "application/x-frame" },
356 { "mif", "application/x-mif" },
357 { "mime", "message/rfc822" },
358 { "mime", "www/mime" },
359 { "mjf", "audio/x-vnd.audioexplosion.mjuicemediafile" },
360 { "mjpg", "video/x-motion-jpeg" },
361 { "mm", "application/base64" },
362 { "mm", "application/x-meme" },
363 { "mme", "application/base64" },
364 { "mod", "audio/mod" },
365 { "mod", "audio/x-mod" },
366 { "moov", "video/quicktime" },
367 { "mov", "video/quicktime" },
368 { "movie", "video/x-sgi-movie" },
369 { "mp2", "audio/mpeg" },
370 { "mp2", "audio/x-mpeg" },
371 { "mp2", "video/mpeg" },
372 { "mp2", "video/x-mpeg" },
373 { "mp2", "video/x-mpeq2a" },
374 { "mp3", "audio/mpeg" },
375 { "mp3", "audio/mpeg3" },
376 { "mp3", "audio/x-mpeg-3" },
377 { "mp3", "video/mpeg" },
378 { "mp3", "video/x-mpeg" },
379 { "mpa", "audio/mpeg" },
380 { "mpa", "video/mpeg" },
381 { "mpc", "application/x-project" },
382 { "mpe", "video/mpeg" },
383 { "mpeg", "video/mpeg" },
384 { "mpg", "audio/mpeg" },
385 { "mpg", "video/mpeg" },
386 { "mpga", "audio/mpeg" },
387 { "mpp", "application/vnd.ms-project" },
388 { "mpt", "application/x-project" },
389 { "mpv", "application/x-project" },
390 { "mpx", "application/x-project" },
391 { "mrc", "application/marc" },
392 { "ms", "application/x-troff-ms" },
393 { "mv", "video/x-sgi-movie" },
394 { "my", "audio/make" },
395 { "mzz", "application/x-vnd.audioexplosion.mzz" },
396 { "nap", "image/naplps" },
397 { "naplps", "image/naplps" },
398 { "nc", "application/x-netcdf" },
399 { "ncm", "application/vnd.nokia.configuration-message" },
400 { "nif", "image/x-niff" },
401 { "niff", "image/x-niff" },
402 { "nix", "application/x-mix-transfer" },
403 { "nsc", "application/x-conference" },
404 { "nvd", "application/x-navidoc" },
405 { "o", "application/octet-stream" },
406 { "oda", "application/oda" },
407 { "omc", "application/x-omc" },
408 { "omcd", "application/x-omcdatamaker" },
409 { "omcr", "application/x-omcregerator" },
410 { "p", "text/x-pascal" },
411 { "p10", "application/pkcs10" },
412 { "p10", "application/x-pkcs10" },
413 { "p12", "application/pkcs-12" },
414 { "p12", "application/x-pkcs12" },
415 { "p7a", "application/x-pkcs7-signature" },
416 { "p7c", "application/pkcs7-mime" },
417 { "p7c", "application/x-pkcs7-mime" },
418 { "p7m", "application/pkcs7-mime" },
419 { "p7m", "application/x-pkcs7-mime" },
420 { "p7r", "application/x-pkcs7-certreqresp" },
421 { "p7s", "application/pkcs7-signature" },
422 { "part", "application/pro_eng" },
423 { "pas", "text/pascal" },
424 { "pbm", "image/x-portable-bitmap" },
425 { "pcl", "application/vnd.hp-pcl" },
426 { "pcl", "application/x-pcl" },
427 { "pct", "image/x-pict" },
428 { "pcx", "image/x-pcx" },
429 { "pdb", "chemical/x-pdb" },
430 { "pdf", "application/pdf" },
431 { "pfunk", "audio/make" },
432 { "pfunk", "audio/make.my.funk" },
433 { "pgm", "image/x-portable-graymap" },
434 { "pgm", "image/x-portable-greymap" },
435 { "pic", "image/pict" },
436 { "pict", "image/pict" },
437 { "pkg", "application/x-newton-compatible-pkg" },
438 { "pko", "application/vnd.ms-pki.pko" },
439 { "pl", "text/plain" },
440 { "pl", "text/x-script.perl" },
441 { "plx", "application/x-pixclscript" },
442 { "pm", "image/x-xpixmap" },
443 { "pm", "text/x-script.perl-module" },
444 { "pm4", "application/x-pagemaker" },
445 { "pm5", "application/x-pagemaker" },
446 { "png", "image/png" },
447 { "pnm", "application/x-portable-anymap" },
448 { "pnm", "image/x-portable-anymap" },
449 { "pot", "application/mspowerpoint" },
450 { "pot", "application/vnd.ms-powerpoint" },
451 { "pov", "model/x-pov" },
452 { "ppa", "application/vnd.ms-powerpoint" },
453 { "ppm", "image/x-portable-pixmap" },
454 { "pps", "application/mspowerpoint" },
455 { "pps", "application/vnd.ms-powerpoint" },
456 { "ppt", "application/mspowerpoint" },
457 { "ppt", "application/powerpoint" },
458 { "ppt", "application/vnd.ms-powerpoint" },
459 { "ppt", "application/x-mspowerpoint" },
460 { "ppz", "application/mspowerpoint" },
461 { "pre", "application/x-freelance" },
462 { "prt", "application/pro_eng" },
463 { "ps", "application/postscript" },
464 { "psd", "application/octet-stream" },
465 { "pvu", "paleovu/x-pv" },
466 { "pwz", "application/vnd.ms-powerpoint" },
467 { "py", "text/x-script.python" },
468 { "pyc", "application/x-bytecode.python" },
469 { "qcp", "audio/vnd.qcelp" },
470 { "qd3", "x-world/x-3dmf" },
471 { "qd3d", "x-world/x-3dmf" },
472 { "qif", "image/x-quicktime" },
473 { "qt", "video/quicktime" },
474 { "qtc", "video/x-qtc" },
475 { "qti", "image/x-quicktime" },
476 { "qtif", "image/x-quicktime" },
477 { "ra", "audio/x-pn-realaudio" },
478 { "ra", "audio/x-pn-realaudio-plugin" },
479 { "ra", "audio/x-realaudio" },
480 { "ram", "audio/x-pn-realaudio" },
481 { "ras", "application/x-cmu-raster" },
482 { "ras", "image/cmu-raster" },
483 { "ras", "image/x-cmu-raster" },
484 { "rast", "image/cmu-raster" },
485 { "rexx", "text/x-script.rexx" },
486 { "rf", "image/vnd.rn-realflash" },
487 { "rgb", "image/x-rgb" },
488 { "rm", "application/vnd.rn-realmedia" },
489 { "rm", "audio/x-pn-realaudio" },
490 { "rmi", "audio/mid" },
491 { "rmm", "audio/x-pn-realaudio" },
492 { "rmp", "audio/x-pn-realaudio" },
493 { "rmp", "audio/x-pn-realaudio-plugin" },
494 { "rng", "application/ringing-tones" },
495 { "rng", "application/vnd.nokia.ringing-tone" },
496 { "rnx", "application/vnd.rn-realplayer" },
497 { "roff", "application/x-troff" },
498 { "rp", "image/vnd.rn-realpix" },
499 { "rpm", "audio/x-pn-realaudio-plugin" },
500 { "rt", "text/richtext" },
501 { "rt", "text/vnd.rn-realtext" },
502 { "rtf", "application/rtf" },
503 { "rtf", "application/x-rtf" },
504 { "rtf", "text/richtext" },
505 { "rtx", "application/rtf" },
506 { "rtx", "text/richtext" },
507 { "rv", "video/vnd.rn-realvideo" },
508 { "s", "text/x-asm" },
509 { "s3m", "audio/s3m" },
510 { "saveme", "application/octet-stream" },
511 { "sbk", "application/x-tbook" },
512 { "scm", "application/x-lotusscreencam" },
513 { "scm", "text/x-script.guile" },
514 { "scm", "text/x-script.scheme" },
515 { "scm", "video/x-scm" },
516 { "sdml", "text/plain" },
517 { "sdp", "application/sdp" },
518 { "sdp", "application/x-sdp" },
519 { "sdr", "application/sounder" },
520 { "sea", "application/sea" },
521 { "sea", "application/x-sea" },
522 { "set", "application/set" },
523 { "sgm", "text/sgml" },
524 { "sgm", "text/x-sgml" },
525 { "sgml", "text/sgml" },
526 { "sgml", "text/x-sgml" },
527 { "sh", "application/x-bsh" },
528 { "sh", "application/x-sh" },
529 { "sh", "application/x-shar" },
530 { "sh", "text/x-script.sh" },
531 { "shar", "application/x-bsh" },
532 { "shar", "application/x-shar" },
533 { "shtml", "text/html" },
534 { "shtml", "text/x-server-parsed-html" },
535 { "sid", "audio/x-psid" },
536 { "sit", "application/x-sit" },
537 { "sit", "application/x-stuffit" },
538 { "skd", "application/x-koan" },
539 { "skm", "application/x-koan" },
540 { "skp", "application/x-koan" },
541 { "skt", "application/x-koan" },
542 { "sl", "application/x-seelogo" },
543 { "smi", "application/smil" },
544 { "smil", "application/smil" },
545 { "snd", "audio/basic" },
546 { "snd", "audio/x-adpcm" },
547 { "sol", "application/solids" },
548 { "spc", "application/x-pkcs7-certificates" },
549 { "spc", "text/x-speech" },
550 { "spl", "application/futuresplash" },
551 { "spr", "application/x-sprite" },
552 { "sprite", "application/x-sprite" },
553 { "src", "application/x-wais-source" },
554 { "ssi", "text/x-server-parsed-html" },
555 { "ssm", "application/streamingmedia" },
556 { "sst", "application/vnd.ms-pki.certstore" },
557 { "step", "application/step" },
558 { "stl", "application/sla" },
559 { "stl", "application/vnd.ms-pki.stl" },
560 { "stl", "application/x-navistyle" },
561 { "stp", "application/step" },
562 { "sv4cpio,", "application/x-sv4cpio" },
563 { "sv4crc", "application/x-sv4crc" },
564 { "svf", "image/vnd.dwg" },
565 { "svf", "image/x-dwg" },
566 { "svr", "application/x-world" },
567 { "svr", "x-world/x-svr" },
568 { "swf", "application/x-shockwave-flash" },
569 { "t", "application/x-troff" },
570 { "talk", "text/x-speech" },
571 { "tar", "application/x-tar" },
572 { "tbk", "application/toolbook" },
573 { "tbk", "application/x-tbook" },
574 { "tcl", "application/x-tcl" },
575 { "tcl", "text/x-script.tcl" },
576 { "tcsh", "text/x-script.tcsh" },
577 { "tex", "application/x-tex" },
578 { "texi", "application/x-texinfo" },
579 { "texinfo,", "application/x-texinfo" },
580 { "text", "application/plain" },
581 { "text", "text/plain" },
582 { "tgz", "application/gnutar" },
583 { "tgz", "application/x-compressed" },
584 { "tif", "image/tiff" },
585 { "tif", "image/x-tiff" },
586 { "tiff", "image/tiff" },
587 { "tiff", "image/x-tiff" },
588 { "tr", "application/x-troff" },
589 { "tsi", "audio/tsp-audio" },
590 { "tsp", "application/dsptype" },
591 { "tsp", "audio/tsplayer" },
592 { "tsv", "text/tab-separated-values" },
593 { "turbot", "image/florian" },
594 { "txt", "text/plain" },
595 { "uil", "text/x-uil" },
596 { "uni", "text/uri-list" },
597 { "unis", "text/uri-list" },
598 { "unv", "application/i-deas" },
599 { "uri", "text/uri-list" },
600 { "uris", "text/uri-list" },
601 { "ustar", "application/x-ustar" },
602 { "ustar", "multipart/x-ustar" },
603 { "uu", "application/octet-stream" },
604 { "uu", "text/x-uuencode" },
605 { "uue", "text/x-uuencode" },
606 { "vcd", "application/x-cdlink" },
607 { "vcs", "text/x-vcalendar" },
608 { "vda", "application/vda" },
609 { "vdo", "video/vdo" },
610 { "vew", "application/groupwise" },
611 { "viv", "video/vivo" },
612 { "viv", "video/vnd.vivo" },
613 { "vivo", "video/vivo" },
614 { "vivo", "video/vnd.vivo" },
615 { "vmd", "application/vocaltec-media-desc" },
616 { "vmf", "application/vocaltec-media-file" },
617 { "voc", "audio/voc" },
618 { "voc", "audio/x-voc" },
619 { "vos", "video/vosaic" },
620 { "vox", "audio/voxware" },
621 { "vqe", "audio/x-twinvq-plugin" },
622 { "vqf", "audio/x-twinvq" },
623 { "vql", "audio/x-twinvq-plugin" },
624 { "vrml", "application/x-vrml" },
625 { "vrml", "model/vrml" },
626 { "vrml", "x-world/x-vrml" },
627 { "vrt", "x-world/x-vrt" },
628 { "vsd", "application/x-visio" },
629 { "vst", "application/x-visio" },
630 { "vsw", "application/x-visio" },
631 { "w60", "application/wordperfect6.0" },
632 { "w61", "application/wordperfect6.1" },
633 { "w6w", "application/msword" },
634 { "wav", "audio/wav" },
635 { "wav", "audio/x-wav" },
636 { "wb1", "application/x-qpro" },
637 { "wbmp", "image/vnd.wap.wbmp" },
638 { "web", "application/vnd.xara" },
639 { "wiz", "application/msword" },
640 { "wk1", "application/x-123" },
641 { "wmf", "windows/metafile" },
642 { "wml", "text/vnd.wap.wml" },
643 { "wmlc", "application/vnd.wap.wmlc" },
644 { "wmls", "text/vnd.wap.wmlscript" },
645 { "wmlsc", "application/vnd.wap.wmlscriptc" },
646 { "word", "application/msword" },
647 { "wp", "application/wordperfect" },
648 { "wp5", "application/wordperfect" },
649 { "wp5", "application/wordperfect6.0" },
650 { "wp6", "application/wordperfect" },
651 { "wpd", "application/wordperfect" },
652 { "wpd", "application/x-wpwin" },
653 { "wq1", "application/x-lotus" },
654 { "wri", "application/mswrite" },
655 { "wri", "application/x-wri" },
656 { "wrl", "application/x-world" },
657 { "wrl", "model/vrml" },
658 { "wrl", "x-world/x-vrml" },
659 { "wrz", "model/vrml" },
660 { "wrz", "x-world/x-vrml" },
661 { "wsc", "text/scriplet" },
662 { "wsrc", "application/x-wais-source" },
663 { "wtk", "application/x-wintalk" },
664 { "xbm", "image/x-xbitmap" },
665 { "xbm", "image/x-xbm" },
666 { "xbm", "image/xbm" },
667 { "xdr", "video/x-amt-demorun" },
668 { "xgz", "xgl/drawing" },
669 { "xif", "image/vnd.xiff" },
670 { "xl", "application/excel" },
671 { "xla", "application/excel" },
672 { "xla", "application/x-excel" },
673 { "xla", "application/x-msexcel" },
674 { "xlb", "application/excel" },
675 { "xlb", "application/vnd.ms-excel" },
676 { "xlb", "application/x-excel" },
677 { "xlc", "application/excel" },
678 { "xlc", "application/vnd.ms-excel" },
679 { "xlc", "application/x-excel" },
680 { "xld", "application/excel" },
681 { "xld", "application/x-excel" },
682 { "xlk", "application/excel" },
683 { "xlk", "application/x-excel" },
684 { "xll", "application/excel" },
685 { "xll", "application/vnd.ms-excel" },
686 { "xll", "application/x-excel" },
687 { "xlm", "application/excel" },
688 { "xlm", "application/vnd.ms-excel" },
689 { "xlm", "application/x-excel" },
690 { "xls", "application/excel" },
691 { "xls", "application/vnd.ms-excel" },
692 { "xls", "application/x-excel" },
693 { "xls", "application/x-msexcel" },
694 { "xlt", "application/excel" },
695 { "xlt", "application/x-excel" },
696 { "xlv", "application/excel" },
697 { "xlv", "application/x-excel" },
698 { "xlw", "application/excel" },
699 { "xlw", "application/vnd.ms-excel" },
700 { "xlw", "application/x-excel" },
701 { "xlw", "application/x-msexcel" },
702 { "xm", "audio/xm" },
703 { "xml", "application/xml" },
704 { "xml", "text/xml" },
705 { "xmz", "xgl/movie" },
706 { "xpix", "application/x-vnd.ls-xpix" },
707 { "xpm", "image/x-xpixmap" },
708 { "xpm", "image/xpm" },
709 { "x-png", "image/png" },
710 { "xsr", "video/x-amt-showrun" },
711 { "xwd", "image/x-xwd" },
712 { "xwd", "image/x-xwindowdump" },
713 { "xyz", "chemical/x-pdb" },
714 { "z", "application/x-compress" },
715 { "z", "application/x-compressed" },
716 { "zip", "application/x-compressed" },
717 { "zip", "application/x-zip-compressed" },
718 { "zip", "application/zip" },
719 { "zip", "multipart/x-zip" },
720 { "zoo", "application/octet-stream" },
721 };
722
723 template <typename EntryToPair>
724 static std::multimap<String, String> createMultiMap (EntryToPair&& entryToPair)
725 {
726 std::pair<const char*, const char*> transformed[std::size (initialEntries)];
727 std::transform (std::begin (initialEntries),
728 std::end (initialEntries),
729 std::begin (transformed),
730 entryToPair);
731
732 return { std::begin (transformed),
733 std::end (transformed) };
734 }
735
736 std::multimap<String, String> typeForExtension = createMultiMap ([] (auto e)
737 {
738 return std::make_pair (e.fileExtension, e.mimeType);
739 });
740
741 std::multimap<String, String> extensionForType = createMultiMap ([] (auto e)
742 {
743 return std::make_pair (e.mimeType, e.fileExtension);
744 });
745};
746
747} // namespace
748
749namespace detail
750{
751
752void MimeTypeTable::registerCustomMimeTypeForFileExtension (const String& mimeType, const String& fileExtension)
753{
754 Table::get().addEntry ({ fileExtension.toRawUTF8(), mimeType.toRawUTF8() });
755}
756
757StringArray MimeTypeTable::getMimeTypesForFileExtension (const String& fileExtension)
758{
759 return Table::get().getTypesForExtension (fileExtension);
760}
761
762StringArray MimeTypeTable::getFileExtensionsForMimeType (const String& mimeType)
763{
764 return Table::get().getExtensionsForType (mimeType);
765}
766
767} // namespace detail
768
769} // namespace juce