MCPcopy Create free account
hub / github.com/IENT/YUView / SubByteReaderLogging

Class SubByteReaderLogging

YUViewLib/src/parser/common/SubByteReaderLogging.h:54–104  ·  view source on GitHub ↗

This is a wrapper around the sub_byte_reader that adds the functionality to log the read symbold to TreeItems

Source from the content-addressed store, hash-verified

52// This is a wrapper around the sub_byte_reader that adds the functionality to log the read symbold
53// to TreeItems
54class SubByteReaderLogging : public SubByteReader
55{
56public:
57 SubByteReaderLogging() = default;
58 SubByteReaderLogging(SubByteReader & reader,
59 std::shared_ptr<TreeItem> item,
60 std::string new_sub_item_name = "");
61 SubByteReaderLogging(const ByteVector & inArr,
62 std::shared_ptr<TreeItem> item,
63 std::string new_sub_item_name = "",
64 size_t inOffset = 0);
65
66 // DEPRECATED. This is just for backwards compatibility and will be removed once
67 // everything is using std types.
68 static ByteVector convertToByteVector(QByteArray data);
69 static QByteArray convertToQByteArray(ByteVector data);
70
71 uint64_t readBits(const std::string &symbolName, size_t numBits, const Options &options = {});
72 bool readFlag(const std::string &symbolName, const Options &options = {});
73 uint64_t readUEV(const std::string &symbolName, const Options &options = {});
74 int64_t readSEV(const std::string &symbolName, const Options &options = {});
75 uint64_t readLEB128(const std::string &symbolName, const Options &options = {});
76 uint64_t readNS(const std::string &symbolName, uint64_t maxVal, const Options &options = {});
77 int64_t readSU(const std::string &symbolName, unsigned nrBits, const Options &options = {});
78
79 ByteVector readBytes(const std::string &symbolName, size_t nrBytes, const Options &options = {});
80
81 void
82 logCalculatedValue(const std::string &symbolName, int64_t value, const Options &options = {});
83 void logArbitrary(const std::string &symbolName,
84 const std::string &value = {},
85 const std::string &coding = {},
86 const std::string &code = {},
87 const std::string &meaning = {});
88
89 void stashAndReplaceCurrentTreeItem(std::shared_ptr<TreeItem> newItem);
90 void popTreeItem();
91
92 [[nodiscard]] std::shared_ptr<TreeItem> getCurrentItemTree() { return this->currentTreeLevel; }
93
94private:
95 friend class SubByteReaderLoggingSubLevel;
96 void addLogSubLevel(std::string name);
97 void removeLogSubLevel();
98
99 void logExceptionAndThrowError [[noreturn]] (const std::exception &ex, const std::string &when);
100
101 std::stack<std::shared_ptr<TreeItem>> itemHierarchy;
102 std::shared_ptr<TreeItem> currentTreeLevel{};
103 std::shared_ptr<TreeItem> stashedTreeItem{};
104};
105
106// A simple wrapper for SubByteReaderLogging->addLogSubLevel /
107// SubByteReaderLogging->removeLogSubLevel

Callers 2

parseMethod · 0.85
parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected