2011-01-29 20:59:58 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__PACKAGE_VERSION_H_
|
|
|
|
#define _PACKAGE__PACKAGE_VERSION_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
namespace BHPKG {
|
|
|
|
class BPackageVersionData;
|
|
|
|
}
|
|
|
|
using BHPKG::BPackageVersionData;
|
|
|
|
|
|
|
|
|
2011-01-29 20:59:58 +03:00
|
|
|
class BPackageVersion {
|
|
|
|
public:
|
|
|
|
BPackageVersion();
|
2011-02-09 22:11:23 +03:00
|
|
|
BPackageVersion(
|
|
|
|
const BPackageVersionData& data);
|
2013-04-03 06:06:26 +04:00
|
|
|
BPackageVersion(const BString& versionString,
|
|
|
|
bool releaseIsOptional = true);
|
2011-01-29 20:59:58 +03:00
|
|
|
BPackageVersion(const BString& major,
|
|
|
|
const BString& minor, const BString& micro,
|
2011-06-27 03:53:01 +04:00
|
|
|
const BString& preRelease, uint8 release);
|
2011-01-29 20:59:58 +03:00
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
2011-02-02 01:01:17 +03:00
|
|
|
const BString& Major() const;
|
|
|
|
const BString& Minor() const;
|
|
|
|
const BString& Micro() const;
|
2011-06-27 03:53:01 +04:00
|
|
|
const BString& PreRelease() const;
|
|
|
|
// "alpha3", "beta2", "rc1" or "" if final
|
2011-02-02 01:01:17 +03:00
|
|
|
uint8 Release() const;
|
|
|
|
|
2011-02-04 20:53:54 +03:00
|
|
|
BString ToString() const;
|
2011-01-29 20:59:58 +03:00
|
|
|
|
|
|
|
void SetTo(const BString& major,
|
|
|
|
const BString& minor, const BString& micro,
|
2011-06-27 03:53:01 +04:00
|
|
|
const BString& preRelease, uint8 release);
|
2013-04-03 06:06:26 +04:00
|
|
|
status_t SetTo(const BString& versionString,
|
|
|
|
bool releaseIsOptional = true);
|
2011-01-29 20:59:58 +03:00
|
|
|
void Clear();
|
|
|
|
|
|
|
|
int Compare(const BPackageVersion& other) const;
|
|
|
|
// does a natural compare over major, minor
|
|
|
|
// and micro, finally comparing release
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString fMajor;
|
|
|
|
BString fMinor;
|
|
|
|
BString fMicro;
|
2011-06-27 03:53:01 +04:00
|
|
|
BString fPreRelease;
|
2011-01-29 20:59:58 +03:00
|
|
|
uint8 fRelease;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__PACKAGE_VERSION_H_
|