Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
version.h
1/***************************************************************************
2 copyright : (C) 2002-2008 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: version.h,v 1.9 2008-10-07 11:06:26 tat Exp $
6 ***************************************************************************/
7#ifndef _MIMETIC_VERSION_H_
8#define _MIMETIC_VERSION_H_
9#include <string>
10#include <iostream>
11
12namespace mimetic
13{
14struct Version;
15
16
17// library version
18extern const Version version;
19
20
21// major & minor are macro defined in /usr/include/sys/sysmacros.h (linux)
22// so we'll use maj & min instead
23
24/// A three levels version string class
25/**
26 format:
27 maj.min[.build]
28 \d+\.\d+(\.\d+)?
29 es. 1.1, 1.23.5, 1.2.3, 1.2.3, 1.11
30 22.1.3, 0.1.234
31*/
32struct Version
33{
34 typedef unsigned int ver_type;
35 Version();
36 Version(const std::string&);
37 Version(ver_type, ver_type, ver_type build = 0);
38 void maj(ver_type);
39 void min(ver_type);
40 void build(ver_type);
41 ver_type maj() const;
42 ver_type min() const;
43 ver_type build() const;
44
45 void set(ver_type, ver_type, ver_type build = 0);
46 void set(const std::string&);
47 std::string str() const;
48
49 bool operator==(const Version&) const;
50 bool operator!=(const Version&) const;
51 bool operator<(const Version&) const;
52 bool operator>(const Version&) const;
53 bool operator<=(const Version&) const;
54 bool operator>=(const Version&) const;
55 friend std::ostream& operator<<(std::ostream&, const Version&);
56protected:
57 ver_type m_maj, m_min, m_build;
58};
59
60}
61
62#endif
63
Definition body.h:18
A three levels version string class.
Definition version.h:33