goldendict-ng/filetype.hh

38 lines
1.3 KiB
C++
Raw Normal View History

2012-02-20 21:47:14 +00:00
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef __FILETYPE_HH_INCLUDED__
#define __FILETYPE_HH_INCLUDED__
#include <string>
/// Utilities to guess file types based on their names.
namespace Filetype {
using std::string;
2019-09-26 16:40:39 +00:00
/// Removes any trailing or leading spaces and may lowercases the string.
string simplifyString( string const & str, bool lowercase = true );
/// Returns true if the name resembles the one of a sound file (i.e. ends
/// with .wav, .ogg and such).
bool isNameOfSound( string const & );
2013-06-22 16:36:25 +00:00
/// Returns true if the name resembles the one of a video file (i.e. ends
/// with .mpg, .ogv and such).
bool isNameOfVideo( string const & );
/// Returns true if the name resembles the one of a picture file (i.e. ends
/// with .jpg, .png and such).
bool isNameOfPicture( string const & );
/// Returns true if the name resembles the one of a .tiff file (i.e. ends
/// with .tif or tiff). We have this one separately since we need to reconvert
/// TIFF files as WebKit doesn't seem to support them.
bool isNameOfTiff( string const & );
/// Returns true if the name resembles the one of a .css file
bool isNameOfCSS( string const & );
2013-05-25 12:07:49 +00:00
/// Returns true if the name resembles the one of a .svg file
bool isNameOfSvg( string const & name );
}
#endif