1/*
2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef VERSION_H
6#define VERSION_H
7
8
9#include <package/PackageResolvableOperator.h>
10#include <SupportDefs.h>
11
12
13using namespace BPackageKit;
14
15
16class Version {
17public:
18								Version();
19								~Version();
20
21			status_t			Init(const char* major, const char* minor,
22									const char* micro, const char* preRelease,
23									uint8 release);
24
25	static	status_t			Create(const char* major, const char* minor,
26									const char* micro, const char* preRelease,
27									uint8 release, Version*& _version);
28
29			int					Compare(const Version& other) const;
30			bool				Compare(BPackageResolvableOperator op,
31									const Version& other) const;
32
33			size_t				ToString(char* buffer, size_t bufferSize) const;
34									// returns how big the buffer should have
35									// been (excluding the terminating null)
36
37private:
38			char*				fMajor;
39			char*				fMinor;
40			char*				fMicro;
41			char*				fPreRelease;
42			uint8				fRelease;
43};
44
45
46#endif	// VERSION_H
47