initial checkin
authorpenk
Tue, 10 Sep 2002 15:50:32 +0200
changeset 1603 ce95b9188604
parent 1602 6648285d6a14
child 1604 0c678133dc4b
initial checkin
MIMEType.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MIMEType.st	Tue Sep 10 15:50:32 2002 +0200
@@ -0,0 +1,89 @@
+"{ Package: 'stx:libview2' }"
+
+MIMETypes subclass:#MIMEType
+	instanceVariableNames:'fileName mimeType'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'System-Documentation'
+!
+
+
+!MIMEType class methodsFor:'instance creation'!
+
+for:fileName
+
+    | instance |
+
+    instance := self basicNew.
+    instance fileName:fileName.
+    ^ instance.
+! !
+
+!MIMEType methodsFor:'accessing'!
+
+fileName
+    "return the value of the instance variable 'fileName' (automatically generated)"
+
+    ^ fileName
+!
+
+fileName:something
+    "set the value of the instance variable 'fileName' (automatically generated)"
+
+    fileName := something.
+!
+
+mimeType
+    "return the value of the instance variable 'mimeType' (automatically generated)"
+
+    ^ mimeType
+!
+
+mimeTypeByContents
+    "return the value of the instance variable 'mimeTypeByContents' (automatically generated)"
+
+    ^ nil
+!
+
+mimeTypeBySuffix
+    "return the value of the instance variable 'mimeType' (automatically generated)"
+
+    mimeType isNil ifTrue:[
+        mimeType := self class mimeTypeForSuffix:(self fileName suffix).
+    ].
+    ^ mimeType
+! !
+
+!MIMEType methodsFor:'queries'!
+
+isArchiv
+
+    |archivTypes|
+
+    archivTypes := self class applicationComprAndArchiveTypeList.
+    archivTypes pairWiseDo:[: ext : type |
+        type = mimeType ifTrue:[ ^ true].
+    ].
+    ^ false
+!
+
+isHtml
+
+    ^ (mimeType = 'text/html')
+!
+
+isImage
+
+    ^ (mimeType startsWith:'image')
+!
+
+isPdf
+
+    ^ (mimeType = 'application/pdf')
+! !
+
+!MIMEType class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/MIMEType.st,v 1.1 2002-09-10 13:50:32 penk Exp $'
+! !