MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / parseInt64

Function parseInt64

src/types.cpp:534–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534int64_t parseInt64(const std::string& s, bool& ok) {
535 auto ret = stringTo<int64_t>(s, ok);
536 if (ok)
537 return ret;
538
539 auto f = stringTo<float>(s, ok);
540 if (ok)
541 return static_cast<int64_t>(f);
542
543 auto [r, st] = stringTo<Rational>(s, ok);
544 if (ok) {
545 if (st <= 0) {
546 ok = false;
547 return 0;
548 }
549 return static_cast<int64_t>(static_cast<float>(r) / st);
550 }
551
552 bool b = stringTo<bool>(s, ok);
553 if (ok)
554 return b ? 1 : 0;
555
556 // everything failed, return from stringTo<int64_t> is probably the best fit
557 return ret;
558}
559
560uint32_t parseUint32(const std::string& s, bool& ok) {
561 if (auto x = parseInt64(s, ok); ok && 0 <= x && x <= std::numeric_limits<uint32_t>::max()) {

Callers 4

mainFunction · 0.85
toInt64Method · 0.85
isoSpeedFunction · 0.85
parseUint32Function · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68