28 lines
707 B
C++
28 lines
707 B
C++
#ifndef UTILTOOL_H
|
|
#define UTILTOOL_H
|
|
|
|
#include <array>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
enum class MediaType{
|
|
VIDEO,
|
|
AUDIO,
|
|
IMAGE,
|
|
UNSUPPORT,
|
|
};
|
|
|
|
class UtilTool
|
|
{
|
|
private:
|
|
constexpr static std::array<std::string_view, 2> ImageTypes{"jpg","png"};
|
|
constexpr static std::array<std::string_view, 1> VideoTypes{"mp4"};
|
|
constexpr static std::array<std::string_view, 1> AudioTypes{"mp3"};
|
|
static bool CheckFileIsImage(const std::string& filename);
|
|
static bool CheckFileIsAudio(const std::string& filename);
|
|
static bool CheckFileIsVideo(const std::string& filename);
|
|
public:
|
|
static MediaType CheckFileType(const std::string& filename);
|
|
};
|
|
|
|
#endif // !UTILTOOL_H
|