MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / BinaryFileReader

Method BinaryFileReader

DebugView++Lib/BinaryFileReader.cpp:24–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace debugviewpp {
23
24BinaryFileReader::BinaryFileReader(Timer& timer, ILineBuffer& linebuffer, FileType::type filetype, const std::wstring& filename) :
25 LogSource(timer, SourceType::File, linebuffer),
26 m_end(true),
27 m_filename(filename),
28 m_fileType(filetype),
29 m_name(Str(std::experimental::filesystem::path(filename).filename().string()).str()),
30 m_handle(FindFirstChangeNotification(std::experimental::filesystem::path(m_filename).parent_path().wstring().c_str(), false, FILE_NOTIFY_CHANGE_SIZE)), //todo: maybe using FILE_NOTIFY_CHANGE_LAST_WRITE could have benefits, not sure what though.
31 m_wifstream(m_filename, std::ios::binary),
32 m_filenameOnly(std::experimental::filesystem::path(m_filename).filename().wstring()),
33 m_initialized(false)
34{
35 switch (filetype)
36 {
37 case FileType::UTF16LE:
38 m_wifstream.imbue(std::locale(m_wifstream.getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff, std::codecvt_mode(std::little_endian | std::consume_header)>));
39 break;
40 case FileType::UTF16BE:
41 m_wifstream.imbue(std::locale(m_wifstream.getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
42 break;
43 case FileType::UTF8:
44 m_wifstream.imbue(std::locale(m_wifstream.getloc(), new std::codecvt_utf8<wchar_t>));
45 break;
46 default:
47 assert(!"This BinaryFileReader filetype was not implemented!");
48 break;
49
50 }
51 SetDescription(filename);
52}
53
54BinaryFileReader::~BinaryFileReader()
55{

Callers

nothing calls this directly

Calls 3

StrClass · 0.85
strMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected