author | Claus Gittinger <cg@exept.de> |
Wed, 04 Jun 2008 10:46:09 +0200 | |
changeset 2486 | 42063a7fc3db |
parent 2479 | 40a05c259915 |
child 2487 | eaa224da42fa |
permissions | -rw-r--r-- |
643 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1612 | 3 |
All Rights Reserved |
643 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1410 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
643 | 14 |
Object subclass:#MIMETypes |
1612 | 15 |
instanceVariableNames:'' |
1729 | 16 |
classVariableNames:'TypeToImageReaderClassMapping TypeToCommentStringMapping |
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
17 |
TypeToFileSuffixMapping TypeToViewerApplicationMapping |
1729 | 18 |
SuffixToCommentStringMapping FileSuffixToTypeMapping |
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
19 |
FilenameToTypeMapping FileSuffixToImageReaderClassMapping |
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
20 |
CharSetToFontMapping LastSuffix LastType |
2298 | 21 |
DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS |
22 |
TypeToParentesisSpecMapping SuffixToParentesisSpecMapping' |
|
1612 | 23 |
poolDictionaries:'' |
1800 | 24 |
category:'Net-Communication-Support' |
1612 | 25 |
! |
26 |
||
27 |
String variableByteSubclass:#MIMEType |
|
28 |
instanceVariableNames:'' |
|
29 |
classVariableNames:'CachedTypes' |
|
30 |
poolDictionaries:'' |
|
31 |
privateIn:MIMETypes |
|
643 | 32 |
! |
33 |
||
34 |
!MIMETypes class methodsFor:'documentation'! |
|
35 |
||
36 |
copyright |
|
37 |
" |
|
38 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1612 | 39 |
All Rights Reserved |
643 | 40 |
|
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
48 |
||
49 |
" |
|
50 |
! |
|
51 |
||
52 |
documentation |
|
53 |
" |
|
54 |
just a place to keep MIME information |
|
55 |
(avoid spreading things at many places) |
|
56 |
||
1021 | 57 |
MIMETypes is abstract and functional. |
58 |
Actually, in some OperatingSystems, this information may |
|
59 |
be found in some config files (or registries). |
|
60 |
Therefore, this class may have to be extended to support this |
|
61 |
and fetch the information from there eventually. |
|
62 |
||
643 | 63 |
[author:] |
64 |
Claus Gittinger |
|
65 |
" |
|
1311 | 66 |
! |
67 |
||
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
68 |
examples |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
69 |
" |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
70 |
MIMETypes mimeTypeFromString:'application/x-expecco-testSuite' |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
71 |
|
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
72 |
MIMETypes mimeTypeForSuffix:'gif' |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
73 |
" |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
74 |
! |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
75 |
|
1311 | 76 |
knownTypes |
77 |
" |
|
78 |
simply a reminder for me ... |
|
79 |
||
80 |
application mime file extentsions |
|
81 |
||
82 |
powerpoint application/ms-powerpoint .pot, .ppz, .ppt, .pps, |
|
83 |
application/mspowerpoint |
|
84 |
application/vnd.ms-powerpoint |
|
85 |
application/x-mspowerpoint |
|
86 |
||
1312 | 87 |
shockwave application/x-shockwave-flash .swf |
1311 | 88 |
|
1312 | 89 |
futuresplash application/futuresplash .spl |
1311 | 90 |
" |
643 | 91 |
! ! |
92 |
||
93 |
!MIMETypes class methodsFor:'initialization'! |
|
94 |
||
1729 | 95 |
initialize |
96 |
"initialize wellKnown facts" |
|
97 |
||
98 |
MIMEType initialize. "must be initialized first" |
|
99 |
LastSuffix := LastType := nil. |
|
100 |
||
101 |
self initializeFileNameToMimeTypeMapping. |
|
102 |
self initializeImageReaderMappings. |
|
103 |
self initializeCommentStringMappings. |
|
2298 | 104 |
self initializeParentesisSpecMappings. |
1729 | 105 |
|
106 |
" |
|
107 |
self initialize |
|
108 |
" |
|
109 |
||
2298 | 110 |
"Modified: / 10-04-2007 / 15:16:44 / cg" |
1729 | 111 |
! |
112 |
||
113 |
initializeCommentStringMappings |
|
114 |
TypeToCommentStringMapping := Dictionary new. |
|
115 |
SuffixToCommentStringMapping := Dictionary new. |
|
116 |
||
117 |
TypeToCommentStringMapping |
|
118 |
at:'application/x-make' |
|
119 |
put:#('#' (nil nil)). "/ '#' for EOL comments only |
|
120 |
||
121 |
TypeToCommentStringMapping |
|
122 |
at:'application/x-sh' |
|
123 |
put:#('#' (nil nil)). "/ '#' for EOL comments only |
|
124 |
||
125 |
#('text/html' 'text/xml' 'application/xml') |
|
126 |
do:[:eachXMLType | |
|
127 |
TypeToCommentStringMapping |
|
128 |
at:eachXMLType |
|
129 |
put:#(nil ('<!!-- ' ' -->')). "/ '<!!-- ... -->' delimited comments only |
|
130 |
]. |
|
131 |
||
132 |
TypeToCommentStringMapping |
|
2055 | 133 |
at:'text/css' |
134 |
put:#('//' ('/*' '*/')). |
|
135 |
||
136 |
TypeToCommentStringMapping |
|
1729 | 137 |
at:'application/x-batch-script' |
138 |
put:#('rem ' (nil nil)). "/ 'rem ' for EOL comments only |
|
139 |
||
140 |
"/ the following is ST/X specific |
|
141 |
TypeToCommentStringMapping |
|
142 |
at:'application/x-smalltalk-source' |
|
143 |
put:#('"/' ('"' '"')). "/ '"/ ' for EOL; ".." for delimited comments |
|
144 |
||
2055 | 145 |
|
1729 | 146 |
"/ this is for standard smalltalk |
147 |
"/ TypeToCommentStringMapping |
|
148 |
"/ at:'application/x-smalltalk-source' |
|
149 |
"/ put:#(nil ('"' '"')). "/ ".." for delimited comments only |
|
150 |
||
151 |
||
152 |
TypeToCommentStringMapping |
|
153 |
at:'application/x-pascal-source' |
|
154 |
put:#(nil ('{' '}')). "/ '{'..'}' for delimited comments |
|
155 |
||
2055 | 156 |
|
2048
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
157 |
"/ "/ the following is k&r |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
158 |
"/ TypeToCommentStringMapping |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
159 |
"/ at:'application/x-c-source' |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
160 |
"/ put:#(nil ('/*' '*/')). "/ '/*'..'*/' for delimited comments |
1729 | 161 |
"/ this is ANSI-c |
162 |
TypeToCommentStringMapping |
|
163 |
at:'application/x-c-source' |
|
164 |
put:#('//' ('/*' '*/')). |
|
165 |
||
166 |
TypeToCommentStringMapping |
|
167 |
at:'application/x-cpp-source' |
|
168 |
put:#('//' ('/*' '*/')). |
|
169 |
||
170 |
TypeToCommentStringMapping |
|
2479 | 171 |
at:'application/x-csharp-source' |
172 |
put:#('//' ('/*' '*/')). |
|
173 |
||
174 |
TypeToCommentStringMapping |
|
1729 | 175 |
at:'application/x-java-source' |
176 |
put:#('//' ('/*' '*/')). |
|
177 |
||
178 |
TypeToCommentStringMapping |
|
2048
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
179 |
at:'application/x-javascript' |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
180 |
put:#('//' ('/*' '*/')). |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
181 |
|
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
182 |
TypeToCommentStringMapping |
2298 | 183 |
at:'application/x-lisp-source' |
184 |
put:#(';' (nil nil)). "/ '#' for EOL comments only |
|
185 |
||
186 |
TypeToCommentStringMapping |
|
1729 | 187 |
at:'application/x-asn1-source' |
188 |
put:#('--' ('--' '--')). |
|
189 |
||
190 |
||
191 |
"/ st/x support files |
|
192 |
SuffixToCommentStringMapping |
|
193 |
at:'style' |
|
194 |
put:#(';' (nil nil)). |
|
1604 | 195 |
|
1729 | 196 |
SuffixToCommentStringMapping |
197 |
at:'rs' |
|
2298 | 198 |
put:#(';' (nil nil)). |
199 |
||
200 |
"Modified: / 07-04-2007 / 16:12:05 / cg" |
|
1729 | 201 |
! |
202 |
||
203 |
initializeDefaultCommands |
|
204 |
"TODO: move this to OS" |
|
205 |
||
2116 | 206 |
|unixCommands win32Commands unixPrintCommands win32PrintCommands| |
1729 | 207 |
|
208 |
DefaultCommandPerMIMEPerOS := Dictionary new. |
|
209 |
DefaultCommandPerMIMEPerOS at:#unix put:(unixCommands := Dictionary new). |
|
210 |
DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new). |
|
211 |
||
212 |
unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'. |
|
213 |
unixCommands at:'application/pdf' put:'acroread -display %2 %1'. |
|
214 |
||
2141 | 215 |
OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd| |
2142 | 216 |
cmd := #( firefox konqueror mozilla netscape opera ) |
2141 | 217 |
detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] |
218 |
ifNone:nil. |
|
219 |
||
220 |
cmd notNil ifTrue:[ |
|
2142 | 221 |
unixCommands at:'text/html' put:(cmd, ' "%1"') |
2141 | 222 |
]. |
223 |
]. |
|
224 |
||
225 |
||
2116 | 226 |
DefaultPrintCommandPerMIMEPerOS := Dictionary new. |
227 |
DefaultPrintCommandPerMIMEPerOS at:#unix put:(unixPrintCommands := Dictionary new). |
|
228 |
DefaultPrintCommandPerMIMEPerOS at:#win32 put:(win32PrintCommands := Dictionary new). |
|
229 |
||
230 |
"/ if you have a good (intelligent) spooler ;-) |
|
231 |
unixPrintCommands at:'application/pdf' put:'lpr %1'. |
|
232 |
"/ if not, you may need more... |
|
233 |
"/ unixPrintCommands at:'application/pdf' put:'pdfToPS %1 | lpr'. |
|
234 |
||
235 |
"/ WIN32 setup is now obsolete - now read through the registry |
|
2096 | 236 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
237 |
"/ #( |
|
238 |
"/ "suffix" "default" "mime" |
|
239 |
"/ ( 'pdf' 'acrord32 %1' 'application/pdf' ) |
|
240 |
"/ ) triplesDo:[:suffix :default :mime| |
|
241 |
"/ |cmd| |
|
242 |
"/ |
|
243 |
"/ cmd := Win32OperatingSystem::RegistryEntry executableForSuffix:suffix. |
|
244 |
"/ cmd isNil ifTrue:[ |
|
245 |
"/ "assume its in the path" |
|
246 |
"/ cmd := default. |
|
247 |
"/ ]. |
|
248 |
"/ win32Commands at:mime put:cmd. |
|
249 |
"/ ]. |
|
250 |
"/ ]. |
|
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
251 |
|
1729 | 252 |
" |
253 |
self initializeDefaultCommands |
|
254 |
" |
|
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
255 |
|
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
256 |
"Modified: / 12-05-2004 / 11:43:23 / cg" |
1729 | 257 |
! |
258 |
||
259 |
initializeFileNameToMimeTypeMapping |
|
260 |
"initialize wellKnown facts" |
|
261 |
||
262 |
|types| |
|
263 |
||
264 |
FileSuffixToTypeMapping isNil ifTrue:[ |
|
265 |
FileSuffixToTypeMapping := Dictionary new |
|
266 |
]. |
|
1887 | 267 |
TypeToFileSuffixMapping isNil ifTrue:[ |
268 |
TypeToFileSuffixMapping := Dictionary new |
|
269 |
]. |
|
1729 | 270 |
FilenameToTypeMapping isNil ifTrue:[ |
271 |
FilenameToTypeMapping := Dictionary new. |
|
272 |
]. |
|
273 |
||
274 |
types := OrderedCollection new. |
|
275 |
types addAll:self textTypeList. |
|
276 |
types addAll:self imageTypeList. |
|
277 |
types addAll:self videoTypeList. |
|
278 |
types addAll:self audioTypeList. |
|
279 |
types addAll:self applicationTypeList. |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
280 |
types addAll:self osSpecificTypeList. |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
281 |
|
1729 | 282 |
types pairWiseDo:[:suff :typeString| |
283 |
|type| |
|
284 |
||
285 |
type := MIMEType fromString:typeString. |
|
286 |
suff isArray ifTrue:[ |
|
1887 | 287 |
suff do:[:s | FileSuffixToTypeMapping at:s put:type]. |
288 |
TypeToFileSuffixMapping at:type put:suff first. |
|
1729 | 289 |
] ifFalse:[ |
1887 | 290 |
FileSuffixToTypeMapping at:suff put:type. |
291 |
TypeToFileSuffixMapping at:type put:suff. |
|
292 |
]. |
|
1729 | 293 |
]. |
294 |
||
295 |
self miscFilenameList pairWiseDo:[:nm :typeString| |
|
296 |
|type| |
|
297 |
||
298 |
type := MIMEType fromString:typeString. |
|
299 |
nm isArray ifTrue:[ |
|
300 |
nm do:[:s | FilenameToTypeMapping at:s put:type] |
|
301 |
] ifFalse:[ |
|
302 |
FilenameToTypeMapping at:nm put:type |
|
303 |
] |
|
304 |
]. |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
305 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
306 |
" |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
307 |
self initializeFileNameToMimeTypeMapping |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
308 |
" |
1729 | 309 |
! |
310 |
||
311 |
initializeImageReaderMappings |
|
312 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
|
313 |
FileSuffixToImageReaderClassMapping := Dictionary new |
|
314 |
]. |
|
315 |
"MIME" TypeToImageReaderClassMapping isNil ifTrue:[ |
|
316 |
TypeToImageReaderClassMapping := Dictionary new |
|
317 |
]. |
|
318 |
||
319 |
"/ setup mimeType to image reader class mapping ... |
|
320 |
||
321 |
TypeToImageReaderClassMapping at:'image/jpeg' put:JPEGReader. |
|
322 |
TypeToImageReaderClassMapping at:'image/gif' put:GIFReader. |
|
323 |
TypeToImageReaderClassMapping at:'image/tiff' put:TIFFReader. |
|
324 |
||
325 |
"/ setup suffix to image reader class mapping ... |
|
326 |
||
327 |
FileSuffixToImageReaderClassMapping at:'jpg' put:JPEGReader. |
|
328 |
FileSuffixToImageReaderClassMapping at:'gif' put:GIFReader. |
|
329 |
FileSuffixToImageReaderClassMapping at:'tif' put:TIFFReader. |
|
2298 | 330 |
! |
331 |
||
332 |
initializeParentesisSpecMappings |
|
333 |
|spec| |
|
334 |
||
335 |
TypeToParentesisSpecMapping := Dictionary new. |
|
336 |
SuffixToParentesisSpecMapping := Dictionary new. |
|
337 |
||
338 |
"/ ST/X spec |
|
339 |
spec := IdentityDictionary new. |
|
340 |
spec at:#open put:#( $( $[ ${ "$> $<") . |
|
341 |
spec at:#close put:#( $) $] $} "$> $<"). |
|
342 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
|
343 |
spec at:#eolComment put:'"/'. |
|
344 |
||
345 |
TypeToParentesisSpecMapping |
|
346 |
at:'application/x-smalltalk-source' |
|
347 |
put:spec. |
|
348 |
||
2479 | 349 |
"/ XML & HTML |
2298 | 350 |
spec := IdentityDictionary new. |
351 |
spec at:#open put:#( $< ) . |
|
2479 | 352 |
spec at:#close put:#( $> ). |
2298 | 353 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
354 |
||
355 |
#('text/html' 'text/xml' 'application/xml') |
|
356 |
do:[:eachXMLType | |
|
357 |
TypeToParentesisSpecMapping |
|
358 |
at:eachXMLType |
|
359 |
put:spec |
|
360 |
]. |
|
361 |
||
2479 | 362 |
"/ ANSI-c, Java, C# |
2298 | 363 |
spec := IdentityDictionary new. |
364 |
spec at:#open put:#( $( $[ ${ ) . |
|
365 |
spec at:#close put:#( $) $] $} ). |
|
366 |
spec at:#ignore put:#( $' $" ). |
|
367 |
spec at:#eolComment put:'//'. |
|
368 |
||
369 |
TypeToParentesisSpecMapping |
|
370 |
at:'application/x-c-source' |
|
371 |
put:spec. |
|
372 |
||
373 |
TypeToParentesisSpecMapping |
|
374 |
at:'application/x-cpp-source' |
|
375 |
put:spec. |
|
376 |
||
377 |
TypeToParentesisSpecMapping |
|
2479 | 378 |
at:'application/x-csharp-source' |
379 |
put:spec. |
|
380 |
||
381 |
TypeToParentesisSpecMapping |
|
2298 | 382 |
at:'application/x-java-source' |
383 |
put:spec. |
|
384 |
||
385 |
TypeToParentesisSpecMapping |
|
386 |
at:'application/x-javascript' |
|
387 |
put:spec. |
|
388 |
||
389 |
"/ Lisp |
|
390 |
spec := IdentityDictionary new. |
|
391 |
spec at:#open put:#( $( ) . |
|
392 |
spec at:#close put:#( $) ). |
|
393 |
spec at:#ignore put:#( $" ). |
|
394 |
spec at:#eolComment put:';'. |
|
395 |
||
396 |
TypeToParentesisSpecMapping |
|
397 |
at:'application/x-lisp-source' |
|
398 |
put:spec. |
|
399 |
||
400 |
"Created: / 10-04-2007 / 15:16:37 / cg" |
|
1729 | 401 |
! ! |
402 |
||
403 |
!MIMETypes class methodsFor:'initialization-lists'! |
|
404 |
||
405 |
applicationCompressorsAndArchiveTypeList |
|
1604 | 406 |
^ #( |
1890 | 407 |
'tar' 'application/x-tar' |
408 |
'gtar' 'application/x-gtar' |
|
1891 | 409 |
('tgz' 'tar.gz') 'application/x-tar-gzip-compressed' "/ 'application/x-tar-compressed' |
410 |
('tar.bz2') 'application/x-tar-bzip2-compressed' |
|
1890 | 411 |
'zip' 'application/x-zip-compressed' |
412 |
'bz2' 'application/x-bzip2-compressed' |
|
413 |
('gz' 'z') 'application/x-gzip-compressed' |
|
414 |
'cpio' 'application/x-cpio' |
|
415 |
'shar' 'application/x-shar' |
|
416 |
'jar' 'application/java-archive' |
|
417 |
'sar' 'application/x-squeak-archive' |
|
418 |
'sit' 'application/x-stuffit' |
|
419 |
'hqx' 'application/mac-binhex40' |
|
420 |
'cpt' 'application/mac-compactpro' |
|
1604 | 421 |
) |
422 |
! |
|
645 | 423 |
|
1609 | 424 |
applicationMiscTypeList |
425 |
"misc applications" |
|
426 |
||
427 |
^ #( |
|
428 |
('a' 'o' 'obj' ) 'application/binary' |
|
429 |
'a' 'application/library' |
|
430 |
('dll' 'so') 'application/shared-library' |
|
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
431 |
|
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
432 |
('ets') 'application/x-expecco-testsuite' |
1609 | 433 |
) |
434 |
! |
|
435 |
||
1604 | 436 |
applicationProgLangTypeList |
1606 | 437 |
"applications for programm languages" |
713 | 438 |
|
1604 | 439 |
^ #( |
1609 | 440 |
('st' 'cls' 'rc') 'application/x-smalltalk-source' |
1604 | 441 |
'sif' 'application/x-smalltalk-source-sif' |
1668 | 442 |
'pac' 'application/x-smalltalk-dolphin-package' |
1778 | 443 |
|
444 |
'sts' 'application/x-squeak-source' |
|
445 |
'pr' 'application/x-squeak-project' |
|
446 |
||
1604 | 447 |
'c' 'application/x-c-source' |
448 |
('cc' 'cpp') 'application/x-cpp-source' |
|
2479 | 449 |
'cs' 'application/x-csharp-source' |
1609 | 450 |
('h' 'hi') 'application/x-c-header' |
1604 | 451 |
('js' 'mocha') 'application/x-javascript' |
452 |
('java' 'jav') 'application/x-java-source' |
|
453 |
'sh' 'application/x-sh' |
|
454 |
'csh' 'application/x-csh' |
|
455 |
'tcl' 'application/x-tcl' |
|
456 |
'pl' 'application/x-perl' |
|
457 |
'mak' 'application/x-make' |
|
458 |
'bat' 'application/x-batch-script' |
|
459 |
('asn1' 'x409' 'gdmo' 'gdm') 'application/x-asn1-source' |
|
2298 | 460 |
('lisp' 'lsp' 'scm' 'ss') 'application/x-lisp-source' |
1604 | 461 |
) |
2298 | 462 |
|
463 |
"Modified: / 09-04-2007 / 09:46:04 / cg" |
|
1604 | 464 |
! |
1561 | 465 |
|
1604 | 466 |
applicationTextTypeList |
1606 | 467 |
"text applications" |
1604 | 468 |
|
469 |
^ #( |
|
470 |
('ps' 'eps') 'application/postscript' |
|
1778 | 471 |
"/ 'ai' 'application/postscript' |
1604 | 472 |
'pdf' 'application/pdf' |
473 |
'rtf' 'application/rtf' |
|
1778 | 474 |
"/ 'rtf' 'text/rtf' ???? |
475 |
"/ 'doc' 'application/winword' |
|
1779 | 476 |
'doc' 'application/ms-word-document' |
1778 | 477 |
'swf' 'application/x-shockwave-flash' |
478 |
('ppt' 'ppz' 'pot' 'pps') 'application/mspowerpoint' |
|
2028 | 479 |
'xls' 'application/x-excel' |
480 |
'slk' 'application/vnd.ms-excel' |
|
1604 | 481 |
) |
482 |
! |
|
483 |
||
484 |
applicationTypeList |
|
1606 | 485 |
"applications" |
1604 | 486 |
|
1729 | 487 |
|typeList| |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
488 |
|
1729 | 489 |
typeList := OrderedCollection new. |
490 |
typeList addAll:self applicationProgLangTypeList. |
|
491 |
typeList addAll:self applicationTextTypeList. |
|
492 |
typeList addAll:self applicationCompressorsAndArchiveTypeList. |
|
493 |
typeList addAll:self applicationMiscTypeList. |
|
1616 | 494 |
|
1729 | 495 |
^ typeList |
1604 | 496 |
! |
497 |
||
498 |
audioTypeList |
|
1606 | 499 |
"audio formats ..." |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
500 |
|
1604 | 501 |
^ #( |
1720 | 502 |
('au' 'snd') 'audio/basic' |
1778 | 503 |
('ra') 'audio/x-realaudio' |
504 |
('ram' 'rm') 'audio/x-pn-realaudio' |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
505 |
"/ cg: see unixSpecific / windowsSpecific |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
506 |
"/ 'rpm' 'audio/x-pn-realaudio-plugin' |
1720 | 507 |
('mpa' 'mpega') 'audio/mpeg' |
1778 | 508 |
"/ 'mp3' 'audio/x-mp3' |
509 |
('mp3' 'mp2') 'audio/mpeg' |
|
1604 | 510 |
'wav' 'audio/x-wav' |
511 |
('aif' 'aiff' 'aifc') 'audio/x-aiff' |
|
1778 | 512 |
('midi' 'mid') 'audio/midi' |
1604 | 513 |
) |
514 |
! |
|
515 |
||
516 |
imageTypeList |
|
517 |
||
518 |
^ #( |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
519 |
"/ image formats ... |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
520 |
|
1216 | 521 |
('jpg' 'jpeg') 'image/jpeg' |
1188 | 522 |
'gif' 'image/gif' |
523 |
('tif' 'tiff') 'image/tiff' |
|
524 |
'xbm' 'image/x-xbitmap' |
|
525 |
'xpm' 'image/x-xpixmap' |
|
1720 | 526 |
'png' 'image/png' |
1188 | 527 |
'pcd' 'image/x-photo-cd' |
528 |
'bmp' 'image/x-MS-bmp' |
|
529 |
'rgb' 'image/x-rgb' |
|
530 |
'ppm' 'image/x-portable-pixmap' |
|
531 |
'pgm' 'image/x-portable-graymap' |
|
532 |
'pbm' 'image/x-portable-bitmap' |
|
533 |
'pnm' 'image/x-portable-anymap' |
|
534 |
'xwd' 'image/x-xwindowdump' |
|
535 |
'ras' 'image/x-cmu-raster' |
|
1216 | 536 |
'tga' 'image/x-targa' |
2020 | 537 |
'ico' 'image/x-ico' |
1604 | 538 |
) |
539 |
! |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
540 |
|
1609 | 541 |
miscFilenameList |
542 |
"other formats (not by suffix, but by fileName isnstead) ..." |
|
543 |
||
544 |
^ #( |
|
2113 | 545 |
('makefile' 'make.proto' 'make.spec' 'nt.mak') 'application/x-make' |
546 |
('exe' 'bin') 'application/octet-stream' |
|
547 |
('class') 'application/octet-stream' |
|
2375 | 548 |
('top') 'application/x-waltop-digital-notepad' |
1609 | 549 |
) |
550 |
! |
|
551 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
552 |
osSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
553 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
554 |
^ self windowsSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
555 |
]. |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
556 |
^ self unixSpecificTypeList |
2023 | 557 |
|
558 |
" |
|
559 |
self osSpecificTypeList |
|
560 |
" |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
561 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
562 |
|
1604 | 563 |
textTypeList |
564 |
"/ misc text ... |
|
565 |
||
566 |
^ #( |
|
1887 | 567 |
('html' 'htm' 'shtml') 'text/html' |
1604 | 568 |
('txt' 'text') 'text/plain' |
1680 | 569 |
'xml' 'text/xml' |
1777 | 570 |
'css' 'text/css' |
2432 | 571 |
'csv' 'text/csv' |
1604 | 572 |
) |
573 |
! |
|
574 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
575 |
unixSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
576 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
577 |
^ #( |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
578 |
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
579 |
"/ and 'application/x-rpm' for Unix |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
580 |
'rpm' 'application/x-rpm' |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
581 |
) |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
582 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
583 |
|
1604 | 584 |
videoTypeList |
585 |
"/ video formats ... |
|
586 |
||
587 |
^ #( |
|
1720 | 588 |
('qt' 'mov' 'moov') 'video/quicktime' |
589 |
('mpv' 'mpegv' 'mpg' 'mpeg' 'mpe') 'video/mpeg' |
|
1604 | 590 |
'movie' 'video/x-sgi-movie' |
1820 | 591 |
('avi' 'wmv' 'asf') 'video/x-msvideo' |
1604 | 592 |
('mpv2' 'mp2v' 'mp2' 'mpeg2') 'video/x-mpeg2' |
1680 | 593 |
'rm' 'application/vnd.rn-realmedia' |
594 |
'rv' 'video/x-pn-realvideo' |
|
1778 | 595 |
) |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
596 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
597 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
598 |
windowsSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
599 |
^ #( |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
600 |
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
601 |
"/ and 'application/x-rpm' for Unix |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
602 |
'rpm' 'audio/x-pn-realaudio-plugin' |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
603 |
) |
643 | 604 |
! ! |
605 |
||
1729 | 606 |
!MIMETypes class methodsFor:'obsolete'! |
1489 | 607 |
|
1729 | 608 |
fontForCharset:aCharSetName |
609 |
"return the font-encoding for an iso-charset" |
|
1489 | 610 |
|
1981 | 611 |
<resource:#obsolete> |
1729 | 612 |
self obsoleteMethodWarning:'use FontDescription >> fontNamePatternForCharset:'. |
613 |
^ FontDescription fontNamePatternForCharset:aCharSetName. |
|
1489 | 614 |
|
615 |
" |
|
1729 | 616 |
MIMETypes fontForCharset:'iso2022-jp' |
617 |
MIMETypes fontForCharset:'euc-jp' |
|
1472 | 618 |
" |
619 |
||
1729 | 620 |
"Modified: / 1.8.1998 / 17:00:57 / cg" |
621 |
! ! |
|
1472 | 622 |
|
1729 | 623 |
!MIMETypes class methodsFor:'queries'! |
1472 | 624 |
|
647 | 625 |
defineImageType:mimeType suffix:aSuffix reader:aReaderClass |
626 |
"register an image reader." |
|
627 |
||
628 |
aSuffix notNil ifTrue:[ |
|
629 |
self imageReaderForSuffix:aSuffix put:aReaderClass. |
|
630 |
]. |
|
631 |
||
632 |
mimeType notNil ifTrue:[ |
|
633 |
self imageReaderForType:mimeType put:aReaderClass |
|
634 |
]. |
|
635 |
||
636 |
(aSuffix notNil and:[mimeType notNil]) ifTrue:[ |
|
637 |
self mimeTypeForSuffix:aSuffix put:mimeType |
|
638 |
]. |
|
639 |
! |
|
640 |
||
643 | 641 |
fileSuffixToImageReaderMapping |
1021 | 642 |
"return the suffix-to-imageReader mapping" |
643 |
||
643 | 644 |
^ FileSuffixToImageReaderClassMapping ? #() |
645 |
||
1021 | 646 |
"Modified: / 1.8.1998 / 17:00:11 / cg" |
643 | 647 |
! |
648 |
||
649 |
imageFileSuffixes |
|
1021 | 650 |
"return a collection with known file suffixes" |
651 |
||
643 | 652 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()]. |
653 |
^ FileSuffixToImageReaderClassMapping keys |
|
654 |
||
1021 | 655 |
"Created: / 30.6.1997 / 22:04:48 / cg" |
656 |
"Modified: / 1.8.1998 / 17:01:26 / cg" |
|
643 | 657 |
! |
658 |
||
1473 | 659 |
mimeTypeForFilename:filenameArg |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
660 |
"given a filename, return the mime-type or nil, if unknown" |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
661 |
|
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
662 |
|type filename lcFilename suff suff2| |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
663 |
|
1473 | 664 |
filename := filenameArg asFilename. |
1474 | 665 |
|
666 |
lcFilename := filename baseName asLowercase. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
667 |
type := FilenameToTypeMapping at:lcFilename ifAbsent:nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
668 |
type isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
669 |
"/ allow for fallback ... |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
670 |
type := OperatingSystem mimeTypeForFilename:lcFilename. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
671 |
"/ the special value #unknown is returned as nil; |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
672 |
"/ this avoids constant retry if a mimeType is not known in |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
673 |
"/ the OS. |
1275 | 674 |
"/ type isNil ifTrue:[ |
675 |
"/ FilenameToTypeMapping at:lcFilename put:#unknown |
|
676 |
"/ ]. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
677 |
]. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
678 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
679 |
type == #unknown ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
680 |
type := nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
681 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
682 |
|
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
683 |
type isNil ifTrue:[ |
1473 | 684 |
suff := filename suffix. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
685 |
suff size ~~ 0 ifTrue:[ |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
686 |
"/ sigh - special code for multiple-suffices... |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
687 |
"/ .tar.gz -> tgz |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
688 |
suff2 := filename withoutSuffix suffix. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
689 |
suff2 size > 0 ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
690 |
type := self mimeTypeForSuffix:(suff2 , '.' , suff). |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
691 |
]. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
692 |
type isNil ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
693 |
type := self mimeTypeForSuffix:suff |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
694 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
695 |
] |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
696 |
]. |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
697 |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
698 |
^ type |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
699 |
|
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
700 |
" |
1841 | 701 |
self mimeTypeForFilename:'typeinst.dvi' |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
702 |
self mimeTypeForFilename:'foo.tar' |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
703 |
self mimeTypeForFilename:'foo.tgz' |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
704 |
self mimeTypeForFilename:'foo.tar.gz' |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
705 |
" |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
706 |
! |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
707 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
708 |
mimeTypeForFilename:filename put:mimeType |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
709 |
"register a mime type for a filename" |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
710 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
711 |
FilenameToTypeMapping isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
712 |
FilenameToTypeMapping := Dictionary new |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
713 |
]. |
1612 | 714 |
FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase) |
1611 | 715 |
! |
716 |
||
643 | 717 |
mimeTypeForSuffix:suffix |
1021 | 718 |
"given a file suffix, return the mime-type" |
719 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
720 |
|type lcSuffix| |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
721 |
|
1837 | 722 |
suffix = LastSuffix ifTrue:[ |
723 |
^ LastType |
|
724 |
]. |
|
725 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
726 |
lcSuffix := suffix asLowercase. |
1837 | 727 |
type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil. |
728 |
type isNil ifTrue:[ |
|
729 |
"/ allow for fallback ... |
|
730 |
type := OperatingSystem mimeTypeForSuffix:lcSuffix. |
|
731 |
"/ the special value #unknown is returned as nil; |
|
732 |
"/ this avoids constant retry if a mimeType is not known in the OS. |
|
733 |
||
734 |
type := type ? #unknown. |
|
735 |
FileSuffixToTypeMapping at:lcSuffix put:type. |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
736 |
]. |
1837 | 737 |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
738 |
type == #unknown ifTrue:[ |
1837 | 739 |
type := nil. |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
740 |
]. |
1840 | 741 |
type notNil ifTrue:[ |
742 |
LastSuffix := suffix. |
|
743 |
LastType := MIMEType fromString:type. |
|
744 |
^ LastType |
|
745 |
]. |
|
1841 | 746 |
^ type |
643 | 747 |
|
1666 | 748 |
" |
1840 | 749 |
self mimeTypeForSuffix:'gif' |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
750 |
self mimeTypeForSuffix:'rpm' |
1666 | 751 |
" |
752 |
||
1021 | 753 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
1300 | 754 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
643 | 755 |
! |
756 |
||
757 |
mimeTypeForSuffix:suffix put:mimeType |
|
1021 | 758 |
"register a mime type for a file suffix" |
759 |
||
643 | 760 |
FileSuffixToTypeMapping isNil ifTrue:[ |
761 |
FileSuffixToTypeMapping := Dictionary new |
|
762 |
]. |
|
763 |
FileSuffixToTypeMapping at:suffix put:mimeType asLowercase |
|
764 |
||
1021 | 765 |
"Created: / 30.6.1997 / 21:56:20 / cg" |
766 |
"Modified: / 1.8.1998 / 17:03:18 / cg" |
|
1593 | 767 |
! |
768 |
||
769 |
mimeTypeForSuffixMapping |
|
770 |
||
771 |
^ FileSuffixToTypeMapping |
|
1611 | 772 |
! |
773 |
||
2023 | 774 |
mimeTypeFromString:mimeTypeString |
775 |
"given a mime-type for a string" |
|
776 |
||
777 |
^ MIMEType fromString:mimeTypeString |
|
778 |
||
779 |
" |
|
780 |
self mimeTypeFromString:'image/gif' |
|
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
781 |
self mimeTypeFromString:'application/x-expecco-testSuite' |
2023 | 782 |
" |
783 |
! |
|
784 |
||
1611 | 785 |
mimeTypeOfContents:filename |
786 |
"given a filename, scan the contents, return the mime-type or nil, if unknown" |
|
787 |
||
1612 | 788 |
|typeString| |
789 |
||
790 |
typeString := filename mimeTypeOfContents. |
|
791 |
typeString isNil ifTrue:[^ nil]. |
|
792 |
^ MIMEType fromString:typeString. |
|
1887 | 793 |
! |
794 |
||
795 |
suffixForMimeType:mimeType |
|
796 |
"given a file suffix, return the mime-type" |
|
797 |
||
798 |
^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil |
|
799 |
||
800 |
" |
|
801 |
self suffixForMimeType:(MIMEType fromString:'image/gif') |
|
802 |
" |
|
803 |
||
804 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
805 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
806 |
! |
|
807 |
||
808 |
suffixForMimeTypeString:mimeTypeString |
|
809 |
"given a file suffix, return the mime-type" |
|
810 |
||
811 |
^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) |
|
812 |
||
813 |
" |
|
814 |
self suffixForMimeTypeString:'image/gif' |
|
815 |
" |
|
816 |
||
817 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
818 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
1612 | 819 |
! ! |
820 |
||
2116 | 821 |
!MIMETypes class methodsFor:'queries-applications'! |
822 |
||
2117 | 823 |
defaultCommandForMimeType:mimeType |
824 |
self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'. |
|
825 |
||
826 |
^ self defaultCommandTemplateToOpenMimeType:mimeType |
|
827 |
||
828 |
" |
|
829 |
MIMETypes defaultCommandForMimeType:'application/pdf' |
|
830 |
" |
|
831 |
||
832 |
"Created: / 12-05-2004 / 11:09:22 / cg" |
|
833 |
"Modified: / 12-05-2004 / 11:16:53 / cg" |
|
834 |
! |
|
835 |
||
836 |
defaultCommandPerMIME |
|
837 |
"returns the collection which is used to map MIME-type to command-templates." |
|
838 |
||
839 |
"TODO: move this to OS/UserPreferences" |
|
840 |
||
841 |
DefaultCommandPerMIMEPerOS isNil ifTrue:[ |
|
842 |
self initializeDefaultCommands |
|
843 |
]. |
|
844 |
OperatingSystem isUNIXlike ifTrue:[ |
|
845 |
^ DefaultCommandPerMIMEPerOS at:#unix |
|
846 |
]. |
|
847 |
^ DefaultCommandPerMIMEPerOS at:#win32 |
|
848 |
! |
|
849 |
||
2116 | 850 |
defaultCommandTemplateToOpenMimeType:mimeType |
851 |
|cmd| |
|
852 |
||
853 |
cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil. |
|
854 |
cmd isNil ifTrue:[ |
|
855 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
856 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType |
|
857 |
]. |
|
858 |
]. |
|
859 |
^ cmd |
|
860 |
||
861 |
" |
|
862 |
MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' |
|
2118 | 863 |
MIMETypes defaultCommandTemplateToOpenMimeType:'text/html' |
2116 | 864 |
" |
865 |
||
866 |
"Created: / 12-05-2004 / 11:09:22 / cg" |
|
867 |
"Modified: / 12-05-2004 / 11:16:53 / cg" |
|
868 |
! |
|
869 |
||
870 |
defaultCommandTemplateToPrintMimeType:mimeType |
|
871 |
|cmd| |
|
872 |
||
873 |
cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil. |
|
874 |
cmd isNil ifTrue:[ |
|
875 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
876 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType |
|
877 |
]. |
|
878 |
]. |
|
879 |
^ cmd |
|
880 |
||
881 |
" |
|
882 |
MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf' |
|
883 |
" |
|
2117 | 884 |
! |
885 |
||
886 |
defaultPrintCommandPerMIME |
|
887 |
"returns the collection which is used to map MIME-type to printing command-templates." |
|
888 |
||
889 |
"TODO: move this to OS/UserPreferences" |
|
890 |
||
891 |
DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[ |
|
892 |
self initializeDefaultCommands |
|
893 |
]. |
|
894 |
OperatingSystem isUNIXlike ifTrue:[ |
|
895 |
^ DefaultPrintCommandPerMIMEPerOS at:#unix |
|
896 |
]. |
|
897 |
^ DefaultPrintCommandPerMIMEPerOS at:#win32 |
|
2116 | 898 |
! ! |
899 |
||
1729 | 900 |
!MIMETypes class methodsFor:'queries-image formats'! |
901 |
||
902 |
imageReaderClasses |
|
903 |
"return a collection of registered image reader classes" |
|
904 |
||
905 |
|setOfClasses| |
|
906 |
||
907 |
setOfClasses := IdentitySet new. |
|
908 |
FileSuffixToImageReaderClassMapping notNil ifTrue:[ |
|
909 |
FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
910 |
setOfClasses add:cls |
|
911 |
]. |
|
912 |
]. |
|
913 |
TypeToImageReaderClassMapping notNil ifTrue:[ |
|
914 |
TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
915 |
setOfClasses add:cls |
|
916 |
]. |
|
917 |
]. |
|
918 |
^ setOfClasses |
|
919 |
||
920 |
"Created: / 30.6.1997 / 22:03:42 / cg" |
|
921 |
"Modified: / 1.8.1998 / 16:59:52 / cg" |
|
922 |
! |
|
923 |
||
924 |
imageReaderForSuffix:aSuffix |
|
925 |
"given a file suffix, return an approriate image reader class" |
|
926 |
||
927 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ nil]. |
|
928 |
^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil |
|
929 |
||
930 |
"Created: / 30.6.1997 / 21:59:11 / cg" |
|
931 |
"Modified: / 1.8.1998 / 17:01:58 / cg" |
|
932 |
! |
|
933 |
||
934 |
imageReaderForSuffix:aSuffix put:aReaderClass |
|
935 |
"register an image reader for a file suffix" |
|
936 |
||
937 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
|
938 |
FileSuffixToImageReaderClassMapping := Dictionary new. |
|
939 |
]. |
|
940 |
FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass |
|
941 |
||
942 |
"Created: / 30.6.1997 / 21:59:43 / cg" |
|
943 |
"Modified: / 1.8.1998 / 17:02:14 / cg" |
|
944 |
! |
|
945 |
||
946 |
imageReaderForType:mimeTypeString |
|
947 |
"given a mime-type, return an approriate image reader class" |
|
948 |
||
949 |
TypeToImageReaderClassMapping isNil ifTrue:[^ nil]. |
|
950 |
^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil |
|
951 |
||
952 |
"Created: / 30.6.1997 / 21:56:01 / cg" |
|
953 |
"Modified: / 1.8.1998 / 17:02:28 / cg" |
|
954 |
! |
|
955 |
||
956 |
imageReaderForType:mimeTypeString put:aReaderClass |
|
957 |
"register an image reader for a mime-type" |
|
958 |
||
959 |
TypeToImageReaderClassMapping isNil ifTrue:[ |
|
960 |
TypeToImageReaderClassMapping := Dictionary new. |
|
961 |
]. |
|
962 |
TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass |
|
963 |
||
964 |
"Created: / 30.6.1997 / 21:56:11 / cg" |
|
965 |
"Modified: / 1.8.1998 / 17:02:40 / cg" |
|
966 |
! ! |
|
967 |
||
968 |
!MIMETypes class methodsFor:'queries-language syntax'! |
|
969 |
||
970 |
commentStringsForFilename:aFilename |
|
971 |
"return a useful comment definition; heuristics for now. |
|
972 |
The returned value is an array of 2 elements; |
|
973 |
the first is the end-of-line comment string (or nil); |
|
974 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
975 |
||
976 |
|mime| |
|
977 |
||
978 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
979 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) |
|
980 |
||
981 |
" |
|
982 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
983 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
984 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1925 | 985 |
MIMETypes commentStringsForFilename:'Foo.html'. |
1729 | 986 |
" |
987 |
! |
|
988 |
||
989 |
commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString |
|
990 |
"return a useful comment definition; heuristics for now. |
|
991 |
The returned value is an array of 2 elements; |
|
992 |
the first is the end-of-line comment string (or nil); |
|
993 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
994 |
||
995 |
|mime| |
|
996 |
||
997 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
998 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString |
|
999 |
||
1000 |
" |
|
1001 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
1002 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
1003 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1004 |
" |
|
1005 |
! |
|
1006 |
||
1007 |
commentStringsForMimeType:mime suffix:suff |
|
1008 |
"return a useful comment definition; heuristics for now. |
|
1009 |
The returned value is an array of 2 elements; |
|
1010 |
the first is the end-of-line comment string (or nil); |
|
1011 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1012 |
||
1013 |
^ self |
|
1014 |
commentStringsForMimeType:mime suffix:suff |
|
1015 |
ifUnknown: #(';' (nil nil)) |
|
1016 |
||
1017 |
" |
|
1018 |
|mime| |
|
1019 |
||
1020 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1021 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1022 |
" |
|
1023 |
||
1024 |
" |
|
1025 |
|mime| |
|
1026 |
||
1027 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1028 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1029 |
" |
|
1030 |
! |
|
1031 |
||
1032 |
commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString |
|
1033 |
"return a useful comment definition; heuristics for now. |
|
1034 |
The returned value is an array of 2 elements; |
|
1035 |
the first is the end-of-line comment string (or nil); |
|
1036 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1037 |
||
1038 |
|commentSpec| |
|
1039 |
||
1040 |
commentSpec := TypeToCommentStringMapping at:mime ifAbsent:nil. |
|
1041 |
commentSpec notNil ifTrue:[ |
|
1042 |
^ commentSpec |
|
1043 |
]. |
|
1044 |
||
1045 |
commentSpec := SuffixToCommentStringMapping at:suff ifAbsent:nil. |
|
1046 |
commentSpec notNil ifTrue:[ |
|
1047 |
^ commentSpec |
|
1048 |
]. |
|
1049 |
||
1050 |
^ alternativeBlockReturningCommentString value |
|
1051 |
||
1052 |
" |
|
1053 |
|mime| |
|
1054 |
||
1055 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1056 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1057 |
" |
|
1058 |
||
1059 |
" |
|
1060 |
|mime| |
|
1061 |
||
1062 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1063 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1064 |
" |
|
2298 | 1065 |
! |
1066 |
||
1067 |
parentesisSpecForFilename:aFilename |
|
1068 |
"return a useful parentesis spec; heuristics for now. |
|
1069 |
The returned value is a dictionary to be used as parentesis spec in an editor" |
|
1070 |
||
1071 |
|mime| |
|
1072 |
||
1073 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1074 |
^ self parentesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) |
|
1075 |
||
1076 |
" |
|
1077 |
MIMETypes parentesisSpecForFilename:'Object.st'. |
|
1078 |
MIMETypes parentesisSpecForFilename:'Foo.java'. |
|
1079 |
MIMETypes parentesisSpecForFilename:'Foo.html'. |
|
1080 |
MIMETypes parentesisSpecForFilename:'Foo.lsp'. |
|
1081 |
" |
|
1082 |
||
1083 |
"Created: / 10-04-2007 / 15:18:41 / cg" |
|
1084 |
! |
|
1085 |
||
1086 |
parentesisSpecForFilename:aFilename ifUnknown:alternative |
|
1087 |
|mime| |
|
1088 |
||
1089 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1090 |
^ self parentesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative |
|
1091 |
||
1092 |
"Created: / 10-04-2007 / 15:26:20 / cg" |
|
1093 |
! |
|
1094 |
||
1095 |
parentesisSpecForMimeType:mime suffix:suff |
|
1096 |
^ self |
|
1097 |
parentesisSpecForMimeType:mime suffix:suff |
|
1098 |
ifUnknown: nil |
|
1099 |
||
1100 |
"Created: / 10-04-2007 / 15:19:39 / cg" |
|
1101 |
! |
|
1102 |
||
1103 |
parentesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue |
|
1104 |
|spec| |
|
1105 |
||
1106 |
spec := TypeToParentesisSpecMapping at:mime ifAbsent:nil. |
|
1107 |
spec notNil ifTrue:[ |
|
1108 |
^ spec |
|
1109 |
]. |
|
1110 |
||
1111 |
spec := SuffixToParentesisSpecMapping at:suff ifAbsent:nil. |
|
1112 |
spec notNil ifTrue:[ |
|
1113 |
^ spec |
|
1114 |
]. |
|
1115 |
||
1116 |
^ alternativeValue value |
|
1117 |
||
1118 |
"Created: / 10-04-2007 / 15:20:38 / cg" |
|
1729 | 1119 |
! ! |
1120 |
||
1612 | 1121 |
!MIMETypes::MIMEType class methodsFor:'documentation'! |
1122 |
||
1123 |
documentation |
|
1124 |
" |
|
1864 | 1125 |
like a string, but knows that it represents a mimeType. |
1612 | 1126 |
" |
1127 |
! ! |
|
1128 |
||
1129 |
!MIMETypes::MIMEType class methodsFor:'initialization'! |
|
1130 |
||
1131 |
initialize |
|
1132 |
CachedTypes := CacheDictionary new:30. |
|
1133 |
||
1134 |
" |
|
1135 |
self initialize |
|
1136 |
" |
|
1137 |
! ! |
|
1138 |
||
1139 |
!MIMETypes::MIMEType class methodsFor:'instance creation'! |
|
1140 |
||
1141 |
fromString:aString |
|
1142 |
|cachedType newType| |
|
1143 |
||
1144 |
aString class == self ifTrue:[^ aString]. |
|
1145 |
||
1146 |
cachedType := CachedTypes at:aString ifAbsent:nil. |
|
1147 |
cachedType notNil ifTrue:[^ cachedType]. |
|
1148 |
newType := aString copy changeClassTo:self. |
|
1149 |
CachedTypes at:aString put:newType. |
|
1150 |
^ newType |
|
1151 |
||
1152 |
" |
|
1153 |
self fromString:'text/html' |
|
1154 |
" |
|
1155 |
! ! |
|
1156 |
||
1157 |
!MIMETypes::MIMEType methodsFor:'queries'! |
|
1158 |
||
1693 | 1159 |
isArchive |
1864 | 1160 |
"return true, if I represent an archive type (such as zip or tar)" |
1161 |
||
1612 | 1162 |
|archivTypes| |
1163 |
||
1729 | 1164 |
archivTypes := MIMETypes applicationCompressorsAndArchiveTypeList. |
1612 | 1165 |
archivTypes pairWiseDo:[: ext : type | |
1166 |
self = type ifTrue:[ ^ true]. |
|
1167 |
]. |
|
1168 |
^ false |
|
1169 |
! |
|
1170 |
||
2024 | 1171 |
isBinary |
1172 |
"return true, if I represent a binary (non-text) type" |
|
1173 |
||
1174 |
^ self isTextType not |
|
1175 |
! |
|
1176 |
||
1612 | 1177 |
isHtml |
1864 | 1178 |
"return true, if I represent the html text type" |
1612 | 1179 |
|
1180 |
^ (self = 'text/html') |
|
1181 |
! |
|
1182 |
||
1183 |
isImage |
|
1864 | 1184 |
"return true, if I represent an image type (such as gif or jpg)" |
1612 | 1185 |
|
1693 | 1186 |
^ (self startsWith:'image/') |
1612 | 1187 |
! |
1188 |
||
1189 |
isPdf |
|
1864 | 1190 |
"return true, if I represent the pdf type" |
1191 |
||
1612 | 1192 |
^ (self = 'application/pdf') |
1193 |
! |
|
1194 |
||
1195 |
isSmalltalkSource |
|
1864 | 1196 |
"return true, if I represent the smalltalk sourcecode type" |
1197 |
||
1612 | 1198 |
^ (self = 'application/x-smalltalk-source') |
1783 | 1199 |
! |
1200 |
||
2024 | 1201 |
isTextType |
1202 |
"return true, if I represent some text type" |
|
1203 |
||
1204 |
^ self startsWith:'text/' |
|
1205 |
! |
|
1206 |
||
1783 | 1207 |
isXml |
1864 | 1208 |
"return true, if I represent the xml text type" |
1209 |
||
1783 | 1210 |
^ (self = 'text/xml') |
643 | 1211 |
! ! |
1212 |
||
1213 |
!MIMETypes class methodsFor:'documentation'! |
|
1214 |
||
1215 |
version |
|
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1216 |
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.92 2008-06-04 08:46:09 cg Exp $' |
643 | 1217 |
! ! |
1666 | 1218 |
|
643 | 1219 |
MIMETypes initialize! |
1666 | 1220 |
MIMETypes::MIMEType initialize! |