| 1 | #ifndef BOOST_SERIALIZATION_LIBRARY_VERSION_TYPE_HPP |
| 2 | #define BOOST_SERIALIZATION_LIBRARY_VERSION_TYPE_HPP |
| 3 | |
| 4 | // MS compatible compilers support #pragma once |
| 5 | #if defined(_MSC_VER) |
| 6 | # pragma once |
| 7 | #endif |
| 8 | |
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
| 10 | // library_version_type.hpp: |
| 11 | |
| 12 | // (C) Copyright 2002-2020 Robert Ramey - http://www.rrsd.com . |
| 13 | // Use, modification and distribution is subject to the Boost Software |
| 14 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 15 | // http://www.boost.org/LICENSE_1_0.txt) |
| 16 | |
| 17 | // See http://www.boost.org for updates, documentation, and revision history. |
| 18 | #include <cstring> // count |
| 19 | #include <boost/cstdint.hpp> // uint_least16_t |
| 20 | #include <boost/assert.hpp> |
| 21 | #include <boost/config.hpp> |
| 22 | #include <boost/integer_traits.hpp> |
| 23 | |
| 24 | namespace boost { |
| 25 | namespace serialization { |
| 26 | |
| 27 | #if defined(_MSC_VER) |
| 28 | #pragma warning( push ) |
| 29 | #pragma warning( disable : 4244 4267 ) |
| 30 | #endif |
| 31 | |
| 32 | /* NOTE : Warning : Warning : Warning : Warning : Warning |
| 33 | * Don't ever changes this. If you do, they previously created |
| 34 | * binary archives won't be readable !!! |
| 35 | */ |
| 36 | class library_version_type { |
| 37 | private: |
| 38 | typedef uint_least16_t base_type; |
| 39 | base_type t; |
| 40 | public: |
| 41 | library_version_type(): t(0) {} |
| 42 | explicit library_version_type(const unsigned int & t_) : t(t_){ |
| 43 | BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max); |
| 44 | } |
| 45 | library_version_type(const library_version_type & t_) : |
| 46 | t(t_.t) |
| 47 | {} |
| 48 | library_version_type & operator=(const library_version_type & rhs){ |
| 49 | t = rhs.t; |
| 50 | return *this; |
| 51 | } |
| 52 | // used for text output |
| 53 | operator base_type () const { |
| 54 | return t; |
| 55 | } |
| 56 | // used for text input |
| 57 | operator base_type & (){ |
| 58 | return t; |
| 59 | } |
| 60 | bool operator==(const library_version_type & rhs) const { |
| 61 | return t == rhs.t; |
| 62 | } |
| 63 | bool operator<(const library_version_type & rhs) const { |
| 64 | return t < rhs.t; |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | } // serialization |
| 69 | } // boost |
| 70 | |
| 71 | #endif // BOOST_SERIALIZATION_LIBRARY_VERSION_TYPE_HPP |
| 72 | |