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-12 18:28:32 +00:00
addPattern(create<PatternDataUnsigned>("u32", "placementVar", 0x00, sizeof(u32)));
2021-09-11 12:41:18 +00:00
}
// placementArray
{
2021-09-12 18:28:32 +00:00
auto placementArray = create<PatternDataStaticArray>("u8", "placementArray", 0x10, sizeof(u8) * 10);
placementArray->setEntries(create<PatternDataUnsigned>("u8", "", 0x10, sizeof(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;
)";
}
};
}