mimetype.h

00001 /*
00002  * mimetype.h
00003  * This file is part of dbPager Classes Library (DCL)
00004  *
00005  * Copyright (c) 2008-2009 Dennis Prochko <wolfsoft@mail.ru>
00006  *
00007  * DCL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation version 3.
00010  *
00011  * DCL is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with DCL; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  * Boston, MA  02110-1301  USA
00020  */
00021 
00022 #ifndef _MIMETYPE_H_
00023 #define _MIMETYPE_H_
00024 
00025 #include <map>
00026 #include <string>
00027 
00028 namespace dbp {
00029 
00031 
00034 class mimetype {
00035 public:
00037         mimetype();
00039 
00045         void register_type(const std::string &ext, const std::string &mime_type);
00047 
00053         const std::string& operator()(const std::string& filename) const;
00054 private:
00055         typedef std::map<std::string, std::string> mime_types;
00056         mime_types mime;
00057         std::string default_type;
00058         void load_from_file(const std::string &filename);
00059 };
00060 
00061 }
00062 
00063 #endif /*_MIMETYPE_H_*/

 
Support This Project
SourceForge.net Logo