| OLD | NEW | 
| (Empty) |  | 
 |   1 #include "ContentType.h" | 
 |   2  | 
 |   3 // Based on impl from libadblockplus | 
 |   4  | 
 |   5 using AdblockPlus::FilterEngine; | 
 |   6  | 
 |   7 namespace | 
 |   8 { | 
 |   9   typedef std::map<FilterEngine::ContentType, std::string> ContentTypeMap; | 
 |  10   ContentTypeMap CreateContentTypeMap() | 
 |  11   { | 
 |  12     ContentTypeMap contentTypes; | 
 |  13     contentTypes[FilterEngine::CONTENT_TYPE_OTHER] = "OTHER"; | 
 |  14     contentTypes[FilterEngine::CONTENT_TYPE_SCRIPT] = "SCRIPT"; | 
 |  15     contentTypes[FilterEngine::CONTENT_TYPE_IMAGE] = "IMAGE"; | 
 |  16     contentTypes[FilterEngine::CONTENT_TYPE_STYLESHEET] = "STYLESHEET"; | 
 |  17     contentTypes[FilterEngine::CONTENT_TYPE_OBJECT] = "OBJECT"; | 
 |  18     contentTypes[FilterEngine::CONTENT_TYPE_SUBDOCUMENT] = "SUBDOCUMENT"; | 
 |  19     contentTypes[FilterEngine::CONTENT_TYPE_DOCUMENT] = "DOCUMENT"; | 
 |  20     contentTypes[FilterEngine::CONTENT_TYPE_XMLHTTPREQUEST] = "XMLHTTPREQUEST"; | 
 |  21     contentTypes[FilterEngine::CONTENT_TYPE_OBJECT_SUBREQUEST] = "OBJECT_SUBREQU
    EST"; | 
 |  22     contentTypes[FilterEngine::CONTENT_TYPE_FONT] = "FONT"; | 
 |  23     contentTypes[FilterEngine::CONTENT_TYPE_MEDIA] = "MEDIA"; | 
 |  24     contentTypes[FilterEngine::CONTENT_TYPE_ELEMHIDE] = "ELEMHIDE"; | 
 |  25     return contentTypes; | 
 |  26   } | 
 |  27   const ContentTypeMap g_contentTypes = CreateContentTypeMap(); | 
 |  28 } | 
 |  29  | 
 |  30 std::string ContentTypeToString(AdblockPlus::FilterEngine::ContentType contentTy
    pe) | 
 |  31 { | 
 |  32   ContentTypeMap::const_iterator it = g_contentTypes.find(contentType); | 
 |  33   if (it != g_contentTypes.end()) | 
 |  34     return it->second; | 
 |  35   throw std::invalid_argument("Argument is not a valid ContentType"); | 
 |  36 } | 
| OLD | NEW |