PVersion.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
26 class PAPILLON_API_CORE PVersion : public PObject
27 {
28 public:
35  explicit PVersion(papillon::int32 major = 0, papillon::int32 minor = 0, papillon::int32 maintenance = 0, papillon::int32 build = 0);
36 
43  explicit PVersion(const PString& strVersion);
44 
48  PVersion(const PVersion& other);
49 
53  virtual ~PVersion();
54 
58  PVersion& operator=(const PVersion& other);
59 
64  bool IsNull() const;
65 
69  bool IsDebug() const;
70 
74  bool IsRelease() const;
75 
79  bool IsX64() const;
80 
84  bool IsX86() const;
85 
90  papillon::int32 GetMajor() const;
91 
96  papillon::int32 GetMinor() const;
97 
102  papillon::int32 GetMaintenance() const;
103 
108  papillon::int32 GetBuild() const;
109 
115  papillon::int32 Compare(const PVersion& other) const;
116 
120  bool operator!=(const PVersion& v) const;
121 
125  bool operator<(const PVersion& v) const;
126 
130  bool operator<=(const PVersion& v) const;
131 
135  bool operator==(const PVersion& v) const;
136 
140  bool operator>(const PVersion& v) const;
141 
145  bool operator>=(const PVersion& v) const;
146 
150  static const PVersion& Null() { static const PVersion C_NULL(0, 0, 0, 0); return C_NULL; }
151 
155  PString ToStringMajorMinor() const;
156 
160  PString ToString4Numbers() const;
161 
165  PString ToStringShort() const;
166 
167 private:
176  void Set(papillon::int32 major, papillon::int32 minor, papillon::int32 maintenance = 0, papillon::int32 build = 0);
177 };
178 
179 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PVersion class represents a software version number: major.minor[.maintenance[.build]]; immutable, so thread-safe.
Definition: PVersion.h:26
static const PVersion & Null()
Returns the constant holding the "0.0.0.0" (invalid) version number.
Definition: PVersion.h:150
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45