refactor: Get rid of this->m_

This commit is contained in:
WerWolv
2023-12-19 13:10:25 +01:00
parent dd4be3b772
commit c7ab4a4569
119 changed files with 2973 additions and 2973 deletions

View File

@@ -29,27 +29,27 @@ namespace hex::plugin::builtin {
constexpr static int StepSize = 1, FastStepSize = 10;
ImGui::PushItemWidth(100_scaled);
ImGui::InputScalar("hex.builtin.nodes.constants.buffer.size"_lang, ImGuiDataType_U32, &this->m_size, &StepSize, &FastStepSize);
ImGui::InputScalar("hex.builtin.nodes.constants.buffer.size"_lang, ImGuiDataType_U32, &m_size, &StepSize, &FastStepSize);
ImGui::PopItemWidth();
}
void process() override {
if (this->m_buffer.size() != this->m_size)
this->m_buffer.resize(this->m_size, 0x00);
if (m_buffer.size() != m_size)
m_buffer.resize(m_size, 0x00);
this->setBufferOnOutput(0, this->m_buffer);
this->setBufferOnOutput(0, m_buffer);
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["size"] = this->m_size;
j["data"] = this->m_buffer;
j["size"] = m_size;
j["data"] = m_buffer;
}
void load(const nlohmann::json &j) override {
this->m_size = j.at("size");
this->m_buffer = j.at("data").get<std::vector<u8>>();
m_size = j.at("size");
m_buffer = j.at("data").get<std::vector<u8>>();
}
private:
@@ -64,21 +64,21 @@ namespace hex::plugin::builtin {
}
void drawNode() override {
ImGui::InputTextMultiline("##string", this->m_value, ImVec2(150_scaled, 0), ImGuiInputTextFlags_AllowTabInput);
ImGui::InputTextMultiline("##string", m_value, ImVec2(150_scaled, 0), ImGuiInputTextFlags_AllowTabInput);
}
void process() override {
this->setBufferOnOutput(0, hex::decodeByteString(this->m_value));
this->setBufferOnOutput(0, hex::decodeByteString(m_value));
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["data"] = this->m_value;
j["data"] = m_value;
}
void load(const nlohmann::json &j) override {
this->m_value = j.at("data").get<std::string>();
m_value = j.at("data").get<std::string>();
}
private:
@@ -91,22 +91,22 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGuiExt::InputHexadecimal("##integer_value", &this->m_value);
ImGuiExt::InputHexadecimal("##integer_value", &m_value);
ImGui::PopItemWidth();
}
void process() override {
this->setIntegerOnOutput(0, this->m_value);
this->setIntegerOnOutput(0, m_value);
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["data"] = this->m_value;
j["data"] = m_value;
}
void load(const nlohmann::json &j) override {
this->m_value = j.at("data");
m_value = j.at("data");
}
private:
@@ -119,22 +119,22 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGui::InputScalar("##floatValue", ImGuiDataType_Float, &this->m_value, nullptr, nullptr, "%f", ImGuiInputTextFlags_CharsDecimal);
ImGui::InputScalar("##floatValue", ImGuiDataType_Float, &m_value, nullptr, nullptr, "%f", ImGuiInputTextFlags_CharsDecimal);
ImGui::PopItemWidth();
}
void process() override {
this->setFloatOnOutput(0, this->m_value);
this->setFloatOnOutput(0, m_value);
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["data"] = this->m_value;
j["data"] = m_value;
}
void load(const nlohmann::json &j) override {
this->m_value = j.at("data");
m_value = j.at("data");
}
private:
@@ -151,30 +151,30 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(200_scaled);
ImGui::ColorPicker4("##colorPicker", &this->m_color.Value.x, ImGuiColorEditFlags_AlphaBar);
ImGui::ColorPicker4("##colorPicker", &m_color.Value.x, ImGuiColorEditFlags_AlphaBar);
ImGui::PopItemWidth();
}
void process() override {
this->setBufferOnOutput(0, wolv::util::toBytes<u8>(u8(this->m_color.Value.x * 0xFF)));
this->setBufferOnOutput(1, wolv::util::toBytes<u8>(u8(this->m_color.Value.y * 0xFF)));
this->setBufferOnOutput(2, wolv::util::toBytes<u8>(u8(this->m_color.Value.z * 0xFF)));
this->setBufferOnOutput(3, wolv::util::toBytes<u8>(u8(this->m_color.Value.w * 0xFF)));
this->setBufferOnOutput(0, wolv::util::toBytes<u8>(u8(m_color.Value.x * 0xFF)));
this->setBufferOnOutput(1, wolv::util::toBytes<u8>(u8(m_color.Value.y * 0xFF)));
this->setBufferOnOutput(2, wolv::util::toBytes<u8>(u8(m_color.Value.z * 0xFF)));
this->setBufferOnOutput(3, wolv::util::toBytes<u8>(u8(m_color.Value.w * 0xFF)));
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["data"] = nlohmann::json::object();
j["data"]["r"] = this->m_color.Value.x;
j["data"]["g"] = this->m_color.Value.y;
j["data"]["b"] = this->m_color.Value.z;
j["data"]["a"] = this->m_color.Value.w;
j["data"]["r"] = m_color.Value.x;
j["data"]["g"] = m_color.Value.y;
j["data"]["b"] = m_color.Value.z;
j["data"]["a"] = m_color.Value.w;
}
void load(const nlohmann::json &j) override {
const auto &color = j.at("data");
this->m_color = ImVec4(color.at("r"), color.at("g"), color.at("b"), color.at("a"));
m_color = ImVec4(color.at("r"), color.at("g"), color.at("b"), color.at("a"));
}
private:
@@ -188,7 +188,7 @@ namespace hex::plugin::builtin {
}
void drawNode() override {
ImGui::InputTextMultiline("##string", this->m_comment, scaled(ImVec2(150, 100)));
ImGui::InputTextMultiline("##string", m_comment, scaled(ImVec2(150, 100)));
}
void process() override {
@@ -197,11 +197,11 @@ namespace hex::plugin::builtin {
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["comment"] = this->m_comment;
j["comment"] = m_comment;
}
void load(const nlohmann::json &j) override {
this->m_comment = j["comment"].get<std::string>();
m_comment = j["comment"].get<std::string>();
}
private:

View File

@@ -19,8 +19,8 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGui::Combo("hex.builtin.nodes.crypto.aes.mode"_lang, &this->m_mode, "ECB\0CBC\0CFB128\0CTR\0GCM\0CCM\0OFB\0");
ImGui::Combo("hex.builtin.nodes.crypto.aes.key_length"_lang, &this->m_keyLength, "128 Bits\000192 Bits\000256 Bits\000");
ImGui::Combo("hex.builtin.nodes.crypto.aes.mode"_lang, &m_mode, "ECB\0CBC\0CFB128\0CTR\0GCM\0CCM\0OFB\0");
ImGui::Combo("hex.builtin.nodes.crypto.aes.key_length"_lang, &m_keyLength, "128 Bits\000192 Bits\000256 Bits\000");
ImGui::PopItemWidth();
}
@@ -41,7 +41,7 @@ namespace hex::plugin::builtin {
std::copy(iv.begin(), iv.end(), ivData.begin());
std::copy(nonce.begin(), nonce.end(), nonceData.begin());
auto output = crypt::aesDecrypt(static_cast<crypt::AESMode>(this->m_mode), static_cast<crypt::KeyLength>(this->m_keyLength), key, nonceData, ivData, input);
auto output = crypt::aesDecrypt(static_cast<crypt::AESMode>(m_mode), static_cast<crypt::KeyLength>(m_keyLength), key, nonceData, ivData, input);
this->setBufferOnOutput(4, output);
}
@@ -50,13 +50,13 @@ namespace hex::plugin::builtin {
j = nlohmann::json::object();
j["data"] = nlohmann::json::object();
j["data"]["mode"] = this->m_mode;
j["data"]["key_length"] = this->m_keyLength;
j["data"]["mode"] = m_mode;
j["data"]["key_length"] = m_keyLength;
}
void load(const nlohmann::json &j) override {
this->m_mode = j["data"]["mode"];
this->m_keyLength = j["data"]["key_length"];
m_mode = j["data"]["mode"];
m_keyLength = j["data"]["key_length"];
}
private:

View File

@@ -61,8 +61,8 @@ namespace hex::plugin::builtin {
public:
NodeDataSelection() : Node("hex.builtin.nodes.data_access.selection.header", { dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.selection.address"), dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Integer, "hex.builtin.nodes.data_access.selection.size") }) {
EventRegionSelected::subscribe(this, [this](const auto &region) {
this->m_address = region.address;
this->m_size = region.size;
m_address = region.address;
m_size = region.size;
});
}
@@ -71,8 +71,8 @@ namespace hex::plugin::builtin {
}
void process() override {
this->setIntegerOnOutput(0, this->m_address);
this->setIntegerOnOutput(1, this->m_size);
this->setIntegerOnOutput(0, m_address);
this->setIntegerOnOutput(1, m_size);
}
private:
@@ -232,17 +232,17 @@ namespace hex::plugin::builtin {
NodeVisualizerDigram() : Node("hex.builtin.nodes.visualizer.digram.header", { dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.input") }) { }
void drawNode() override {
this->m_digram.draw(scaled({ 200, 200 }));
m_digram.draw(scaled({ 200, 200 }));
if (ImGui::IsItemHovered() && ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
ImGui::BeginTooltip();
this->m_digram.draw(scaled({ 600, 600 }));
m_digram.draw(scaled({ 600, 600 }));
ImGui::EndTooltip();
}
}
void process() override {
this->m_digram.process(this->getBufferOnInput(0));
m_digram.process(this->getBufferOnInput(0));
}
private:
@@ -254,16 +254,16 @@ namespace hex::plugin::builtin {
NodeVisualizerLayeredDistribution() : Node("hex.builtin.nodes.visualizer.layered_dist.header", { dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.input") }) { }
void drawNode() override {
this->m_layeredDistribution.draw(scaled({ 200, 200 }));
m_layeredDistribution.draw(scaled({ 200, 200 }));
if (ImGui::IsItemHovered() && ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
ImGui::BeginTooltip();
this->m_layeredDistribution.draw(scaled({ 600, 600 }));
m_layeredDistribution.draw(scaled({ 600, 600 }));
ImGui::EndTooltip();
}
}
void process() override {
this->m_layeredDistribution.process(this->getBufferOnInput(0));
m_layeredDistribution.process(this->getBufferOnInput(0));
}
private:
@@ -275,10 +275,10 @@ namespace hex::plugin::builtin {
NodeVisualizerImage() : Node("hex.builtin.nodes.visualizer.image.header", { dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.input") }) { }
void drawNode() override {
ImGui::Image(this->m_texture, scaled(ImVec2(this->m_texture.getAspectRatio() * 200, 200)));
ImGui::Image(m_texture, scaled(ImVec2(m_texture.getAspectRatio() * 200, 200)));
if (ImGui::IsItemHovered() && ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
ImGui::BeginTooltip();
ImGui::Image(this->m_texture, scaled(ImVec2(this->m_texture.getAspectRatio() * 600, 600)));
ImGui::Image(m_texture, scaled(ImVec2(m_texture.getAspectRatio() * 600, 600)));
ImGui::EndTooltip();
}
}
@@ -286,7 +286,7 @@ namespace hex::plugin::builtin {
void process() override {
const auto &rawData = this->getBufferOnInput(0);
this->m_texture = ImGuiExt::Texture(rawData.data(), rawData.size(), ImGuiExt::Texture::Filter::Nearest);
m_texture = ImGuiExt::Texture(rawData.data(), rawData.size(), ImGuiExt::Texture::Filter::Nearest);
}
private:
@@ -298,16 +298,16 @@ namespace hex::plugin::builtin {
NodeVisualizerImageRGBA() : Node("hex.builtin.nodes.visualizer.image_rgba.header", { dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.input"), dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.common.width"), dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Integer, "hex.builtin.nodes.common.height") }) { }
void drawNode() override {
ImGui::Image(this->m_texture, scaled(ImVec2(this->m_texture.getAspectRatio() * 200, 200)));
ImGui::Image(m_texture, scaled(ImVec2(m_texture.getAspectRatio() * 200, 200)));
if (ImGui::IsItemHovered() && ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
ImGui::BeginTooltip();
ImGui::Image(this->m_texture, scaled(ImVec2(this->m_texture.getAspectRatio() * 600, 600)));
ImGui::Image(m_texture, scaled(ImVec2(m_texture.getAspectRatio() * 600, 600)));
ImGui::EndTooltip();
}
}
void process() override {
this->m_texture = { };
m_texture = { };
const auto &rawData = this->getBufferOnInput(0);
const auto &width = this->getIntegerOnInput(1);
@@ -317,7 +317,7 @@ namespace hex::plugin::builtin {
if (requiredBytes > rawData.size())
throwNodeError(hex::format("Image requires at least {} bytes of data, but only {} bytes are available", requiredBytes, rawData.size()));
this->m_texture = ImGuiExt::Texture(rawData.data(), rawData.size(), ImGuiExt::Texture::Filter::Nearest, width, height);
m_texture = ImGuiExt::Texture(rawData.data(), rawData.size(), ImGuiExt::Texture::Filter::Nearest, width, height);
}
private:
@@ -342,7 +342,7 @@ namespace hex::plugin::builtin {
if (ImPlot::BeginPlot("##distribution", viewSize, ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect)) {
ImPlot::SetupAxes("Address", "Count", ImPlotAxisFlags_Lock, ImPlotAxisFlags_Lock);
ImPlot::SetupAxisScale(ImAxis_Y1, ImPlotScale_Log10);
ImPlot::SetupAxesLimits(0, 256, 1, double(*std::max_element(this->m_counts.begin(), this->m_counts.end())) * 1.1F, ImGuiCond_Always);
ImPlot::SetupAxesLimits(0, 256, 1, double(*std::max_element(m_counts.begin(), m_counts.end())) * 1.1F, ImGuiCond_Always);
static auto x = [] {
std::array<ImU64, 256> result { 0 };
@@ -351,7 +351,7 @@ namespace hex::plugin::builtin {
}();
ImPlot::PlotBars<ImU64>("##bytes", x.data(), this->m_counts.data(), x.size(), 1);
ImPlot::PlotBars<ImU64>("##bytes", x.data(), m_counts.data(), x.size(), 1);
ImPlot::EndPlot();
}
@@ -360,9 +360,9 @@ namespace hex::plugin::builtin {
void process() override {
const auto &buffer = this->getBufferOnInput(0);
this->m_counts.fill(0x00);
m_counts.fill(0x00);
for (const auto &byte : buffer) {
this->m_counts[byte]++;
m_counts[byte]++;
}
}
@@ -377,7 +377,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGui::InputText("##name", this->m_name);
ImGui::InputText("##name", m_name);
ImGui::PopItemWidth();
}
@@ -387,7 +387,7 @@ namespace hex::plugin::builtin {
const auto &outVars = runtime.getOutVariables();
if (outVars.contains(this->m_name)) {
if (outVars.contains(m_name)) {
std::visit(wolv::util::overloaded {
[](const std::string &) {},
[](pl::ptrn::Pattern *) {},
@@ -397,20 +397,20 @@ namespace hex::plugin::builtin {
this->setBufferOnOutput(0, buffer);
}
}, outVars.at(this->m_name));
}, outVars.at(m_name));
} else {
throwNodeError(hex::format("Out variable '{}' has not been defined!", this->m_name));
throwNodeError(hex::format("Out variable '{}' has not been defined!", m_name));
}
}
void store(nlohmann::json &j) const override {
j = nlohmann::json::object();
j["name"] = this->m_name;
j["name"] = m_name;
}
void load(const nlohmann::json &j) override {
this->m_name = j["name"].get<std::string>();
m_name = j["name"].get<std::string>();
}
private:

View File

@@ -11,18 +11,18 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(150_scaled);
if (this->m_value.has_value())
ImGuiExt::TextFormatted("0x{0:X}", this->m_value.value());
if (m_value.has_value())
ImGuiExt::TextFormatted("0x{0:X}", m_value.value());
else
ImGui::TextUnformatted("???");
ImGui::PopItemWidth();
}
void process() override {
this->m_value.reset();
m_value.reset();
const auto &input = this->getIntegerOnInput(0);
this->m_value = input;
m_value = input;
}
private:
@@ -35,18 +35,18 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(150_scaled);
if (this->m_value.has_value())
ImGuiExt::TextFormatted("{0}", this->m_value.value());
if (m_value.has_value())
ImGuiExt::TextFormatted("{0}", m_value.value());
else
ImGui::TextUnformatted("???");
ImGui::PopItemWidth();
}
void process() override {
this->m_value.reset();
m_value.reset();
const auto &input = this->getFloatOnInput(0);
this->m_value = input;
m_value = input;
}
private:
@@ -63,7 +63,7 @@ namespace hex::plugin::builtin {
if (ImGui::BeginChild("##hex_view", scaled(ImVec2(ImGui::CalcTextSize(Header.c_str()).x, 200)), true)) {
ImGui::TextUnformatted(Header.c_str());
auto size = this->m_buffer.size();
auto size = m_buffer.size();
ImGuiListClipper clipper;
clipper.Begin((size + 0x0F) / 0x10);
@@ -75,7 +75,7 @@ namespace hex::plugin::builtin {
std::string line = hex::format(" {:08X}: ", y * 0x10);
for (u32 x = 0; x < 0x10; x++) {
if (x < lineSize)
line += hex::format("{:02X} ", this->m_buffer[y * 0x10 + x]);
line += hex::format("{:02X} ", m_buffer[y * 0x10 + x]);
else
line += " ";
@@ -85,7 +85,7 @@ namespace hex::plugin::builtin {
line += " ";
for (u32 x = 0; x < lineSize; x++) {
auto c = char(this->m_buffer[y * 0x10 + x]);
auto c = char(m_buffer[y * 0x10 + x]);
if (std::isprint(c))
line += c;
else
@@ -100,7 +100,7 @@ namespace hex::plugin::builtin {
}
void process() override {
this->m_buffer = this->getBufferOnInput(0);
m_buffer = this->getBufferOnInput(0);
}
private:
@@ -114,7 +114,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
constexpr static auto LineLength = 50;
if (ImGui::BeginChild("##string_view", scaled(ImVec2(ImGui::CalcTextSize(" ").x * (LineLength + 4), 150)), true)) {
std::string_view string = this->m_value;
std::string_view string = m_value;
ImGuiListClipper clipper;
clipper.Begin((string.length() + (LineLength - 1)) / LineLength);
@@ -135,7 +135,7 @@ namespace hex::plugin::builtin {
void process() override {
const auto &input = this->getBufferOnInput(0);
this->m_value = hex::encodeByteString(input);
m_value = hex::encodeByteString(input);
}
private:
@@ -148,7 +148,7 @@ namespace hex::plugin::builtin {
void drawNode() override {
ImGui::PushItemWidth(100_scaled);
ImGui::Text("%s", this->m_display.c_str());
ImGui::Text("%s", m_display.c_str());
ImGui::PopItemWidth();
}
@@ -165,7 +165,7 @@ namespace hex::plugin::builtin {
display += (byte & (1 << i)) != 0 ? '1' : '0';
}
}
this->m_display = wolv::util::trim(display);
m_display = wolv::util::trim(display);
}
private: