MIMETypes.st
changeset 643 f3bd12eb1008
child 645 97e83ab4d246
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MIMETypes.st	Mon Jun 30 22:08:32 1997 +0200
@@ -0,0 +1,147 @@
+"
+ 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'
+	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
+    TypeToImageReaderClassMapping isNil ifTrue:[TypeToImageReaderClassMapping := Dictionary new].
+    FileSuffixToTypeMapping isNil ifTrue:[FileSuffixToTypeMapping := Dictionary new].
+    FileSuffixToImageReaderClassMapping isNil ifTrue:[FileSuffixToImageReaderClassMapping := Dictionary new].
+
+    "
+     self initialize
+    "
+
+    "Modified: 30.6.1997 / 21:58:47 / cg"
+! !
+
+!MIMETypes class methodsFor:'accessing'!
+
+fileSuffixToImageReaderMapping
+    ^ FileSuffixToImageReaderClassMapping ? #()
+
+    "Modified: 30.6.1997 / 22:06:11 / cg"
+!
+
+imageFileSuffixes
+    FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
+    ^ FileSuffixToImageReaderClassMapping keys
+
+    "Modified: 30.6.1997 / 21:51:39 / cg"
+    "Created: 30.6.1997 / 22:04:48 / cg"
+!
+
+imageReaderClasses
+    FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
+    ^ FileSuffixToImageReaderClassMapping values
+
+    "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.1 1997-06-30 20:08:32 cg Exp $'
+! !
+MIMETypes initialize!