OnixS C++ FIX Engine  4.12.0
API Documentation
Version.h
Go to the documentation of this file.
1 #pragma once
2 /*
3 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
4 *
5 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
6 * and international copyright treaties.
7 *
8 * Access to and use of the software is governed by the terms of the applicable OnixS Software
9 * Services Agreement (the Agreement) and Customer end user license agreements granting
10 * a non-assignable, non-transferable and non-exclusive license to use the software
11 * for it's own data processing purposes under the terms defined in the Agreement.
12 *
13 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
14 * of this source code or associated reference material to any other location for further reproduction
15 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
16 *
17 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18 * the terms of the Agreement is a violation of copyright law.
19 */
20 
21 #include <OnixS/FIXEngine/ABI.h>
22 
23 #include <iosfwd>
24 #include <string>
25 
26 namespace OnixS {
27 namespace FIX {
28 /// Alias for the numeric component of the version.
29 typedef unsigned short VersionComponent;
30 
31 /// Identifies the version of the product.
32 ///
33 /// Provides an access to single components which compound the whole version,
34 /// comparing and serialization/deserialization facilities.
36 {
37 public:
38  /// Initializes instances from all the components.
39  Version(
40  VersionComponent majorNumber,
41  VersionComponent minorNumber,
42  VersionComponent improvement,
43  VersionComponent build);
44 
45  /// The 'major' component of the version.
46  VersionComponent majorNumber() const;
47 
48  /// The 'minor' component of the version.
49  VersionComponent minorNumber() const;
50 
51  /// The 'improvement' component of the version.
52  VersionComponent improvement() const;
53 
54  /// The 'build number' component of the version.
55  VersionComponent build() const;
56 
57  /// Compares with other instance for the equality.
58  bool operator ==(const Version &) const;
59 
60  /// Compares with other instance for the inequality.
61  bool operator !=(const Version &) const;
62 
63  /// Checks whether the version is less then the other.
64  bool operator <(const Version &) const;
65 
66  /// Checks whether the version is grater then the other.
67  bool operator >(const Version &) const;
68 
69  /// Serializes into the point-separated presentation.
70  void toString(std::string &) const;
71 
72  /// Serializes into the point-separated presentation.
73  std::string toString() const;
74 
75  /// Extracts the version from the point-separated presentation.
76  /// Updates the version parameter if the buffer is parsed successfully.
77  static bool parse(const char *, size_t, Version &);
78 
79  /// Identifies the current version of the product.
80  static Version current();
81 
82 private:
83  VersionComponent major_;
84  VersionComponent minor_;
85  VersionComponent improvement_;
86  VersionComponent build_;
87 };
88 
89 ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &, Version const &);
90 }
91 }
ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &os, const Group &group)
Stream output.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
Identifies the version of the product.
Definition: Version.h:35
bool operator==(const FieldValueRef &ref, const std::string &str)
unsigned short VersionComponent
Alias for the numeric component of the version.
Definition: Version.h:29
bool operator!=(const FieldValueRef &ref, const std::string &str)