Line data Source code
1 : // Snap Websites Servers -- check the MIME type of a file using the magic database
2 : // Copyright (c) 2013-2019 Made to Order Software Corp. All Rights Reserved
3 : //
4 : // This program is free software; you can redistribute it and/or modify
5 : // it under the terms of the GNU General Public License as published by
6 : // the Free Software Foundation; either version 2 of the License, or
7 : // (at your option) any later version.
8 : //
9 : // This program is distributed in the hope that it will be useful,
10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : // GNU General Public License for more details.
13 : //
14 : // You should have received a copy of the GNU General Public License
15 : // along with this program; if not, write to the Free Software
16 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 : #pragma once
18 :
19 : #include "snapwebsites/snap_exception.h"
20 :
21 : namespace snap
22 : {
23 :
24 0 : class snap_magic_exception : public snap_exception
25 : {
26 : public:
27 0 : explicit snap_magic_exception(char const * whatmsg) : snap_exception("snap_magic", whatmsg) {}
28 : explicit snap_magic_exception(std::string const & whatmsg) : snap_exception("snap_magic", whatmsg) {}
29 : explicit snap_magic_exception(QString const & whatmsg) : snap_exception("snap_magic", whatmsg) {}
30 : };
31 :
32 0 : class snap_magic_exception_no_magic : public snap_magic_exception
33 : {
34 : public:
35 0 : explicit snap_magic_exception_no_magic(char const * whatmsg) : snap_magic_exception(whatmsg) {}
36 : explicit snap_magic_exception_no_magic(std::string const & whatmsg) : snap_magic_exception(whatmsg) {}
37 : explicit snap_magic_exception_no_magic(QString const & whatmsg) : snap_magic_exception(whatmsg) {}
38 : };
39 :
40 : // the actual function that generates a MIME type from a byte array
41 : QString get_mime_type(const QByteArray & data);
42 :
43 : }
44 : // vim: ts=4 sw=4 et
|