-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathpathhelper.cpp
More file actions
40 lines (34 loc) · 1.3 KB
/
Copy pathpathhelper.cpp
File metadata and controls
40 lines (34 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "pathhelper.hpp"
#include <array>
namespace ecode {
bool PathHelper::isVideoExtension( std::string_view ext ) {
static constexpr std::array<std::string_view, 10> extensions = {
"mp4", "mov", "mkv", "avi", "wmv", "webm", "flv", "mpg", "mpeg", "m4v" };
for ( const auto& cext : extensions )
if ( String::iequals( ext, cext ) )
return true;
return false;
}
bool PathHelper::isDocumentExtension( std::string_view ext ) {
static constexpr std::array<std::string_view, 5> extensions = { "doc", "docx", "pdf", "xls",
"xlsx" };
for ( const auto& cext : extensions )
if ( String::iequals( ext, cext ) )
return true;
return false;
}
bool PathHelper::isOpenExternalExtension( std::string_view ext ) {
return isVideoExtension( ext ) || isDocumentExtension( ext ) ||
isCompressedArchiveExtension( ext );
}
bool PathHelper::isCompressedArchiveExtension( std::string_view ext ) {
static constexpr std::array<std::string_view, 29> extensions = {
"zip", "rar", "7z", "tar", "gz", "bz2", "xz", "z", "arj", "cab",
"iso", "lzh", "lzma", "tgz", "tbz2", "txz", "zst", "ace", "arc", "cpio",
"deb", "dmg", "lrz", "lz", "lzo", "rpm", "shar", "wim", "zipx" };
for ( const auto& cext : extensions )
if ( String::iequals( ext, cext ) )
return true;
return false;
}
} // namespace ecode