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

Function SplitInteger

Source/Utils/cxxopts.hpp:567–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565 };
566#ifdef CXXOPTS_NO_REGEX
567 inline IntegerDesc SplitInteger(const std::string &text)
568 {
569 if (text.empty())
570 {
571 throw_or_mimic<argument_incorrect_type>(text);
572 }
573 IntegerDesc desc;
574 const char *pdata = text.c_str();
575 if (*pdata == '-')
576 {
577 pdata += 1;
578 desc.negative = "-";
579 }
580 if (strncmp(pdata, "0x", 2) == 0)
581 {
582 pdata += 2;
583 desc.base = "0x";
584 }
585 if (*pdata != '\0')
586 {
587 desc.value = std::string(pdata);
588 }
589 else
590 {
591 throw_or_mimic<argument_incorrect_type>(text);
592 }
593 return desc;
594 }
595
596 inline bool IsTrueText(const std::string &text)
597 {

Callers 1

integer_parserFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected