1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#ifndef SLANG_HEX_DUMP_UTIL_H
#define SLANG_HEX_DUMP_UTIL_H
#include "slang-common.h"
#include "slang-list.h"
#include "slang-string.h"
#include "slang.h"
namespace Slang
{
struct HexDumpUtil
{
/// Dump out bytes in source format - as in
/// 0x10, 0xab,
static SlangResult dumpSourceBytes(
const uint8_t* data,
size_t dataCount,
int maxBytesPerLine,
ISlangWriter* writer);
/// Dump data to writer, with lines starting with hex data
static SlangResult dump(const List<uint8_t>& data, int numBytesPerLine, ISlangWriter* writer);
static SlangResult dump(
const uint8_t* data,
size_t dataCount,
int numBytesPerLine,
ISlangWriter* writer);
/// Dump a single value
static void dump(uint32_t value, ISlangWriter* writer);
static SlangResult dumpWithMarkers(
const List<uint8_t>& data,
int numBytesPerLine,
ISlangWriter* writer);
static SlangResult dumpWithMarkers(
const uint8_t* data,
size_t dataSize,
int numBytesPerLine,
ISlangWriter* writer);
/// Parses lines formatted by dump, back into bytes
static SlangResult parse(const UnownedStringSlice& lines, List<uint8_t>& outBytes);
static SlangResult parseWithMarkers(const UnownedStringSlice& lines, List<uint8_t>& outBytes);
static SlangResult findStartAndEndLines(
const UnownedStringSlice& lines,
UnownedStringSlice& outStart,
UnownedStringSlice& outEnd);
};
} // namespace Slang
#endif
|