2020-11-20 23:12:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "views/view.hpp"
|
|
|
|
|
2020-11-22 14:32:37 +00:00
|
|
|
#include <bit>
|
2020-11-20 23:12:58 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <ctime>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
namespace prv { class Provider; }
|
|
|
|
|
|
|
|
struct GUID {
|
|
|
|
u32 data1;
|
|
|
|
u16 data2;
|
|
|
|
u16 data3;
|
|
|
|
u8 data4[8];
|
|
|
|
};
|
|
|
|
|
|
|
|
union PreviewData {
|
|
|
|
u8 unsigned8;
|
|
|
|
s8 signed8;
|
|
|
|
u16 unsigned16;
|
|
|
|
s16 signed16;
|
|
|
|
u32 unsigned32;
|
|
|
|
s32 signed32;
|
|
|
|
u64 unsigned64;
|
|
|
|
s64 signed64;
|
|
|
|
char8_t ansiChar;
|
|
|
|
char16_t wideChar;
|
|
|
|
u8 utf8Char[4];
|
|
|
|
float float32;
|
|
|
|
double float64;
|
2020-12-21 11:38:30 +00:00
|
|
|
#if defined(OS_WINDOWS) && defined(ARCH_64_BIT)
|
2020-11-20 23:36:38 +00:00
|
|
|
__time32_t time32;
|
|
|
|
__time64_t time64;
|
|
|
|
#else
|
|
|
|
time_t time;
|
|
|
|
#endif
|
2020-11-20 23:12:58 +00:00
|
|
|
GUID guid;
|
|
|
|
};
|
|
|
|
|
2020-12-21 10:23:57 +00:00
|
|
|
struct CachedData {
|
|
|
|
CachedData(std::string name, std::string value, size_t size) : name(name), value(value), size(size) { }
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
std::string value;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
2020-11-20 23:12:58 +00:00
|
|
|
class ViewDataInspector : public View {
|
|
|
|
public:
|
|
|
|
explicit ViewDataInspector(prv::Provider* &dataProvider);
|
|
|
|
~ViewDataInspector() override;
|
|
|
|
|
2020-12-22 17:10:01 +00:00
|
|
|
void drawContent() override;
|
|
|
|
void drawMenu() override;
|
2020-11-20 23:12:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
prv::Provider* &m_dataProvider;
|
|
|
|
bool m_shouldInvalidate = true;
|
|
|
|
|
2020-11-22 14:32:37 +00:00
|
|
|
std::endian m_endianess = std::endian::native;
|
|
|
|
|
2020-11-20 23:12:58 +00:00
|
|
|
PreviewData m_previewData = { 0 };
|
|
|
|
size_t m_validBytes = 0;
|
2020-12-21 10:23:57 +00:00
|
|
|
std::vector<CachedData> m_cachedData;
|
2020-11-20 23:12:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|