OnixS C++ FIX Engine  4.2.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 version.
29 typedef unsigned short VersionComponent;
30 
31 /// Identifies version of the product.
32 ///
33 /// Provides access to single components which compound 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  /// Initializes as clone of other instance.
46  Version(const Version & other);
47 
48  /// Re-initializes instance as copy of other one.
49  Version & operator =(const Version &);
50 
51  /// 'major' component of version.
52  VersionComponent majorNumber() const;
53 
54  /// 'minor' component of version.
55  VersionComponent minorNumber() const;
56 
57  /// 'improvement' component of version.
58  VersionComponent improvement() const;
59 
60  /// 'build number' component of version.
61  VersionComponent build() const;
62 
63  /// Compares with other instance for equality.
64  bool operator ==(const Version &) const;
65 
66  /// Compares with other instance for inequality.
67  bool operator !=(const Version &) const;
68 
69  /// Checks whether the version is less then the other.
70  bool operator <(const Version &) const;
71 
72  /// Checks whether the version is grater then the other.
73  bool operator >(const Version &) const;
74 
75  /// Serializes into point-separated presentation.
76  void toString(std::string &) const;
77 
78  /// Serializes into point-separated presentation.
79  std::string toString() const;
80 
81  /// Extracts version from point-separated presentation.
82  /// Updates version parameter if buffer is parsed successfully.
83  static bool parse(const char *, size_t, Version &);
84 
85  /// Identifies current version of the product.
86  static Version current();
87 
88 private:
89  VersionComponent major_;
90  VersionComponent minor_;
91  VersionComponent improvement_;
92  VersionComponent build_;
93 };
94 
95 ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &, Version const &);
96 }
97 }
bool operator!=(const FieldValueRef &ref, const std::string &str)
ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &os, const Group &group)
Stream output.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
unsigned short VersionComponent
Alias for the numeric component of version.
Definition: Version.h:29
Identifies version of the product.
Definition: Version.h:35
bool operator==(const FieldValueRef &ref, const std::string &str)