2022-04-08 16:08:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
2022-04-17 16:57:30 +02:00
|
|
|
#include <pl/patterns/pattern.hpp>
|
|
|
|
#include <pl/pattern_visitor.hpp>
|
2022-04-08 16:08:02 +02:00
|
|
|
#include <hex/providers/provider.hpp>
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
2022-04-17 16:57:30 +02:00
|
|
|
class PatternDrawer : public pl::PatternVisitor {
|
2022-04-08 16:08:02 +02:00
|
|
|
public:
|
2022-04-17 16:57:30 +02:00
|
|
|
PatternDrawer() = default;
|
2022-04-08 16:08:02 +02:00
|
|
|
|
2022-10-12 14:49:48 +02:00
|
|
|
void draw(pl::ptrn::Pattern& pattern);
|
|
|
|
|
2022-08-06 21:38:09 +02:00
|
|
|
void visit(pl::ptrn::PatternArrayDynamic& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternArrayStatic& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternBitfieldField& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternBitfield& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternBoolean& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternCharacter& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternEnum& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternFloat& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternPadding& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternPointer& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternSigned& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternString& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternStruct& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternUnion& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternUnsigned& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternWideCharacter& pattern) override;
|
|
|
|
void visit(pl::ptrn::PatternWideString& pattern) override;
|
2022-04-08 16:08:02 +02:00
|
|
|
|
|
|
|
private:
|
2022-09-19 14:16:23 +02:00
|
|
|
constexpr static auto ChunkSize = 512;
|
|
|
|
constexpr static auto DisplayEndStep = 64;
|
2022-04-08 16:08:02 +02:00
|
|
|
|
2022-09-19 14:16:23 +02:00
|
|
|
void drawArray(pl::ptrn::Pattern& pattern, pl::ptrn::Iteratable &iteratable, bool isInlined);
|
2022-08-06 21:38:09 +02:00
|
|
|
u64& getDisplayEnd(const pl::ptrn::Pattern& pattern);
|
2022-04-08 16:08:02 +02:00
|
|
|
|
|
|
|
private:
|
2022-08-06 21:38:09 +02:00
|
|
|
std::map<const pl::ptrn::Pattern*, u64> m_displayEnd;
|
2022-04-08 16:08:02 +02:00
|
|
|
};
|
2022-10-02 17:30:26 +02:00
|
|
|
}
|