haiku/headers/os/package/PackageVersion.h
Ingo Weinhold 8f314372a8 Introduce a pre-release version component
* The version string pattern is now:
  <major>[.<minor>[.<micro>]][-<pre>][-<release>]
* Introduce B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE package
  attribute.
* Add "preRelease" field to BPackageVersionData.
* Add "preRelease" property to BPackageVersion and packagefs's Version.
* Adjust package reader and writer code accordingly.
2011-11-25 06:18:24 +01:00

63 lines
1.4 KiB
C++

/*
* 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 {
namespace BHPKG {
class BPackageVersionData;
}
using BHPKG::BPackageVersionData;
class BPackageVersion {
public:
BPackageVersion();
BPackageVersion(
const BPackageVersionData& data);
BPackageVersion(const BString& major,
const BString& minor, const BString& micro,
const BString& preRelease, uint8 release);
status_t InitCheck() const;
const BString& Major() const;
const BString& Minor() const;
const BString& Micro() const;
const BString& PreRelease() const;
// "alpha3", "beta2", "rc1" or "" if final
uint8 Release() const;
BString ToString() const;
void SetTo(const BString& major,
const BString& minor, const BString& micro,
const BString& preRelease, 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;
BString fPreRelease;
uint8 fRelease;
};
} // namespace BPackageKit
#endif // _PACKAGE__PACKAGE_VERSION_H_