summaryrefslogtreecommitdiffstats
path: root/api/logic/java/JavaVersion.h
blob: 8589c21a497ddb0672ce8c5ee52aa5cc61f02468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "multimc_logic_export.h"
#include <QString>

// NOTE: apparently the GNU C library pollutes the global namespace with these... undef them.
#ifdef major
    #undef major
#endif
#ifdef minor
    #undef minor
#endif

class MULTIMC_LOGIC_EXPORT JavaVersion
{
    friend class JavaVersionTest;
public:
    JavaVersion() {};
    JavaVersion(const QString & rhs);

    JavaVersion & operator=(const QString & rhs);

    bool operator<(const JavaVersion & rhs);
    bool operator==(const JavaVersion & rhs);
    bool operator>(const JavaVersion & rhs);

    bool requiresPermGen();

    QString toString();

    int major()
    {
        return m_major;
    }
    int minor()
    {
        return m_minor;
    }
    int security()
    {
        return m_security;
    }
private:
    QString m_string;
    int m_major = 0;
    int m_minor = 0;
    int m_security = 0;
    bool m_parseable = false;
    QString m_prerelease;
};