-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiletype.cpp
More file actions
46 lines (37 loc) · 992 Bytes
/
filetype.cpp
File metadata and controls
46 lines (37 loc) · 992 Bytes
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
41
42
43
44
45
46
#include <stdlib.h>
#include <regex>
#include <string>
#include <map>
#include <boost/regex.hpp>
#include "../structuredLogger/structuredLogger.h"
#include "filetype.h"
filetype::filetype(std::string filespec)
{
//ctor
m_filespec = filespec;
boost::regex csufix( ".*?\\.(tar\\.gz|tgz|tbz|rar|zip|7zip|tar|gz)$");
std::string::const_iterator start, end;
start = m_filespec.begin();
end = m_filespec.end();
boost::smatch compression;
boost::match_flag_type flags = boost::match_default | boost::match_perl;
if (regex_match(m_filespec,compression,csufix))
{
m_compressionType = compression[1];
}
else
{
while(regex_search(start, end, compression, csufix, flags))
{
m_compressionType = compression[1];
flags |= boost::match_prev_avail;
flags |= boost::match_not_bob;
start++;
}
}
}
filetype::~filetype()
{
//dtor
elog().~structuredLogger();
}