MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / SplitSwitchDef

Function SplitSwitchDef

Source/Utils/cxxopts.hpp:632–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630 }
631
632 inline std::pair<std::string, std::string> SplitSwitchDef(const std::string &text)
633 {
634 std::string short_sw, long_sw;
635 const char *pdata = text.c_str();
636 if (isalnum(*pdata) && *(pdata + 1) == ',') {
637 short_sw = std::string(1, *pdata);
638 pdata += 2;
639 }
640 while (*pdata == ' ') { pdata += 1; }
641 if (isalnum(*pdata)) {
642 const char *store = pdata;
643 pdata += 1;
644 while (isalnum(*pdata) || *pdata == '-' || *pdata == '_') {
645 pdata += 1;
646 }
647 if (*pdata == '\0') {
648 long_sw = std::string(store, pdata - store);
649 } else {
650 throw_or_mimic<invalid_option_format_error>(text);
651 }
652 }
653 return std::pair<std::string, std::string>(short_sw, long_sw);
654 }
655
656 inline ArguDesc ParseArgument(const char *arg, bool &matched)
657 {

Callers 1

cxxopts.hppFile · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected