#pragma once /* * Copyright Onix Solutions Limited [OnixS]. All rights reserved. * * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law * and international copyright treaties. * * Access to and use of the software is governed by the terms of the applicable OnixS Software * Services Agreement (the Agreement) and Customer end user license agreements granting * a non-assignable, non-transferable and non-exclusive license to use the software * for it's own data processing purposes under the terms defined in the Agreement. * * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part * of this source code or associated reference material to any other location for further reproduction * or redistribution, and any amendments to this copyright notice, are expressly prohibited. * * Any reproduction or redistribution for sale or hiring of the Software not in accordance with * the terms of the Agreement is a violation of copyright law. */ #include #include #include namespace OnixS { namespace FIX { /// Alias for the numeric component of the version. typedef unsigned short VersionComponent; /// Identifies the version of the product. /// /// Provides an access to single components which compound the whole version, /// comparing and serialization/deserialization facilities. class ONIXS_FIXENGINE_API Version { public: /// Initializes instances from all the components. Version( VersionComponent majorNumber, VersionComponent minorNumber, VersionComponent improvement, VersionComponent build); /// The 'major' component of the version. VersionComponent majorNumber() const; /// The 'minor' component of the version. VersionComponent minorNumber() const; /// The 'improvement' component of the version. VersionComponent improvement() const; /// The 'build number' component of the version. VersionComponent build() const; /// Compares with other instance for the equality. bool operator ==(const Version &) const; /// Compares with other instance for the inequality. bool operator !=(const Version &) const; /// Checks whether the version is less then the other. bool operator <(const Version &) const; /// Checks whether the version is grater then the other. bool operator >(const Version &) const; /// Serializes into the point-separated presentation. void toString(std::string &) const; /// Serializes into the point-separated presentation. std::string toString() const; /// Extracts the version from the point-separated presentation. /// Updates the version parameter if the buffer is parsed successfully. static bool parse(const char *, size_t, Version &); /// Identifies the current version of the product. static Version current(); private: VersionComponent major_; VersionComponent minor_; VersionComponent improvement_; VersionComponent build_; }; ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &, Version const &); } }