MCPcopy Create free account
hub / github.com/DFHack/dfhack / grab_opt

Method grab_opt

plugins/manipulator.cpp:487–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485 opt_list.clear();
486 }
487 string grab_opt (string s, size_t start)
488 {
489 vector<string> candidates;
490 for (auto it = opt_list.begin(); it != opt_list.end(); ++it)
491 {
492 string opt = std::get<0>(*it);
493 string slice = s.substr(start, opt.size());
494 if (slice == opt)
495 candidates.push_back(slice);
496 }
497 if (!candidates.size())
498 return "";
499 // Select the longest candidate
500 std::sort(candidates.begin(), candidates.end(), StringFormatter<T>::compare_opts);
501 return candidates[0];
502 }
503 T_callback get_callback (string s)
504 {
505 for (auto it = opt_list.begin(); it != opt_list.end(); ++it)

Callers

nothing calls this directly

Calls 4

sortFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected