added getSuffixFromMimeType()

This commit is contained in:
dockes 2006-12-16 15:30:02 +00:00
parent feea21b250
commit 6b24b19b5f
2 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.36 2006-12-14 13:53:42 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.37 2006-12-16 15:30:02 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -230,6 +230,20 @@ string RclConfig::getMimeTypeFromSuffix(const string &suff)
return mtype;
}
string RclConfig::getSuffixFromMimeType(const string &mt)
{
string suffix;
list<string>sfs = mimemap->getNames("");
string mt1;
for (list<string>::const_iterator it = sfs.begin();
it != sfs.end(); it++) {
if (mimemap->get(*it, mt1, ""))
if (!stringicmp(mt, mt1))
return *it;
}
return "";
}
string RclConfig::getMimeHandlerDef(const std::string &mtype)
{
string hs;

View File

@ -16,7 +16,7 @@
*/
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
/* @(#$Id: rclconfig.h,v 1.27 2006-12-14 13:53:42 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rclconfig.h,v 1.28 2006-12-16 15:30:02 dockes Exp $ (C) 2004 J.F.Dockes */
#include <list>
#include <string>
@ -102,6 +102,9 @@ class RclConfig {
/** Use mimemap to compute mimetype */
string getMimeTypeFromSuffix(const string &suffix);
/** Get appropriate suffix for mime type. This is inefficient */
string getSuffixFromMimeType(const string &mt);
/** Get input filter from mimeconf for mimetype */
string getMimeHandlerDef(const string &mimetype);