BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
parser
include
bearparser
Formatter.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "win_hdrs/win_types.h"
4
#include "
AbstractByteBuffer.h
"
5
6
class
AbstractFormatter
7
{
8
public
:
9
AbstractFormatter
(
AbstractByteBuffer
*v_buf);
10
virtual
~AbstractFormatter
() {}
11
12
virtual
const
QString
operator[]
(std::size_t idx)
const
= 0;
13
14
protected
:
15
AbstractByteBuffer
*
buf
;
16
};
17
18
class
Formatter
:
public
AbstractFormatter
{
19
public
:
20
Formatter
(
AbstractByteBuffer
*
buf
,
bool
_isHex =
false
,
bool
_isSkipNonprintable =
false
)
21
:
AbstractFormatter
(
buf
),
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
31
protected
:
32
bool
isHex
;
33
bool
isSkipNonprintable
;
34
};
35
36
class
HexFormatter
:
public
Formatter
37
{
38
public
:
39
HexFormatter
(
AbstractByteBuffer
*
buf
) :
Formatter
(
buf
, true, false) {}
40
};
41
42
/*
43
class BufferPrinter
44
{
45
public:
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
58
protected:
59
void clearFormatters();
60
61
AbstractFormatter *strategy;
62
63
std::map<int, AbstractFormatter> formatters;
64
};
65
*/
AbstractByteBuffer.h
AbstractByteBuffer
Definition
AbstractByteBuffer.h:32
AbstractFormatter
Definition
Formatter.h:7
AbstractFormatter::~AbstractFormatter
virtual ~AbstractFormatter()
Definition
Formatter.h:10
AbstractFormatter::operator[]
virtual const QString operator[](std::size_t idx) const =0
AbstractFormatter::AbstractFormatter
AbstractFormatter(AbstractByteBuffer *v_buf)
Definition
Formatter.cpp:5
AbstractFormatter::buf
AbstractByteBuffer * buf
Definition
Formatter.h:15
Formatter
Definition
Formatter.h:18
Formatter::setSkipNonPrintable
void setSkipNonPrintable(bool isEnabled)
Definition
Formatter.h:27
Formatter::operator[]
const QString operator[](std::size_t idx) const
Definition
Formatter.cpp:12
Formatter::isHex
bool isHex
Definition
Formatter.h:32
Formatter::setHex
void setHex(bool isEnabled)
Definition
Formatter.h:26
Formatter::Formatter
Formatter(AbstractByteBuffer *buf, bool _isHex=false, bool _isSkipNonprintable=false)
Definition
Formatter.h:20
Formatter::isSkipNonprintable
bool isSkipNonprintable
Definition
Formatter.h:33
HexFormatter
Definition
Formatter.h:37
HexFormatter::HexFormatter
HexFormatter(AbstractByteBuffer *buf)
Definition
Formatter.h:39
Generated by
1.12.0