BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
Formatter.h
Go to the documentation of this file.
1#pragma once
2
3#include "win_hdrs/win_types.h"
5
7{
8public:
10 virtual ~AbstractFormatter() {}
11
12 virtual const QString operator[](std::size_t idx) const = 0;
13
14protected:
16};
17
19public:
20 Formatter(AbstractByteBuffer *buf, bool _isHex = false, bool _isSkipNonprintable = false)
22 isHex(_isHex),isSkipNonprintable(_isSkipNonprintable)
23 {
24 }
25
26 void setHex(bool isEnabled) { isHex = isEnabled; }
27 void setSkipNonPrintable(bool isEnabled) { isSkipNonprintable = isEnabled; }
28
29 const QString operator[](std::size_t idx) const;
30
31protected:
32 bool isHex;
34};
35
36class HexFormatter : public Formatter
37{
38public:
40};
41
42/*
43class BufferPrinter
44{
45public:
46 enum FORMATTERS {
47 F_TEXT = 0,
48 F_HEX = 1,
49 COUNT_FORMATTERS
50 };
51
52 BufferPrinter();
53 ~BufferPrinter() { clearFormatters(); }
54
55 bool addFormater(int formatterId, AbstractFormatter *formatter);
56 bool useFormatter(int formatterId);
57
58protected:
59 void clearFormatters();
60
61 AbstractFormatter *strategy;
62
63 std::map<int, AbstractFormatter> formatters;
64};
65*/
virtual ~AbstractFormatter()
Definition Formatter.h:10
virtual const QString operator[](std::size_t idx) const =0
AbstractFormatter(AbstractByteBuffer *v_buf)
Definition Formatter.cpp:5
AbstractByteBuffer * buf
Definition Formatter.h:15
void setSkipNonPrintable(bool isEnabled)
Definition Formatter.h:27
const QString operator[](std::size_t idx) const
Definition Formatter.cpp:12
bool isHex
Definition Formatter.h:32
void setHex(bool isEnabled)
Definition Formatter.h:26
Formatter(AbstractByteBuffer *buf, bool _isHex=false, bool _isSkipNonprintable=false)
Definition Formatter.h:20
bool isSkipNonprintable
Definition Formatter.h:33
HexFormatter(AbstractByteBuffer *buf)
Definition Formatter.h:39