bool Qtilities::Core::VersionNumber::operator<(const VersionNumber& ref) { if (d->is_version_revision_used) { // Handle case: 2.5.3 < 1.5.3 if (d->version_major < ref.versionMajor()) return true; // Handle case: 1.4.3 < 1.5.3 if (d->version_minor < ref.versionMinor()) return true; // Handle case: 1.5.2 < 1.5.3 if (d->version_revision < ref.versionRevision()) return true; // All other cases return false; } if (d->is_version_minor_used) { // Handle case: 2.5.3 < 1.5.3 if (d->version_major < ref.versionMajor()) return true; // Handle case: 1.4.3 < 1.5.3 if (d->version_minor < ref.versionMinor()) return true; // All other cases return false; } if (d->version_major < ref.versionMajor()) return true; return false; }
bool Qtilities::Core::VersionNumber::operator==(const VersionNumber& ref) const { if (d->version_major != ref.versionMajor()) return false; if (d->is_version_minor_used) { if (d->version_minor != ref.versionMinor()) return false; } if (d->is_version_revision_used) { if (d->version_revision != ref.versionRevision()) return false; } return true; }
Qtilities::Core::VersionNumber::VersionNumber(const VersionNumber& ref) { d = new VersionNumberPrivateData; d->version_major = ref.versionMajor(); d->version_minor = ref.versionMinor(); d->version_revision = ref.versionRevision(); d->field_width_minor = ref.fieldWidthMinor(); d->field_width_revision = ref.fieldWidthRevision(); d->is_version_minor_used = ref.isVersionMinorUsed(); d->is_version_revision_used = ref.isVersionRevisionUsed(); d->development_stage = ref.developmentStage(); d->development_stage_identifier = ref.developmentStageIdentifier(); d->version_development_stage = ref.versionDevelopmentStage(); }
bool Qtilities::Core::VersionNumber::operator==(const VersionNumber& ref) const { if (d->version_major != ref.versionMajor()) return false; if (d->is_version_minor_used && ref.isVersionMinorUsed()) { if (d->version_minor != ref.versionMinor()) return false; } if (d->is_version_revision_used && ref.isVersionRevisionUsed()) { if (d->version_revision != ref.versionRevision()) return false; } if (developmentStage(true) != ref.developmentStage(true)) return false; // We can just check developmentStage(true) since we already know ref has the same stage: if (developmentStage(true) != DevelopmentStageNone) { if (d->version_development_stage != ref.versionDevelopmentStage()) return false; } return true; }
Qtilities::Core::VersionNumber::VersionNumber(const VersionNumber& ref) { d = new VersionNumberPrivateData; d->version_major = ref.versionMajor(); d->version_minor = ref.versionMinor(); d->version_revision = ref.versionRevision(); }
bool Qtilities::Core::VersionNumber::operator<(const VersionNumber& ref) { if (*this == ref) return false; if (developmentStage(true) != DevelopmentStageNone || ref.developmentStage(true) != DevelopmentStageNone) { // Handle case: 1.5.3 < 2.5.3 if (d->version_major < ref.versionMajor()) return true; // Handle case: 1.4.3 < 1.5.3 and 2.4.3 < 1.5.3 if (d->version_minor < ref.versionMinor() && d->version_major == ref.versionMajor()) return true; // Handle case: 1.5.2 < 1.5.3 and 2.5.2 < 1.5.3 and 2.6.2 < 1.5.3 if (d->version_revision < ref.versionRevision() && d->version_minor == ref.versionMinor() && d->version_major == ref.versionMajor()) return true; // If we get here, we know the major, minor and revision version is NOT smaller. Thus, we check if they are the same if and // they are we know we can check the development stage versions: if (d->version_revision == ref.versionRevision() && d->version_minor == ref.versionMinor() && d->version_major == ref.versionMajor()) { if (developmentStage(true) == ref.developmentStage(true)) { if (d->version_development_stage < ref.versionDevelopmentStage()) return true; } else { // In this case consider the development stage order: if ((int) developmentStage(true) < (int) ref.developmentStage(true)) return true; } } return false; } if (d->is_version_revision_used && ref.isVersionRevisionUsed()) { // Handle case: 1.5.3 < 2.5.3 if (d->version_major < ref.versionMajor()) return true; if (d->is_version_minor_used && ref.isVersionMinorUsed()) { // Handle case: 1.4.3 < 1.5.3 and 2.4.3 < 1.5.3 if (d->version_minor < ref.versionMinor() && d->version_major == ref.versionMajor()) return true; } // Handle case: 1.5.2 < 1.5.3 and 2.5.2 < 1.5.3 and 1.6.2 < 1.5.3 if (d->version_revision < ref.versionRevision() && d->version_minor == ref.versionMinor() && d->version_major == ref.versionMajor()) return true; // All other cases return false; } if (d->is_version_minor_used && ref.isVersionMinorUsed()) { // Handle case: 1.5 < 2.5 if (d->version_major < ref.versionMajor()) return true; // Handle case: 1.4 < 1.5 and 2.4 < 1.5 if (d->version_minor < ref.versionMinor() && d->version_major == ref.versionMajor()) return true; // All other cases return false; } if (d->version_major < ref.versionMajor()) return true; return false; }