00001 00002 /*************************************************************************** 00003 * filetype.h - little utility to decide on filetype, this FireVision 00004 * version can also detect FvRaw images. 00005 * 00006 * Generated: Tue Feb 23 13:49:38 2005 00007 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de] 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. A runtime exception applies to 00015 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00023 */ 00024 00025 #ifndef __FIREVISION_FVUTILS_FILETYPE_H_ 00026 #define __FIREVISION_FVUTILS_FILETYPE_H_ 00027 00028 #include <utils/system/filetype.h> 00029 #include <fvutils/readers/fvraw.h> 00030 #include <fvutils/colormap/cmfile.h> 00031 #include <string> 00032 00033 namespace firevision { 00034 #if 0 /* just to make Emacs auto-indent happy */ 00035 } 00036 #endif 00037 00038 inline std::string 00039 fv_filetype_file(const char *filename) 00040 { 00041 std::string rv = fawkes::filetype_file(filename); 00042 00043 if ( rv == "data" ) { 00044 if ( FvRawReader::is_FvRaw(filename) ) { 00045 rv = "FvRaw"; 00046 } else if ( ColormapFile::is_colormap_file(filename) ) { 00047 rv = "FvColormap"; 00048 } 00049 } 00050 00051 return rv; 00052 } 00053 00054 } // end namespace firevision 00055 00056 00057 #endif