xref: /haiku/headers/os/package/PackageVersion.h (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
1 /*
2  * Copyright 2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__PACKAGE_VERSION_H_
6 #define _PACKAGE__PACKAGE_VERSION_H_
7 
8 
9 #include <String.h>
10 
11 
12 namespace BPackageKit {
13 
14 
15 namespace BHPKG {
16 	class BPackageVersionData;
17 }
18 using BHPKG::BPackageVersionData;
19 
20 
21 class BPackageVersion {
22 public:
23 								BPackageVersion();
24 								BPackageVersion(
25 									const BPackageVersionData& data);
26 								BPackageVersion(const BString& major,
27 									const BString& minor, const BString& micro,
28 									uint8 release);
29 
30 			status_t			InitCheck() const;
31 
32 			const BString&		Major() const;
33 			const BString&		Minor() const;
34 			const BString&		Micro() const;
35 			uint8				Release() const;
36 
37 			BString				ToString() const;
38 
39 			void				SetTo(const BString& major,
40 									const BString& minor, const BString& micro,
41 									uint8 release);
42 			void				Clear();
43 
44 			int					Compare(const BPackageVersion& other) const;
45 									// does a natural compare over major, minor
46 									// and micro, finally comparing release
47 
48 private:
49 			BString				fMajor;
50 			BString				fMinor;
51 			BString				fMicro;
52 			uint8				fRelease;
53 };
54 
55 
56 }	// namespace BPackageKit
57 
58 
59 #endif	// _PACKAGE__PACKAGE_VERSION_H_
60