MCPcopy Create free account
hub / github.com/ElementsProject/elements / OpCodeParser

Method OpCodeParser

src/core_read.cpp:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29public:
30 OpCodeParser()
31 {
32 for (unsigned int op = 0; op <= MAX_OPCODE; ++op) {
33 // Allow OP_RESERVED to get into mapOpNames
34 if (op < OP_NOP && op != OP_RESERVED) {
35 continue;
36 }
37
38 std::string strName = GetOpName(static_cast<opcodetype>(op));
39 if (strName == "OP_UNKNOWN") {
40 continue;
41 }
42 mapOpNames[strName] = static_cast<opcodetype>(op);
43 // Convenience: OP_ADD and just ADD are both recognized:
44 if (strName.compare(0, 3, "OP_") == 0) { // strName starts with "OP_"
45 mapOpNames[strName.substr(3)] = static_cast<opcodetype>(op);
46 }
47 }
48 }
49 opcodetype Parse(const std::string& s) const
50 {
51 auto it = mapOpNames.find(s);

Callers

nothing calls this directly

Calls 2

GetOpNameFunction · 0.85
compareMethod · 0.80

Tested by

no test coverage detected