btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / kernel / debug_hex_dump.h
blob7f042443c47238db0dc107d98e404189ab4fbbd9
1 /*
2 * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _KERNEL_DEBUG_HEX_DUMP_H
6 #define _KERNEL_DEBUG_HEX_DUMP_H
9 #include <debug.h>
12 namespace BKernel {
15 enum {
16 HEX_DUMP_FLAG_OMIT_ADDRESS = 0x01
20 class HexDumpDataProvider {
21 public:
22 virtual ~HexDumpDataProvider();
24 virtual bool HasMoreData() const = 0;
25 virtual uint8 NextByte() = 0;
26 virtual bool GetAddressString(char* buffer,
27 size_t bufferSize) const;
31 class HexDumpBufferDataProvider : public HexDumpDataProvider {
32 public:
33 HexDumpBufferDataProvider(const void* data,
34 size_t dataSize);
36 virtual bool HasMoreData() const;
37 virtual uint8 NextByte();
38 virtual bool GetAddressString(char* buffer,
39 size_t bufferSize) const;
41 private:
42 const uint8* fData;
43 size_t fDataSize;
47 void print_hex_dump(HexDumpDataProvider& data, size_t maxBytes,
48 uint32 flags = 0);
49 void print_hex_dump(const void* data, size_t maxBytes, uint32 flags = 0);
52 } // namespace BKernel
55 #endif /* _KERNEL_DEBUG_HEX_DUMP_H */