MCPcopy Create free account
hub / github.com/citp/BlockSci / operator()

Method operator()

blockscipy/src/simple/bytes_proxy.cpp:23–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21struct AddBytesMethods {
22 template <typename FuncApplication>
23 void operator()(FuncApplication func) {
24 using namespace blocksci;
25 func(method_tag, "startswith", +[](const py::bytes &bytes, const std::string &str) -> bool {
26 auto bytesString = static_cast<std::string>(bytes);
27 return bytesString.find(str, 0) == 0;
28 }, "Returns true if the byte string has the given prefix");
29 func(method_tag, "endswith", +[](const py::bytes &bytes, const std::string &str) -> bool {
30 auto bytesString = static_cast<std::string>(bytes);
31 return bytesString.size() >= str.size() &&
32 bytesString.compare(bytesString.size() - str.size(), str.size(), str) == 0;
33 }, "Returns true if the byte string has the given suffix");
34 }
35};
36
37void addBytesProxyMethods(AllProxyClasses<py::bytes> &cls) {

Callers

nothing calls this directly

Calls 2

findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected