MIMETypes.st
changeset 1021 004c324dc31a
parent 713 548898fdd1dc
child 1022 bd0b1d58acba
--- a/MIMETypes.st	Fri Jul 31 23:03:36 1998 +0200
+++ b/MIMETypes.st	Sat Aug 01 17:05:00 1998 +0200
@@ -43,6 +43,12 @@
     just a place to keep MIME information
     (avoid spreading things at many places)
 
+    MIMETypes is abstract and functional.
+    Actually, in some OperatingSystems, this information may
+    be found in some config files (or registries).
+    Therefore, this class may have to be extended to support this
+    and fetch the information from there eventually.
+
     [author:]
         Claus Gittinger
 "
@@ -129,106 +135,126 @@
 !
 
 fileSuffixToImageReaderMapping
+    "return the suffix-to-imageReader mapping"
+
     ^ FileSuffixToImageReaderClassMapping ? #()
 
-    "Modified: 30.6.1997 / 22:06:11 / cg"
+    "Modified: / 1.8.1998 / 17:00:11 / cg"
 !
 
 fontForCharset:aCharSet
+    "return the font-encoding for an iso-charset"
+
     ^ CharSetToFontMapping at:aCharSet ifAbsent:nil
 
     "
-     MIMETypes fontForCharset:'iso2022-jp'
+     MIMETypes fontForCharset:'iso2022-jp'       
      MIMETypes fontForCharset:'euc-jp'     
     "
 
-    "Modified: 30.6.1997 / 23:26:30 / cg"
+    "Modified: / 1.8.1998 / 17:00:57 / cg"
 !
 
 imageFileSuffixes
+    "return a collection with known file suffixes"
+
     FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
     ^ FileSuffixToImageReaderClassMapping keys
 
-    "Modified: 30.6.1997 / 21:51:39 / cg"
-    "Created: 30.6.1997 / 22:04:48 / cg"
+    "Created: / 30.6.1997 / 22:04:48 / cg"
+    "Modified: / 1.8.1998 / 17:01:26 / cg"
 !
 
 imageReaderClasses
+    "return a collection of registered image reader classes"
+
     |setOfClasses|
 
     setOfClasses := IdentitySet new.
     FileSuffixToImageReaderClassMapping notNil ifTrue:[
         FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
-	    setOfClasses add:cls
-	].
+            setOfClasses add:cls
+        ].
     ].
     TypeToImageReaderClassMapping notNil ifTrue:[
         TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
-	    setOfClasses add:cls
-	].
+            setOfClasses add:cls
+        ].
     ].
     ^ setOfClasses
 
-    "Modified: 30.6.1997 / 21:51:39 / cg"
-    "Created: 30.6.1997 / 22:03:42 / cg"
+    "Created: / 30.6.1997 / 22:03:42 / cg"
+    "Modified: / 1.8.1998 / 16:59:52 / cg"
 !
 
 imageReaderForSuffix:aSuffix
+    "given a file suffix, return an approriate image reader class"
+
     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"
+    "Created: / 30.6.1997 / 21:59:11 / cg"
+    "Modified: / 1.8.1998 / 17:01:58 / cg"
 !
 
 imageReaderForSuffix:aSuffix put:aReaderClass
+    "register an image reader for a file suffix"
+
     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"
+    "Created: / 30.6.1997 / 21:59:43 / cg"
+    "Modified: / 1.8.1998 / 17:02:14 / cg"
 !
 
 imageReaderForType:mimeTypeString
+    "given a mime-type, return an approriate image reader class"
+
     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"
+    "Created: / 30.6.1997 / 21:56:01 / cg"
+    "Modified: / 1.8.1998 / 17:02:28 / cg"
 !
 
 imageReaderForType:mimeTypeString put:aReaderClass
+    "register an image reader for a mime-type"
+
     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"
+    "Created: / 30.6.1997 / 21:56:11 / cg"
+    "Modified: / 1.8.1998 / 17:02:40 / cg"
 !
 
 mimeTypeForSuffix:suffix
+    "given a file suffix, return the mime-type"
+
     ^ FileSuffixToTypeMapping at:suffix asLowercase ifAbsent:nil
 
-    "Created: 30.6.1997 / 21:55:51 / cg"
-    "Modified: 30.6.1997 / 21:58:13 / cg"
+    "Created: / 30.6.1997 / 21:55:51 / cg"
+    "Modified: / 1.8.1998 / 17:02:59 / cg"
 !
 
 mimeTypeForSuffix:suffix put:mimeType
+    "register a mime type for a file suffix"
+
     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"
+    "Created: / 30.6.1997 / 21:56:20 / cg"
+    "Modified: / 1.8.1998 / 17:03:18 / cg"
 ! !
 
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.10 1997-10-21 18:26:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.11 1998-08-01 15:05:00 cg Exp $'
 ! !
 MIMETypes initialize!