Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
filetype.h
1
2
/***************************************************************************
3
* filetype.h - little utility to decide on filetype, this FireVision
4
* version can also detect FvRaw images.
5
*
6
* Generated: Tue Feb 23 13:49:38 2005
7
* Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
8
*
9
****************************************************************************/
10
11
/* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version. A runtime exception applies to
15
* this software (see LICENSE.GPL_WRE file mentioned below for details).
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU Library General Public License for more details.
21
*
22
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23
*/
24
25
#ifndef __FIREVISION_FVUTILS_FILETYPE_H_
26
#define __FIREVISION_FVUTILS_FILETYPE_H_
27
28
#include <core/exception.h>
29
#include <utils/system/filetype.h>
30
#include <fvutils/readers/fvraw.h>
31
#include <fvutils/colormap/cmfile.h>
32
#include <string>
33
34
namespace
firevision {
35
#if 0
/* just to make Emacs auto-indent happy */
36
}
37
#endif
38
39
inline
std::string
40
fv_filetype_file(
const
char
*filename)
41
{
42
std::string rv;
43
44
try
{
45
rv =
fawkes::filetype_file
(filename);
46
}
catch
(
fawkes::Exception
&e) {
47
// Some error occured, most likely libmagic was not available at compile
48
// time, assume data to make our own checks, we just cannot detect JPG
49
// and PNG in this case.
50
rv =
"data"
;
51
}
52
53
if
( rv ==
"data"
) {
54
if
( FvRawReader::is_FvRaw(filename) ) {
55
rv =
"FvRaw"
;
56
}
else
if
( ColormapFile::is_colormap_file(filename) ) {
57
rv =
"FvColormap"
;
58
}
59
}
60
61
return
rv;
62
}
63
64
}
// end namespace firevision
65
66
67
#endif
src
libs
fvutils
system
filetype.h
Generated by
1.8.1.2