"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
Object subclass:#MIMETypes
instanceVariableNames:''
classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
FileSuffixToImageReaderClassMapping CharSetToFontMapping'
poolDictionaries:''
category:'System-Documentation'
!
!MIMETypes class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
just a place to keep MIME information
(avoid spreading things at many places)
[author:]
Claus Gittinger
"
! !
!MIMETypes class methodsFor:'initialization'!
initialize
"initialize wellKnown facts"
TypeToImageReaderClassMapping isNil ifTrue:[TypeToImageReaderClassMapping := Dictionary new].
TypeToImageReaderClassMapping at:'image/jpeg' put:JPEGReader.
TypeToImageReaderClassMapping at:'image/gif' put:GIFReader.
TypeToImageReaderClassMapping at:'image/tiff' put:TIFFReader.
FileSuffixToTypeMapping isNil ifTrue:[FileSuffixToTypeMapping := Dictionary new].
FileSuffixToTypeMapping at:'jpg' put:'image/jpeg'.
FileSuffixToTypeMapping at:'gif' put:'image/gif'.
FileSuffixToTypeMapping at:'tif' put:'image/tiff'.
FileSuffixToImageReaderClassMapping isNil ifTrue:[FileSuffixToImageReaderClassMapping := Dictionary new].
FileSuffixToImageReaderClassMapping at:'jpg' put:JPEGReader.
FileSuffixToImageReaderClassMapping at:'gif' put:GIFReader.
FileSuffixToImageReaderClassMapping at:'tif' put:TIFFReader.
CharSetToFontMapping isNil ifTrue:[CharSetToFontMapping := Dictionary new].
CharSetToFontMapping at:'iso2022-jp' put:'jis'.
CharSetToFontMapping at:'euc-jp' put:'jis'.
CharSetToFontMapping at:'shift-jis' put:'jis'.
CharSetToFontMapping at:'jis7' put:'jis'.
CharSetToFontMapping at:'jis8' put:'jis'.
CharSetToFontMapping at:'iso2022-cn' put:'big5'.
CharSetToFontMapping at:'euc-cn' put:'big5'.
CharSetToFontMapping at:'hz' put:'big5'.
CharSetToFontMapping at:'gb2312' put:'gb'.
CharSetToFontMapping at:'euc-gb' put:'gb'.
CharSetToFontMapping at:'iso2022-kr' put:'ksc'.
CharSetToFontMapping at:'euc-kr' put:'ksc'.
"
self initialize
"
"Modified: 30.6.1997 / 21:58:47 / cg"
! !
!MIMETypes class methodsFor:'accessing'!
defineImageType:mimeType suffix:aSuffix reader:aReaderClass
"register an image reader."
aSuffix notNil ifTrue:[
self imageReaderForSuffix:aSuffix put:aReaderClass.
].
mimeType notNil ifTrue:[
self imageReaderForType:mimeType put:aReaderClass
].
(aSuffix notNil and:[mimeType notNil]) ifTrue:[
self mimeTypeForSuffix:aSuffix put:mimeType
].
!
fileSuffixToImageReaderMapping
^ FileSuffixToImageReaderClassMapping ? #()
"Modified: 30.6.1997 / 22:06:11 / cg"
!
fontForCharset:aCharSet
^ CharSetToFontMapping at:aCharSet ifAbsent:nil
"
MIMETypes fontForCharset:'iso2022-jp'
MIMETypes fontForCharset:'euc-jp'
"
"Modified: 30.6.1997 / 23:26:30 / cg"
!
imageFileSuffixes
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
^ FileSuffixToImageReaderClassMapping keys
"Modified: 30.6.1997 / 21:51:39 / cg"
"Created: 30.6.1997 / 22:04:48 / cg"
!
imageReaderClasses
|setOfClasses|
setOfClasses := IdentitySet new.
FileSuffixToImageReaderClassMapping notNil ifTrue:[
FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
setOfClasses add:cls
].
].
TypeToImageReaderClassMapping notNil ifTrue:[
TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
setOfClasses add:cls
].
].
^ setOfClasses
"Modified: 30.6.1997 / 21:51:39 / cg"
"Created: 30.6.1997 / 22:03:42 / cg"
!
imageReaderForSuffix:aSuffix
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ nil].
^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil
"Modified: 30.6.1997 / 21:51:39 / cg"
"Created: 30.6.1997 / 21:59:11 / cg"
!
imageReaderForSuffix:aSuffix put:aReaderClass
FileSuffixToImageReaderClassMapping isNil ifTrue:[
FileSuffixToImageReaderClassMapping := Dictionary new.
].
FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass
"Modified: 30.6.1997 / 21:51:44 / cg"
"Created: 30.6.1997 / 21:59:43 / cg"
!
imageReaderForType:mimeTypeString
TypeToImageReaderClassMapping isNil ifTrue:[^ nil].
^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil
"Modified: 30.6.1997 / 21:51:39 / cg"
"Created: 30.6.1997 / 21:56:01 / cg"
!
imageReaderForType:mimeTypeString put:aReaderClass
TypeToImageReaderClassMapping isNil ifTrue:[
TypeToImageReaderClassMapping := Dictionary new.
].
TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass
"Modified: 30.6.1997 / 21:51:44 / cg"
"Created: 30.6.1997 / 21:56:11 / cg"
!
mimeTypeForSuffix:suffix
^ FileSuffixToTypeMapping at:suffix asLowercase ifAbsent:nil
"Created: 30.6.1997 / 21:55:51 / cg"
"Modified: 30.6.1997 / 21:58:13 / cg"
!
mimeTypeForSuffix:suffix put:mimeType
FileSuffixToTypeMapping isNil ifTrue:[
FileSuffixToTypeMapping := Dictionary new
].
FileSuffixToTypeMapping at:suffix put:mimeType asLowercase
"Created: 30.6.1997 / 21:56:20 / cg"
"Modified: 30.6.1997 / 21:58:19 / cg"
! !
!MIMETypes class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.5 1997-06-30 21:26:36 cg Exp $'
! !
MIMETypes initialize!