summaryrefslogtreecommitdiffstats
path: root/src/uscxml/URL.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/URL.cpp')
-rw-r--r--src/uscxml/URL.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/uscxml/URL.cpp b/src/uscxml/URL.cpp
index 1b15dee..8332c1d 100644
--- a/src/uscxml/URL.cpp
+++ b/src/uscxml/URL.cpp
@@ -56,6 +56,34 @@ std::string URL::tmpDir() {
return tmpDir;
}
+std::map<std::string, std::string> URL::mimeTypes;
+ std::string URL::getMimeType(const std::string extension, std::string magic) {
+ if (mimeTypes.empty()) {
+ mimeTypes["txt"] = "text/plain";
+ mimeTypes["c"] = "text/plain";
+ mimeTypes["h"] = "text/plain";
+ mimeTypes["html"] = "text/html";
+ mimeTypes["htm"] = "text/htm";
+ mimeTypes["css"] = "text/css";
+ mimeTypes["bmp"] = "image/bmp";
+ mimeTypes["gif"] = "image/gif";
+ mimeTypes["jpg"] = "image/jpeg";
+ mimeTypes["jpeg"] = "image/jpeg";
+ mimeTypes["mpg"] = "video/mpeg";
+ mimeTypes["mov"] = "video/quicktime";
+ mimeTypes["png"] = "image/png";
+ mimeTypes["pdf"] = "application/pdf";
+ mimeTypes["ps"] = "application/postscript";
+ mimeTypes["tif"] = "image/tiff";
+ mimeTypes["tiff"] = "image/tiff";
+ }
+
+ if (mimeTypes.find(extension) != mimeTypes.end()) {
+ return mimeTypes[extension];
+ }
+ return "";
+}
+
std::string URL::getTmpFilename(const std::string& suffix) {
std::string tmpFilename = tmpDir();