ImHex/tests/pattern_language/include/test_patterns/test_pattern_pointers.hpp

29 lines
863 B
C++
Raw Normal View History

2021-09-25 21:31:37 +00:00
#pragma once
#include "test_pattern.hpp"
namespace hex::test {
class TestPatternPointers : public TestPattern {
public:
TestPatternPointers() : TestPattern("Pointers") {
2021-09-25 21:31:37 +00:00
// placementPointer
{
auto placementPointer = create<PatternDataPointer>("", "placementPointer", 0x0C, sizeof(u8));
2022-01-10 21:15:05 +00:00
placementPointer->setPointedAtAddress(0x49);
auto pointedTo = create<PatternDataUnsigned>("u32", "", 0x49, sizeof(u32));
2021-09-25 21:31:37 +00:00
placementPointer->setPointedAtPattern(pointedTo);
addPattern(placementPointer);
}
}
~TestPatternPointers() override = default;
[[nodiscard]] std::string getSourceCode() const override {
2021-09-25 21:31:37 +00:00
return R"(
u32 *placementPointer : u8 @ 0x0C;
)";
}
};
}