OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
Version.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
23#include <string>
24
27
29
32
39{
40 VersionComponent major_;
41 VersionComponent minor_;
42 VersionComponent patch_;
43
44public:
46 typedef
49
55 : major_(major)
56 , minor_(minor)
57 , patch_(patch)
58 {
59 }
60
63 const Version& other)
64 : major_(other.major_)
65 , minor_(other.minor_)
66 , patch_(other.patch_)
67 {
68 }
69
71 Component (major)() const
72 {
73 return major_;
74 }
75
77 Component (minor)() const
78 {
79 return minor_;
80 }
81
84 {
85 return patch_;
86 }
87
90 Version&
91 operator =(
92 const Version& other)
93 {
94 major_ = other.major_;
95 minor_ = other.minor_;
96 patch_ = other.patch_;
97
98 return *this;
99 }
100
103 static Version current();
104};
105
107inline
108bool
109operator ==(
110 const Version& left,
111 const Version& right)
112{
113 return
114 (
115 (left.major)() == (right.major)() &&
116 (left.minor)() == (right.minor)() &&
117 left.patch() == right.patch()
118 );
119}
120
122inline
123bool
124operator !=(
125 const Version& left,
126 const Version& right)
127{
128 return !(left == right);
129}
130
133inline
134bool
135operator <(
136 const Version& left,
137 const Version& right)
138{
139 return (
140 (left.major)() < (right.major)()
141 || (
142 (left.major)() == (right.major)()
143 &&
144 (left.minor)() < (right.minor)())
145 || (
146 (left.major)() == (right.major)()
147 &&
148 (left.minor)() == (right.minor)()
149 &&
150 left.patch() < right.patch())
151 );
152}
153
156inline
157bool
158operator >(
159 const Version& left,
160 const Version& right)
161{
162 return (right < left);
163}
164
167ONIXS_CONFLATEDUDP_EXPORTED
168bool
170 const Char*,
171 size_t,
172 Version&);
173
175ONIXS_CONFLATEDUDP_EXPORTED
176void
178 std::string&,
179 const Version&);
180
182inline
183std::string
185 const Version& version)
186{
187 std::string str;
188
189 toStr(str, version);
190
191 return str;
192}
193
#define ONIXS_CONFLATEDUDP_LTWT_EXPORTED
Definition Bootstrap.h:103
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
static ONIXS_CONFLATEDUDP_EXPORTED Version current()
Identifies the current version of the product.
Component major() const
'major' component of the version.
Definition Version.h:71
Version(const Version &other)
Initializes as a copy of the other instance.
Definition Version.h:62
VersionComponent Component
Alias for the numeric component.
Definition Version.h:48
Component patch() const
'patch' component of the version.
Definition Version.h:83
Version(Component major, Component minor, Component patch)
Initializes the instance from the given components.
Definition Version.h:51
Component minor() const
'minor' component of the version.
Definition Version.h:77
ONIXS_CONFLATEDUDP_EXPORTED bool fromStr(Decimal &, const Char *, size_t)
ONIXS_CONFLATEDUDP_EXPORTED void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
char Char
Character type alias.
Definition String.h:36
UInt16 VersionComponent
Alias for the version numeric component.
Definition Version.h:31
UInt16 UInt16
uInt16.
Definition Fields.h:257