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);
|
2011-01-29 20:59:58 +03:00
|
|
|
BPackageVersion(const BString& major,
|
|
|
|
const BString& minor, const BString& micro,
|
|
|
|
uint8 release);
|
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
2011-02-02 01:01:17 +03:00
|
|
|
const BString& Major() const;
|
|
|
|
const BString& Minor() const;
|
|
|
|
const BString& Micro() const;
|
|
|
|
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,
|
|
|
|
uint8 release);
|
|
|
|
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;
|
|
|
|
uint8 fRelease;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__PACKAGE_VERSION_H_
|