DeSR Dependency Parser |
00001 /* 00002 ** IXE C++ Library 00003 ** ixe/conf/FileType.h 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2000 Ideare SpA. 00006 ** Copyright (c) 2000 Giuseppe Attardi (attardi@di.unipi.it). 00007 ** ---------------------------------------------------------------------- 00008 ** 00009 ** This file is part of DeSR. 00010 ** 00011 ** DeSR is free software; you can redistribute it and/or modify it 00012 ** under the terms of the GNU General Public License, version 3, 00013 ** as published by the Free Software Foundation. 00014 ** 00015 ** DeSR is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 ** GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 ** ---------------------------------------------------------------------- 00023 */ 00024 00025 #ifndef IXE_FILETYPE_H 00026 #define IXE_FILETYPE_H 00027 00028 // Settings 00029 #include "platform.h" 00030 00031 // standard 00032 #include <map> 00033 00034 // local 00035 #include "conf/conf.h" 00036 #include "PatternMap.h" 00037 00038 namespace IXE { 00039 00046 class FileType : public Var<PatternMap<char const*> > 00047 { 00048 public: 00049 FileType(char const* name) : Var<value_type>(name) { } 00050 00051 char const* operator [](value_type::key_type key) const { 00052 value_type::const_iterator const kit = value.find(key); 00053 return kit != value.end() ? kit->second : ""; 00054 } 00055 protected: 00056 00057 virtual void parseValue(char const*& line); 00058 virtual void reset() { value.clear(); } 00059 }; 00060 00061 extern FileType fileTypes; // type associated to file 00062 00069 typedef FileType MimeType; 00070 00071 extern MimeType mimeTypes; // reader type associated to mime 00072 00073 } // namespace IXE 00074 00075 #endif /* IXE_FILETYPE_H */