Over time you’ll undoubtedly accumulate quite a lot of includes you’ll want to share between projects as well as code from other PureBasic forum members ( which unlike Xojo tend to be contributed free and open source ) so what I have is a folder where I store these and then include them like this:
#INCLUDES$ = "/home/steve/Projects/Purebasic/Includes/"
XIncludeFile #INCLUDES$ + "MimeTypesVT.pbi"
Below is a code snippet that uses a Structure, Interface and VTable to create an object. Although it’s a long snippet most of it is just adding mime types to a hash map, the code you need to digest to grasp the concept of creating an object in PureBasic is < 70 lines:
EnableExplicit
Structure MimeTypesStructure
vtable.i
mtmutex.i
Map mimetypes.s()
EndStructure
Interface MimeTypesInterface
Add(ext$, val$)
Free()
Get.s(ext$)
EndInterface
Procedure _mime_types_add(*this.MimeTypesStructure, ext$, val$)
LockMutex(*this\mtmutex)
If FindMapElement(*this\mimetypes(), ext$)
; already defined ...
Else
AddMapElement(*this\mimetypes(), ext$)
*this\mimetypes() = val$
EndIf
UnlockMutex(*this\mtmutex)
EndProcedure
Procedure _mime_types_free(*this.MimeTypesStructure)
LockMutex(*this\mtmutex)
ClearMap(*this\mimetypes())
UnlockMutex(*this\mtmutex)
FreeStructure(*this)
EndProcedure
Procedure.s _mime_types_get(*this.MimeTypesStructure, ext$)
Define.s findval = LCase(ReplaceString(ext$, ".", ""))
Define.s returnval = "application/octet-stream"
LockMutex(*this\mtmutex)
If FindMapElement(*this\mimetypes(), findval)
returnval = *this\mimetypes()
EndIf
UnlockMutex(*this\mtmutex)
ProcedureReturn returnval
EndProcedure
Procedure MimeTypes_New()
Protected *this.MimeTypesStructure = AllocateStructure(MimeTypesStructure)
If *this = 0
ProcedureReturn #False
EndIf
*this\vtable = ?_VT_MIMETYPES_
*this\mtmutex = CreateMutex()
_mime_types_add(*this, "3dm", "x-world/x-3dmf")
_mime_types_add(*this, "3dmf", "x-world/x-3dmf")
_mime_types_add(*this, "7z", "application/x-7z-compressed")
_mime_types_add(*this, "a", "application/octet-stream")
_mime_types_add(*this, "aab", "application/x-authorware-bin")
_mime_types_add(*this, "aam", "application/x-authorware-map")
_mime_types_add(*this, "aas", "application/x-authorware-seg")
_mime_types_add(*this, "abc", "text/vndabc")
_mime_types_add(*this, "acgi", "text/html")
_mime_types_add(*this, "afl", "video/animaflex")
_mime_types_add(*this, "ai", "application/postscript")
_mime_types_add(*this, "aif", "audio/aiff")
_mime_types_add(*this, "aifc", "audio/aiff")
_mime_types_add(*this, "aiff", "audio/aiff")
_mime_types_add(*this, "aim", "application/x-aim")
_mime_types_add(*this, "aip", "text/x-audiosoft-intra")
_mime_types_add(*this, "ani", "application/x-navi-animation")
_mime_types_add(*this, "aos", "application/x-nokia-9000-communicator-add-on-software")
_mime_types_add(*this, "aps", "application/mime")
_mime_types_add(*this, "arc", "application/octet-stream")
_mime_types_add(*this, "arj", "application/arj")
_mime_types_add(*this, "art", "image/x-jg")
_mime_types_add(*this, "asf", "video/x-ms-asf")
_mime_types_add(*this, "asm", "text/x-asm")
_mime_types_add(*this, "asp", "text/asp")
_mime_types_add(*this, "asx", "application/x-mplayer2")
_mime_types_add(*this, "au", "audio/basic")
_mime_types_add(*this, "avi", "application/x-troff-msvideo")
_mime_types_add(*this, "avs", "video/avs-video")
_mime_types_add(*this, "bcpio", "application/x-bcpio")
_mime_types_add(*this, "bin", "application/mac-binary")
_mime_types_add(*this, "bm", "image/bmp")
_mime_types_add(*this, "bmp", "image/bmp")
_mime_types_add(*this, "boo", "application/book")
_mime_types_add(*this, "book", "application/book")
_mime_types_add(*this, "boz", "application/x-bzip2")
_mime_types_add(*this, "bsh", "application/x-bsh")
_mime_types_add(*this, "bz", "application/x-bzip")
_mime_types_add(*this, "bz2", "application/x-bzip2")
_mime_types_add(*this, "c", "text/plain")
_mime_types_add(*this, "c++", "text/plain")
_mime_types_add(*this, "cat", "application/vndms-pkiseccat")
_mime_types_add(*this, "cc", "text/plain")
_mime_types_add(*this, "ccad", "application/clariscad")
_mime_types_add(*this, "cco", "application/x-cocoa")
_mime_types_add(*this, "cdf", "application/cdf")
_mime_types_add(*this, "cer", "application/pkix-cert")
_mime_types_add(*this, "cha", "application/x-chat")
_mime_types_add(*this, "chat", "application/x-chat")
_mime_types_add(*this, "class", "application/java")
_mime_types_add(*this, "com", "application/octet-stream")
_mime_types_add(*this, "conf", "text/plain")
_mime_types_add(*this, "cpio", "application/x-cpio")
_mime_types_add(*this, "cpp", "text/plain")
_mime_types_add(*this, "cpt", "application/mac-compactpro")
_mime_types_add(*this, "crl", "application/pkcs-crl")
_mime_types_add(*this, "crt", "application/pkix-cert")
_mime_types_add(*this, "csh", "application/x-csh")
_mime_types_add(*this, "css", "text/css")
_mime_types_add(*this, "csv", "text/csv")
_mime_types_add(*this, "cxx", "text/plain")
_mime_types_add(*this, "dcr", "application/x-director")
_mime_types_add(*this, "deepv", "application/x-deepv")
_mime_types_add(*this, "def", "text/plain")
_mime_types_add(*this, "der", "application/x-x509-ca-cert")
_mime_types_add(*this, "dif", "video/x-dv")
_mime_types_add(*this, "dir", "application/x-director")
_mime_types_add(*this, "dl", "video/dl")
_mime_types_add(*this, "doc", "application/msword")
_mime_types_add(*this, "docx", "application/vndopenxmlformats-officedocumentwordprocessingmldocument")
_mime_types_add(*this, "dot", "application/msword")
_mime_types_add(*this, "dp", "application/commonground")
_mime_types_add(*this, "drw", "application/drafting")
_mime_types_add(*this, "dump", "application/octet-stream")
_mime_types_add(*this, "dv", "video/x-dv")
_mime_types_add(*this, "dvi", "application/x-dvi")
_mime_types_add(*this, "dwf", "drawing/x-dwf(old)")
_mime_types_add(*this, "dwg", "application/acad")
_mime_types_add(*this, "dxf", "application/dxf")
_mime_types_add(*this, "dxr", "application/x-director")
_mime_types_add(*this, "el", "text/x-scriptelisp")
_mime_types_add(*this, "elc", "application/x-bytecodeelisp(compiledelisp)")
_mime_types_add(*this, "env", "application/x-envoy")
_mime_types_add(*this, "eot", "application/vndms-fontobject")
_mime_types_add(*this, "eps", "application/postscript")
_mime_types_add(*this, "es", "application/x-esrehber")
_mime_types_add(*this, "etx", "text/x-setext")
_mime_types_add(*this, "evy", "application/envoy")
_mime_types_add(*this, "exe", "application/octet-stream")
_mime_types_add(*this, "f", "text/plain")
_mime_types_add(*this, "f77", "text/x-fortran")
_mime_types_add(*this, "f90", "text/plain")
_mime_types_add(*this, "fdf", "application/vndfdf")
_mime_types_add(*this, "fif", "application/fractals")
_mime_types_add(*this, "flac", "audio/flac")
_mime_types_add(*this, "fli", "video/fli")
_mime_types_add(*this, "flo", "image/florian")
_mime_types_add(*this, "flx", "text/vndfmiflexstor")
_mime_types_add(*this, "fmf", "video/x-atomic3d-feature")
_mime_types_add(*this, "for", "text/plain")
_mime_types_add(*this, "fpx", "image/vndfpx")
_mime_types_add(*this, "frl", "application/freeloader")
_mime_types_add(*this, "funk", "audio/make")
_mime_types_add(*this, "g", "text/plain")
_mime_types_add(*this, "g3", "image/g3fax")
_mime_types_add(*this, "gif", "image/gif")
_mime_types_add(*this, "gl", "video/gl")
_mime_types_add(*this, "gsd", "audio/x-gsm")
_mime_types_add(*this, "gsm", "audio/x-gsm")
_mime_types_add(*this, "gsp", "application/x-gsp")
_mime_types_add(*this, "gss", "application/x-gss")
_mime_types_add(*this, "gtar", "application/x-gtar")
_mime_types_add(*this, "gz", "application/x-compressed")
_mime_types_add(*this, "gzip", "application/x-gzip")
_mime_types_add(*this, "h", "text/plain")
_mime_types_add(*this, "hdf", "application/x-hdf")
_mime_types_add(*this, "help", "application/x-helpfile")
_mime_types_add(*this, "hgl", "application/vndhp-hpgl")
_mime_types_add(*this, "hh", "text/plain")
_mime_types_add(*this, "hlb", "text/x-script")
_mime_types_add(*this, "hlp", "application/hlp")
_mime_types_add(*this, "hpg", "application/vndhp-hpgl")
_mime_types_add(*this, "hpgl", "application/vndhp-hpgl")
_mime_types_add(*this, "hqx", "application/binhex")
_mime_types_add(*this, "hta", "application/hta")
_mime_types_add(*this, "htc", "text/x-component")
_mime_types_add(*this, "htm", "text/html")
_mime_types_add(*this, "html", "text/html")
_mime_types_add(*this, "htmls", "text/html")
_mime_types_add(*this, "htt", "text/webviewhtml")
_mime_types_add(*this, "htx", "text/html")
_mime_types_add(*this, "ice", "x-conference/x-cooltalk")
_mime_types_add(*this, "ico", "image/x-icon")
_mime_types_add(*this, "ics", "text/calendar")
_mime_types_add(*this, "idc", "text/plain")
_mime_types_add(*this, "ief", "image/ief")
_mime_types_add(*this, "iefs", "image/ief")
_mime_types_add(*this, "iges", "application/iges")
_mime_types_add(*this, "igs", "application/iges")
_mime_types_add(*this, "ima", "application/x-ima")
_mime_types_add(*this, "imap", "application/x-httpd-imap")
_mime_types_add(*this, "inf", "application/inf")
_mime_types_add(*this, "ins", "application/x-internett-signup")
_mime_types_add(*this, "ip", "application/x-ip2")
_mime_types_add(*this, "isu", "video/x-isvideo")
_mime_types_add(*this, "it", "audio/it")
_mime_types_add(*this, "iv", "application/x-inventor")
_mime_types_add(*this, "ivr", "i-world/i-vrml")
_mime_types_add(*this, "ivy", "application/x-livescreen")
_mime_types_add(*this, "jam", "audio/x-jam")
_mime_types_add(*this, "jav", "text/plain")
_mime_types_add(*this, "java", "text/plain")
_mime_types_add(*this, "jcm", "application/x-java-commerce")
_mime_types_add(*this, "jfif", "image/jpeg")
_mime_types_add(*this, "jfif-tbnl", "image/jpeg")
_mime_types_add(*this, "jpe", "image/jpeg")
_mime_types_add(*this, "jpeg", "image/jpeg")
_mime_types_add(*this, "jpg", "image/jpeg")
_mime_types_add(*this, "jps", "image/x-jps")
_mime_types_add(*this, "js", "application/x-javascript")
_mime_types_add(*this, "json", "application/json")
_mime_types_add(*this, "jut", "image/jutvision")
_mime_types_add(*this, "kar", "audio/midi")
_mime_types_add(*this, "ksh", "application/x-ksh")
_mime_types_add(*this, "la", "audio/nspaudio")
_mime_types_add(*this, "lam", "audio/x-liveaudio")
_mime_types_add(*this, "latex", "application/x-latex")
_mime_types_add(*this, "lha", "application/lha")
_mime_types_add(*this, "lhx", "application/octet-stream")
_mime_types_add(*this, "list", "text/plain")
_mime_types_add(*this, "lma", "audio/nspaudio")
_mime_types_add(*this, "log", "text/plain")
_mime_types_add(*this, "lsp", "application/x-lisp")
_mime_types_add(*this, "lst", "text/plain")
_mime_types_add(*this, "lsx", "text/x-la-asf")
_mime_types_add(*this, "ltx", "application/x-latex")
_mime_types_add(*this, "lzh", "application/octet-stream")
_mime_types_add(*this, "lzx", "application/lzx")
_mime_types_add(*this, "m", "text/plain")
_mime_types_add(*this, "m1v", "video/mpeg")
_mime_types_add(*this, "m2a", "audio/mpeg")
_mime_types_add(*this, "m2v", "video/mpeg")
_mime_types_add(*this, "m3u", "audio/x-mpequrl")
_mime_types_add(*this, "man", "application/x-troff-man")
_mime_types_add(*this, "map", "application/x-navimap")
_mime_types_add(*this, "mar", "text/plain")
_mime_types_add(*this, "mbd", "application/mbedlet")
_mime_types_add(*this, "mc$", "application/x-magic-cap-package-10")
_mime_types_add(*this, "mcd", "application/mcad")
_mime_types_add(*this, "mcf", "image/vasa")
_mime_types_add(*this, "mcp", "application/netmc")
_mime_types_add(*this, "me", "application/x-troff-me")
_mime_types_add(*this, "mht", "message/rfc822")
_mime_types_add(*this, "mhtml", "message/rfc822")
_mime_types_add(*this, "mid", "application/x-midi")
_mime_types_add(*this, "midi", "application/x-midi")
_mime_types_add(*this, "mif", "application/x-frame")
_mime_types_add(*this, "mime", "message/rfc822")
_mime_types_add(*this, "mjf", "audio/x-vndaudioexplosionmjuicemediafile")
_mime_types_add(*this, "mjpg", "video/x-motion-jpeg")
_mime_types_add(*this, "mka", "audio/x-matroska")
_mime_types_add(*this, "mkv", "video/x-matroska")
_mime_types_add(*this, "mm", "application/base64")
_mime_types_add(*this, "mme", "application/base64")
_mime_types_add(*this, "mod", "audio/mod")
_mime_types_add(*this, "moov", "video/quicktime")
_mime_types_add(*this, "mov", "video/quicktime")
_mime_types_add(*this, "movie", "video/x-sgi-movie")
_mime_types_add(*this, "mp2", "audio/mpeg")
_mime_types_add(*this, "mp3", "audio/mpeg3")
_mime_types_add(*this, "mp4", "video/mp4")
_mime_types_add(*this, "mpa", "audio/mpeg")
_mime_types_add(*this, "mpc", "application/x-project")
_mime_types_add(*this, "mpe", "video/mpeg")
_mime_types_add(*this, "mpeg", "video/mpeg")
_mime_types_add(*this, "mpg", "audio/mpeg")
_mime_types_add(*this, "mpga", "audio/mpeg")
_mime_types_add(*this, "mpp", "application/vndms-project")
_mime_types_add(*this, "mpt", "application/x-project")
_mime_types_add(*this, "mpv", "application/x-project")
_mime_types_add(*this, "mpx", "application/x-project")
_mime_types_add(*this, "mrc", "application/marc")
_mime_types_add(*this, "ms", "application/x-troff-ms")
_mime_types_add(*this, "mv", "video/x-sgi-movie")
_mime_types_add(*this, "my", "audio/make")
_mime_types_add(*this, "mzz", "application/x-vndaudioexplosionmzz")
_mime_types_add(*this, "nap", "image/naplps")
_mime_types_add(*this, "naplps", "image/naplps")
_mime_types_add(*this, "nc", "application/x-netcdf")
_mime_types_add(*this, "ncm", "application/vndnokiaconfiguration-message")
_mime_types_add(*this, "nif", "image/x-niff")
_mime_types_add(*this, "niff", "image/x-niff")
_mime_types_add(*this, "nix", "application/x-mix-transfer")
_mime_types_add(*this, "nsc", "application/x-conference")
_mime_types_add(*this, "nvd", "application/x-navidoc")
_mime_types_add(*this, "o", "application/octet-stream")
_mime_types_add(*this, "oda", "application/oda")
_mime_types_add(*this, "odt", "application/vnd.oasis.opendocument.text")
_mime_types_add(*this, "ogg", "audio/ogg")
_mime_types_add(*this, "omc", "application/x-omc")
_mime_types_add(*this, "omcd", "application/x-omcdatamaker")
_mime_types_add(*this, "omcr", "application/x-omcregerator")
_mime_types_add(*this, "otf", "font/otf")
_mime_types_add(*this, "p", "text/x-pascal")
_mime_types_add(*this, "p10", "application/pkcs10")
_mime_types_add(*this, "p12", "application/pkcs-12")
_mime_types_add(*this, "p7a", "application/x-pkcs7-signature")
_mime_types_add(*this, "p7c", "application/pkcs7-mime")
_mime_types_add(*this, "p7m", "application/pkcs7-mime")
_mime_types_add(*this, "p7r", "application/x-pkcs7-certreqresp")
_mime_types_add(*this, "p7s", "application/pkcs7-signature")
_mime_types_add(*this, "part", "application/pro_eng")
_mime_types_add(*this, "pas", "text/pascal")
_mime_types_add(*this, "pbm", "image/x-portable-bitmap")
_mime_types_add(*this, "pcl", "application/vndhp-pcl")
_mime_types_add(*this, "pct", "image/x-pict")
_mime_types_add(*this, "pcx", "image/x-pcx")
_mime_types_add(*this, "pdb", "chemical/x-pdb")
_mime_types_add(*this, "pdf", "application/pdf")
_mime_types_add(*this, "pfunk", "audio/make")
_mime_types_add(*this, "pgm", "image/x-portable-graymap")
_mime_types_add(*this, "pgm", "application/x-httpd-php")
_mime_types_add(*this, "pic", "image/pict")
_mime_types_add(*this, "pict", "image/pict")
_mime_types_add(*this, "pkg", "application/x-newton-compatible-pkg")
_mime_types_add(*this, "pko", "application/vndms-pkipko")
_mime_types_add(*this, "pl", "text/plain")
_mime_types_add(*this, "plx", "application/x-pixclscript")
_mime_types_add(*this, "pm", "image/x-xpixmap")
_mime_types_add(*this, "pm4", "application/x-pagemaker")
_mime_types_add(*this, "pm5", "application/x-pagemaker")
_mime_types_add(*this, "png", "image/png")
_mime_types_add(*this, "pnm", "application/x-portable-anymap")
_mime_types_add(*this, "pot", "application/mspowerpoint")
_mime_types_add(*this, "pov", "model/x-pov")
_mime_types_add(*this, "ppa", "application/vndms-powerpoint")
_mime_types_add(*this, "ppm", "image/x-portable-pixmap")
_mime_types_add(*this, "pps", "application/mspowerpoint")
_mime_types_add(*this, "ppt", "application/mspowerpoint")
_mime_types_add(*this, "pptx", "application/vndopenxmlformats-officedocumentpresentationmlpresentation")
_mime_types_add(*this, "ppz", "application/mspowerpoint")
_mime_types_add(*this, "pre", "application/x-freelance")
_mime_types_add(*this, "prt", "application/pro_eng")
_mime_types_add(*this, "ps", "application/postscript")
_mime_types_add(*this, "psd", "application/octet-stream")
_mime_types_add(*this, "pvu", "paleovu/x-pv")
_mime_types_add(*this, "pwz", "application/vndms-powerpoint")
_mime_types_add(*this, "py", "text/x-scriptphyton")
_mime_types_add(*this, "pyc", "application/x-bytecodepython")
_mime_types_add(*this, "qcp", "audio/vndqcelp")
_mime_types_add(*this, "qd3", "x-world/x-3dmf")
_mime_types_add(*this, "qd3d", "x-world/x-3dmf")
_mime_types_add(*this, "qif", "image/x-quicktime")
_mime_types_add(*this, "qt", "video/quicktime")
_mime_types_add(*this, "qtc", "video/x-qtc")
_mime_types_add(*this, "qti", "image/x-quicktime")
_mime_types_add(*this, "qtif", "image/x-quicktime")
_mime_types_add(*this, "ra", "audio/x-pn-realaudio")
_mime_types_add(*this, "ram", "audio/x-pn-realaudio")
_mime_types_add(*this, "ras", "application/x-cmu-raster")
_mime_types_add(*this, "rast", "image/cmu-raster")
_mime_types_add(*this, "rar", "application/vndrar")
_mime_types_add(*this, "rexx", "text/x-scriptrexx")
_mime_types_add(*this, "rf", "image/vndrn-realflash")
_mime_types_add(*this, "rgb", "image/x-rgb")
_mime_types_add(*this, "rm", "application/vndrn-realmedia")
_mime_types_add(*this, "rmi", "audio/mid")
_mime_types_add(*this, "rmm", "audio/x-pn-realaudio")
_mime_types_add(*this, "rmp", "audio/x-pn-realaudio")
_mime_types_add(*this, "rng", "application/ringing-tones")
_mime_types_add(*this, "rnx", "application/vndrn-realplayer")
_mime_types_add(*this, "roff", "application/x-troff")
_mime_types_add(*this, "rp", "image/vndrn-realpix")
_mime_types_add(*this, "rpm", "audio/x-pn-realaudio-plugin")
_mime_types_add(*this, "rt", "text/richtext")
_mime_types_add(*this, "rtf", "application/rtf")
_mime_types_add(*this, "rtx", "application/rtf")
_mime_types_add(*this, "rv", "video/vndrn-realvideo")
_mime_types_add(*this, "s", "text/x-asm")
_mime_types_add(*this, "s3m", "audio/s3m")
_mime_types_add(*this, "saveme", "application/octet-stream")
_mime_types_add(*this, "sbk", "application/x-tbook")
_mime_types_add(*this, "scm", "application/x-lotusscreencam")
_mime_types_add(*this, "sdml", "text/plain")
_mime_types_add(*this, "sdp", "application/sdp")
_mime_types_add(*this, "sdr", "application/sounder")
_mime_types_add(*this, "sea", "application/sea")
_mime_types_add(*this, "set", "application/set")
_mime_types_add(*this, "sgm", "text/sgml")
_mime_types_add(*this, "sgml", "text/sgml")
_mime_types_add(*this, "sh", "application/x-bsh")
_mime_types_add(*this, "shar", "application/x-bsh")
_mime_types_add(*this, "shtml", "text/html")
_mime_types_add(*this, "sid", "audio/x-psid")
_mime_types_add(*this, "sit", "application/x-sit")
_mime_types_add(*this, "skd", "application/x-koan")
_mime_types_add(*this, "skm", "application/x-koan")
_mime_types_add(*this, "skp", "application/x-koan")
_mime_types_add(*this, "skt", "application/x-koan")
_mime_types_add(*this, "sl", "application/x-seelogo")
_mime_types_add(*this, "smi", "application/smil")
_mime_types_add(*this, "smil", "application/smil")
_mime_types_add(*this, "snd", "audio/basic")
_mime_types_add(*this, "sol", "application/solids")
_mime_types_add(*this, "spc", "application/x-pkcs7-certificates")
_mime_types_add(*this, "spl", "application/futuresplash")
_mime_types_add(*this, "spr", "application/x-sprite")
_mime_types_add(*this, "sprite", "application/x-sprite")
_mime_types_add(*this, "src", "application/x-wais-source")
_mime_types_add(*this, "ssi", "text/x-server-parsed-html")
_mime_types_add(*this, "ssm", "application/streamingmedia")
_mime_types_add(*this, "sst", "application/vndms-pkicertstore")
_mime_types_add(*this, "step", "application/step")
_mime_types_add(*this, "stl", "application/sla")
_mime_types_add(*this, "stp", "application/step")
_mime_types_add(*this, "sv4cpio", "application/x-sv4cpio")
_mime_types_add(*this, "sv4crc", "application/x-sv4crc")
_mime_types_add(*this, "svf", "image/vnddwg")
_mime_types_add(*this, "svg", "image/svg+xml")
_mime_types_add(*this, "svr", "application/x-world")
_mime_types_add(*this, "swf", "application/x-shockwave-flash")
_mime_types_add(*this, "t", "application/x-troff")
_mime_types_add(*this, "talk", "text/x-speech")
_mime_types_add(*this, "tar", "application/x-tar")
_mime_types_add(*this, "tbk", "application/toolbook")
_mime_types_add(*this, "tcl", "application/x-tcl")
_mime_types_add(*this, "tcsh", "text/x-scripttcsh")
_mime_types_add(*this, "tex", "application/x-tex")
_mime_types_add(*this, "texi", "application/x-texinfo")
_mime_types_add(*this, "texinfo", "application/x-texinfo")
_mime_types_add(*this, "text", "application/plain")
_mime_types_add(*this, "tgz", "application/gnutar")
_mime_types_add(*this, "tif", "image/tiff")
_mime_types_add(*this, "tiff", "image/tiff")
_mime_types_add(*this, "tr", "application/x-troff")
_mime_types_add(*this, "ts", "video/mp2t")
_mime_types_add(*this, "tsi", "audio/tsp-audio")
_mime_types_add(*this, "tsp", "application/dsptype")
_mime_types_add(*this, "tsv", "text/tab-separated-values")
_mime_types_add(*this, "turbot", "image/florian")
_mime_types_add(*this, "txt", "text/plain")
_mime_types_add(*this, "uil", "text/x-uil")
_mime_types_add(*this, "uni", "text/uri-list")
_mime_types_add(*this, "unis", "text/uri-list")
_mime_types_add(*this, "unv", "application/i-deas")
_mime_types_add(*this, "uri", "text/uri-list")
_mime_types_add(*this, "uris", "text/uri-list")
_mime_types_add(*this, "ustar", "application/x-ustar")
_mime_types_add(*this, "uu", "application/octet-stream")
_mime_types_add(*this, "uue", "text/x-uuencode")
_mime_types_add(*this, "vcd", "application/x-cdlink")
_mime_types_add(*this, "vcs", "text/x-vcalendar")
_mime_types_add(*this, "vda", "application/vda")
_mime_types_add(*this, "vdo", "video/vdo")
_mime_types_add(*this, "vew", "application/groupwise")
_mime_types_add(*this, "viv", "video/vivo")
_mime_types_add(*this, "vivo", "video/vivo")
_mime_types_add(*this, "vmd", "application/vocaltec-media-desc")
_mime_types_add(*this, "vmf", "application/vocaltec-media-file")
_mime_types_add(*this, "voc", "audio/voc")
_mime_types_add(*this, "vos", "video/vosaic")
_mime_types_add(*this, "vox", "audio/voxware")
_mime_types_add(*this, "vqe", "audio/x-twinvq-plugin")
_mime_types_add(*this, "vqf", "audio/x-twinvq")
_mime_types_add(*this, "vql", "audio/x-twinvq-plugin")
_mime_types_add(*this, "vrml", "application/x-vrml")
_mime_types_add(*this, "vrt", "x-world/x-vrt")
_mime_types_add(*this, "vsd", "application/x-visio")
_mime_types_add(*this, "vst", "application/x-visio")
_mime_types_add(*this, "vsw", "application/x-visio")
_mime_types_add(*this, "w60", "application/wordperfect60")
_mime_types_add(*this, "w61", "application/wordperfect61")
_mime_types_add(*this, "w6w", "application/msword")
_mime_types_add(*this, "wav", "audio/wav")
_mime_types_add(*this, "wb1", "application/x-qpro")
_mime_types_add(*this, "wbmp", "image/vndwapwbmp")
_mime_types_add(*this, "web", "application/vndxara")
_mime_types_add(*this, "webm", "video/webm")
_mime_types_add(*this, "webp", "image/webp")
_mime_types_add(*this, "wiz", "application/msword")
_mime_types_add(*this, "wk1", "application/x-123")
_mime_types_add(*this, "wmf", "windows/metafile")
_mime_types_add(*this, "wml", "text/vndwapwml")
_mime_types_add(*this, "wmlc", "application/vndwapwmlc")
_mime_types_add(*this, "wmls", "text/vndwapwmlscript")
_mime_types_add(*this, "wmlsc", "application/vndwapwmlscriptc")
_mime_types_add(*this, "word", "application/msword")
_mime_types_add(*this, "woff", "font/woff")
_mime_types_add(*this, "woff2", "font/woff2")
_mime_types_add(*this, "wp", "application/wordperfect")
_mime_types_add(*this, "wp5", "application/wordperfect")
_mime_types_add(*this, "wp6", "application/wordperfect")
_mime_types_add(*this, "wpd", "application/wordperfect")
_mime_types_add(*this, "wq1", "application/x-lotus")
_mime_types_add(*this, "wri", "application/mswrite")
_mime_types_add(*this, "wrl", "application/x-world")
_mime_types_add(*this, "wrz", "model/vrml")
_mime_types_add(*this, "wsc", "text/scriplet")
_mime_types_add(*this, "wsrc", "application/x-wais-source")
_mime_types_add(*this, "wtk", "application/x-wintalk")
_mime_types_add(*this, "xbm", "image/x-xbitmap")
_mime_types_add(*this, "xdr", "video/x-amt-demorun")
_mime_types_add(*this, "xgz", "xgl/drawing")
_mime_types_add(*this, "xif", "image/vndxiff")
_mime_types_add(*this, "xl", "application/excel")
_mime_types_add(*this, "xla", "application/excel")
_mime_types_add(*this, "xlb", "application/excel")
_mime_types_add(*this, "xlc", "application/excel")
_mime_types_add(*this, "xld", "application/excel")
_mime_types_add(*this, "xlk", "application/excel")
_mime_types_add(*this, "xll", "application/excel")
_mime_types_add(*this, "xlm", "application/excel")
_mime_types_add(*this, "xls", "application/excel")
_mime_types_add(*this, "xlt", "application/excel")
_mime_types_add(*this, "xlv", "application/excel")
_mime_types_add(*this, "xlw", "application/excel")
_mime_types_add(*this, "xm", "audio/xm")
_mime_types_add(*this, "xml", "application/xml")
_mime_types_add(*this, "xmz", "xgl/movie")
_mime_types_add(*this, "xpix", "application/x-vndls-xpix")
_mime_types_add(*this, "xpm", "image/x-xpixmap")
_mime_types_add(*this, "x-png", "image/png")
_mime_types_add(*this, "xlsx", "application/vndopenxmlformats-officedocumentspreadsheetmlsheet")
_mime_types_add(*this, "xsr", "video/x-amt-showrun")
_mime_types_add(*this, "xwd", "image/x-xwd")
_mime_types_add(*this, "xyz", "chemical/x-pdb")
_mime_types_add(*this, "yaml", "application/x-yaml")
_mime_types_add(*this, "yml", "application/x-yaml")
_mime_types_add(*this, "z", "application/x-compress")
_mime_types_add(*this, "zip", "application/x-compressed")
_mime_types_add(*this, "zoo", "application/octet-stream")
_mime_types_add(*this, "zsh", "text/x-scriptzsh")
ProcedureReturn *this
DataSection
_VT_MIMETYPES_:
Data.i @_mime_types_add()
Data.i @_mime_types_free()
Data.i @_mime_types_get()
EndDataSection
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
Define mt.MimeTypesInterface
mt = MimeTypes_New()
ExamineDirectory(0, GetUserDirectory(#PB_Directory_Documents), "*.*")
While NextDirectoryEntry(0)
Debug DirectoryEntryName(0) + ": " + mt\Get(GetExtensionPart(DirectoryEntryName(0)))
Wend
mt\Free()
CompilerEndIf