MCPcopy Create free account
hub / github.com/VCVRack/Rack / compareVersionPart

Function compareVersionPart

src/string.cpp:592–608  ·  view source on GitHub ↗

Returns whether version part p1 is earlier than p2. */

Source from the content-addressed store, hash-verified

590
591/** Returns whether version part p1 is earlier than p2. */
592static bool compareVersionPart(const std::string& p1, const std::string& p2) {
593 int i1 = stringToInt(p1);
594 int i2 = stringToInt(p2);
595
596 if (i1 >= 0 && i2 >= 0) {
597 // Compare integers.
598 return i1 < i2;
599 }
600 else if (i1 < 0 && i2 < 0) {
601 // Compare strings.
602 return p1 < p2;
603 }
604 else {
605 // Types are different. String is always less than int.
606 return i1 < 0;
607 }
608}
609
610
611Version::Version(const std::string& s) {

Callers

nothing calls this directly

Calls 1

stringToIntFunction · 0.85

Tested by

no test coverage detected