OnixS C++ CME MDP Streamlined Market Data Handler 1.2.0
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
36{
37public:
40
46 : major_(major)
47 , minor_(minor)
48 , patch_(patch)
49 {
50 }
51
54 const Version& other)
55 : major_(other.major_)
56 , minor_(other.minor_)
57 , patch_(other.patch_)
58 {
59 }
60
63 {
64 return major_;
65 }
66
69 {
70 return minor_;
71 }
72
75 {
76 return patch_;
77 }
78
80 Version&
81 operator =(
82 const Version& other)
83 {
84 major_ = other.major_;
85 minor_ = other.minor_;
86 patch_ = other.patch_;
87
88 return *this;
89 }
90
93 static Version current();
94
95private:
96 Component major_;
97 Component minor_;
98 Component patch_;
99};
100
102inline
103bool
104operator ==(
105 const Version& left,
106 const Version& right)
107{
108 return
109 (
110 left.major() == right.major() &&
111 left.minor() == right.minor() &&
112 left.patch() == right.patch()
113 );
114}
115
116inline
117bool
118operator !=(
119 const Version& left,
120 const Version& right)
121{
122 return !(left == right);
123}
124
125inline
126bool
127operator <(
128 const Version& left,
129 const Version& right)
130{
131 return (
132 left.major() < right.major()
133 || (
134 left.major() == right.major()
135 &&
136 left.minor() < right.minor())
137 || (
138 left.major() == right.major()
139 &&
140 left.minor() == right.minor()
141 &&
142 left.patch() < right.patch())
143 );
144}
145
146inline
147bool
148operator >(
149 const Version& left,
150 const Version& right)
151{
152 return (right < left);
153}
154
158bool
160 const Char*,
161 size_t,
162 Version&);
163
166void
168 std::string&,
169 const Version&);
170
172inline
173std::string
175 const Version& version)
176{
177 std::string str;
178
179 toStr(str, version);
180
181 return str;
182}
183
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:169
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition Bootstrap.h:173
#define ONIXS_CMESTREAMLINEDMDH_LTWT_EXPORTED
Definition Bootstrap.h:119
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS
Definition Bootstrap.h:111
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED
Definition Compiler.h:160
Identifies version of the product.
Definition Version.h:36
Component major() const
'major' component of version.
Definition Version.h:62
Version(const Version &other)
Initializes as clone of other instance.
Definition Version.h:53
static Version current()
Identifies current version of the product.
Component patch() const
'patch' component of version.
Definition Version.h:74
UInt16 Component
Alias for the numeric component of version.
Definition Version.h:39
Version(Component major, Component minor, Component patch)
Initializes instances from all the components.
Definition Version.h:42
Component minor() const
'minor' component of version.
Definition Version.h:68
char Char
Character type alias.
Definition String.h:36
void toStr(std::string &str, const Decimal &number)
Definition Decimal.h:502
bool fromStr(Decimal &, const char *, size_t)