ImHex/tests/include/test_patterns/test_pattern_placement.hpp

35 lines
958 B
C++
Raw Normal View History

#pragma once
#include "test_pattern.hpp"
namespace hex::test {
2021-09-11 12:41:18 +00:00
class TestPatternPlacement : public TestPattern {
public:
2021-09-11 21:13:49 +00:00
TestPatternPlacement() : TestPattern("Placement") {
2021-09-11 12:41:18 +00:00
// placementVar
{
2021-09-11 21:13:49 +00:00
addPattern(create<PatternDataUnsigned>(0x00, sizeof(u32), "u32", "placementVar"));
2021-09-11 12:41:18 +00:00
}
// placementArray
{
2021-09-11 21:13:49 +00:00
auto placementArray = create<PatternDataStaticArray>(0x10, sizeof(u8) * 10, "u8", "placementArray");
placementArray->setEntries(create<PatternDataUnsigned>(0x10, sizeof(u8), "u8", ""), 10);
2021-09-11 12:41:18 +00:00
addPattern(placementArray);
}
}
2021-09-11 12:41:18 +00:00
~TestPatternPlacement() override = default;
[[nodiscard]]
std::string getSourceCode() const override {
return R"(
2021-09-11 12:41:18 +00:00
u32 placementVar @ 0x00;
u8 placementArray[10] @ 0x10;
)";
}
};
}