• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

MIMETypeRegistryQt.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
00003  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
00004  * Copyright (C) 2007 Trolltech ASA
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00016  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00018  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00019  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00020  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00021  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00022  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00023  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 #include "config.h"
00029 #include "MIMETypeRegistry.h"
00030 
00031 namespace WebCore {
00032 
00033 struct ExtensionMap {
00034     const char* extension;
00035     const char* mimeType;
00036 };
00037 
00038 static const ExtensionMap extensionMap [] = {
00039     { "bmp", "image/bmp" },
00040     { "gif", "image/gif" },
00041     { "html", "text/html" },
00042     { "htm", "text/html" },
00043     { "ico", "image/x-icon" },
00044     { "jpeg", "image/jpeg" },
00045     { "jpg", "image/jpeg" },
00046     { "js", "application/x-javascript" },
00047     { "mng", "video/x-mng" },
00048     { "pbm", "image/x-portable-bitmap" },
00049     { "pgm", "image/x-portable-graymap" },
00050     { "pdf", "application/pdf" },
00051     { "png", "image/png" },
00052     { "ppm", "image/x-portable-pixmap" },
00053     { "rss", "application/rss+xml" },
00054     { "svg", "image/svg+xml" },
00055     { "text", "text/plain" },
00056     { "tif", "image/tiff" },
00057     { "tiff", "image/tiff" },
00058     { "txt", "text/plain" },
00059     { "xbm", "image/x-xbitmap" },
00060     { "xml", "text/xml" },
00061     { "xpm", "image/x-xpm" },
00062     { "xsl", "text/xsl" },
00063     { "xhtml", "application/xhtml+xml" },
00064     { 0, 0 }
00065 };
00066 
00067 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
00068 {
00069     String s = ext.lower();
00070 
00071     const ExtensionMap *e = extensionMap;
00072     while (e->extension) {
00073         if (s == e->extension)
00074             return e->mimeType;
00075         ++e;
00076     }
00077 
00078     return "application/octet-stream";
00079 }
00080 
00081 }

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal