refactor: Rework features that use external libraries into optional plugins (#1470)

This commit is contained in:
Nik
2023-12-23 21:09:41 +01:00
committed by GitHub
parent 84bfd10416
commit 61bfe10bc2
149 changed files with 2940 additions and 2390 deletions

View File

@@ -0,0 +1,20 @@
#pragma once
#include <pl/pattern_language.hpp>
#include <pl/patterns/pattern.hpp>
namespace hex::plugin::visualizers {
template<typename T>
std::vector<T> patternToArray(pl::ptrn::Pattern *pattern){
const auto bytes = pattern->getBytes();
std::vector<T> result;
result.resize(bytes.size() / sizeof(T));
for (size_t i = 0; i < result.size(); i++)
std::memcpy(&result[i], &bytes[i * sizeof(T)], sizeof(T));
return result;
}
}