annotate dep/semver/semver.hpp @ 327:b5d6c27c308f

anime: refactor Anime::SeriesSeason to Season class ToLocalString has also been altered to take in both season and year because lots of locales actually treat formatting seasons differently! most notably is Russian which adds a suffix at the end to notate seasons(??)
author Paper <paper@paper.us.eu.org>
date Thu, 13 Jun 2024 01:49:18 -0400
parents b9f111d84d95
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
222
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 // _____ _ _
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 // / ____| | | (_)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3 // | (___ ___ _ __ ___ __ _ _ __ | |_ _ ___
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 // \___ \ / _ \ '_ ` _ \ / _` | '_ \| __| |/ __|
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5 // ____) | __/ | | | | | (_| | | | | |_| | (__
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6 // |_____/ \___|_| |_| |_|\__,_|_| |_|\__|_|\___|
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7 // __ __ _ _ _____
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 // \ \ / / (_) (_) / ____|_ _
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9 // \ \ / /__ _ __ ___ _ ___ _ __ _ _ __ __ _ | | _| |_ _| |_
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10 // \ \/ / _ \ '__/ __| |/ _ \| '_ \| | '_ \ / _` | | | |_ _|_ _|
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11 // \ / __/ | \__ \ | (_) | | | | | | | | (_| | | |____|_| |_|
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 // \/ \___|_| |___/_|\___/|_| |_|_|_| |_|\__, | \_____|
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13 // https://github.com/Neargye/semver __/ |
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14 // version 0.3.0 |___/
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15 //
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
16 // Licensed under the MIT License <http://opensource.org/licenses/MIT>.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17 // SPDX-License-Identifier: MIT
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 // Copyright (c) 2018 - 2021 Daniil Goncharov <neargye@gmail.com>.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19 // Copyright (c) 2020 - 2021 Alexander Gorbunov <naratzul@gmail.com>.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 //
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21 // Permission is hereby granted, free of charge, to any person obtaining a copy
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 // of this software and associated documentation files (the "Software"), to deal
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23 // in the Software without restriction, including without limitation the rights
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25 // copies of the Software, and to permit persons to whom the Software is
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26 // furnished to do so, subject to the following conditions:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27 //
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28 // The above copyright notice and this permission notice shall be included in all
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29 // copies or substantial portions of the Software.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 //
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37 // SOFTWARE.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39 #ifndef NEARGYE_SEMANTIC_VERSIONING_HPP
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
40 #define NEARGYE_SEMANTIC_VERSIONING_HPP
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
41
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
42 #define SEMVER_VERSION_MAJOR 0
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
43 #define SEMVER_VERSION_MINOR 3
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
44 #define SEMVER_VERSION_PATCH 0
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
45
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
46 #include <cstddef>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
47 #include <cstdint>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
48 #include <iosfwd>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
49 #include <limits>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
50 #include <optional>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
51 #include <string>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
52 #include <string_view>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
53 #if __has_include(<charconv>)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
54 #include <charconv>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
55 #else
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
56 #include <system_error>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
57 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
58
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
59 #if defined(SEMVER_CONFIG_FILE)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
60 #include SEMVER_CONFIG_FILE
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
61 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
62
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
63 #if defined(SEMVER_THROW)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
64 // define SEMVER_THROW(msg) to override semver throw behavior.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
65 #elif defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
66 # include <stdexcept>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
67 # define SEMVER_THROW(msg) (throw std::invalid_argument{msg})
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
68 #else
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
69 # include <cassert>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
70 # include <cstdlib>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
71 # define SEMVER_THROW(msg) (assert(!msg), std::abort())
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
72 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
73
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
74 #if defined(__clang__)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
75 # pragma clang diagnostic push
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
76 # pragma clang diagnostic ignored "-Wmissing-braces" // Ignore warning: suggest braces around initialization of subobject 'return {first, std::errc::invalid_argument};'.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
77 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
78
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
79 #if __cpp_impl_three_way_comparison >= 201907L
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
80 #include <compare>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
81 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
82
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
83
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
84 namespace semver {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
85
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
86 enum struct prerelease : std::uint8_t {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
87 alpha = 0,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
88 beta = 1,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
89 rc = 2,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
90 none = 3
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
91 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
92
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
93 #if __has_include(<charconv>)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
94 struct from_chars_result : std::from_chars_result {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
95 [[nodiscard]] constexpr operator bool() const noexcept { return ec == std::errc{}; }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
96 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
97
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
98 struct to_chars_result : std::to_chars_result {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
99 [[nodiscard]] constexpr operator bool() const noexcept { return ec == std::errc{}; }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
100 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
101 #else
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
102 struct from_chars_result {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
103 const char* ptr;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
104 std::errc ec;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
105
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
106 [[nodiscard]] constexpr operator bool() const noexcept { return ec == std::errc{}; }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
107 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
108
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
109 struct to_chars_result {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
110 char* ptr;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
111 std::errc ec;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
112
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
113 [[nodiscard]] constexpr operator bool() const noexcept { return ec == std::errc{}; }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
114 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
115 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
116
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
117 // Max version string length = 5(<major>) + 1(.) + 5(<minor>) + 1(.) + 5(<patch>) + 1(-) + 5(<prerelease>) + 1(.) + 5(<prereleaseversion>) = 29.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
118 inline constexpr auto max_version_string_length = std::size_t{29};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
119
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
120 namespace detail {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
121
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
122 inline constexpr auto alpha = std::string_view{"alpha", 5};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
123 inline constexpr auto beta = std::string_view{"beta", 4};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
124 inline constexpr auto rc = std::string_view{"rc", 2};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
125
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
126 // Min version string length = 1(<major>) + 1(.) + 1(<minor>) + 1(.) + 1(<patch>) = 5.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
127 inline constexpr auto min_version_string_length = 5;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
128
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
129 constexpr char to_lower(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
130 return (c >= 'A' && c <= 'Z') ? static_cast<char>(c + ('a' - 'A')) : c;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
131 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
132
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
133 constexpr bool is_digit(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
134 return c >= '0' && c <= '9';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
135 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
136
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
137 constexpr bool is_space(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
138 return c == ' ';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
139 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
140
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
141 constexpr bool is_operator(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
142 return c == '<' || c == '>' || c == '=';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
143 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
144
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
145 constexpr bool is_dot(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
146 return c == '.';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
147 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
148
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
149 constexpr bool is_logical_or(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
150 return c == '|';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
151 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
152
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
153 constexpr bool is_hyphen(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
154 return c == '-';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
155 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
156
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
157 constexpr bool is_letter(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
158 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
159 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
160
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
161 constexpr std::uint16_t to_digit(char c) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
162 return static_cast<std::uint16_t>(c - '0');
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
163 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
164
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
165 constexpr std::uint8_t length(std::uint16_t x) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
166 if (x < 10) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
167 return 1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
168 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
169 if (x < 100) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
170 return 2;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
171 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
172 if (x < 1000) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
173 return 3;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
174 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
175 if (x < 10000) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
176 return 4;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
177 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
178 return 5;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
179 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
180
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
181 constexpr std::uint8_t length(prerelease t) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
182 if (t == prerelease::alpha) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
183 return static_cast<std::uint8_t>(alpha.length());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
184 } else if (t == prerelease::beta) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
185 return static_cast<std::uint8_t>(beta.length());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
186 } else if (t == prerelease::rc) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
187 return static_cast<std::uint8_t>(rc.length());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
188 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
189
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
190 return 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
191 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
192
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
193 constexpr bool equals(const char* first, const char* last, std::string_view str) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
194 for (std::size_t i = 0; first != last && i < str.length(); ++i, ++first) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
195 if (to_lower(*first) != to_lower(str[i])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
196 return false;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
197 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
198 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
199
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
200 return true;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
201 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
202
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
203 constexpr char* to_chars(char* str, std::uint16_t x, bool dot = true) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
204 do {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
205 *(--str) = static_cast<char>('0' + (x % 10));
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
206 x /= 10;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
207 } while (x != 0);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
208
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
209 if (dot) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
210 *(--str) = '.';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
211 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
212
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
213 return str;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
214 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
215
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
216 constexpr char* to_chars(char* str, prerelease t) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
217 const auto p = t == prerelease::alpha
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
218 ? alpha
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
219 : t == prerelease::beta
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
220 ? beta
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
221 : t == prerelease::rc
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
222 ? rc
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
223 : std::string_view{};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
224
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
225 if (p.size() > 0) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
226 for (auto it = p.rbegin(); it != p.rend(); ++it) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
227 *(--str) = *it;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
228 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
229 *(--str) = '-';
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
230 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
231
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
232 return str;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
233 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
234
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
235 constexpr const char* from_chars(const char* first, const char* last, std::uint16_t& d) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
236 if (first != last && is_digit(*first)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
237 std::int32_t t = 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
238 for (; first != last && is_digit(*first); ++first) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
239 t = t * 10 + to_digit(*first);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
240 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
241 if (t <= (std::numeric_limits<std::uint16_t>::max)()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
242 d = static_cast<std::uint16_t>(t);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
243 return first;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
244 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
245 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
246
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
247 return nullptr;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
248 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
249
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
250 constexpr const char* from_chars(const char* first, const char* last, std::optional<std::uint16_t>& d) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
251 if (first != last && is_digit(*first)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
252 std::int32_t t = 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
253 for (; first != last && is_digit(*first); ++first) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
254 t = t * 10 + to_digit(*first);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
255 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
256 if (t <= (std::numeric_limits<std::uint16_t>::max)()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
257 d = static_cast<std::uint16_t>(t);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
258 return first;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
259 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
260 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
261
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
262 return nullptr;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
263 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
264
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
265 constexpr const char* from_chars(const char* first, const char* last, prerelease& p) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
266 if (is_hyphen(*first)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
267 ++first;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
268 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
269
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
270 if (equals(first, last, alpha)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
271 p = prerelease::alpha;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
272 return first + alpha.length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
273 } else if (equals(first, last, beta)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
274 p = prerelease::beta;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
275 return first + beta.length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
276 } else if (equals(first, last, rc)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
277 p = prerelease::rc;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
278 return first + rc.length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
279 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
280
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
281 return nullptr;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
282 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
283
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
284 constexpr bool check_delimiter(const char* first, const char* last, char d) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
285 return first != last && first != nullptr && *first == d;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
286 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
287
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
288 template <typename T, typename = void>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
289 struct resize_uninitialized {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
290 static auto resize(T& str, std::size_t size) -> std::void_t<decltype(str.resize(size))> {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
291 str.resize(size);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
292 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
293 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
294
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
295 template <typename T>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
296 struct resize_uninitialized<T, std::void_t<decltype(std::declval<T>().__resize_default_init(42))>> {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
297 static void resize(T& str, std::size_t size) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
298 str.__resize_default_init(size);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
299 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
300 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
301
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
302 } // namespace semver::detail
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
303
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
304 struct version {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
305 std::uint16_t major = 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
306 std::uint16_t minor = 1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
307 std::uint16_t patch = 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
308 prerelease prerelease_type = prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
309 std::optional<std::uint16_t> prerelease_number = std::nullopt;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
310
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
311 constexpr version(std::uint16_t mj,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
312 std::uint16_t mn,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
313 std::uint16_t pt,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
314 prerelease prt = prerelease::none,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
315 std::optional<std::uint16_t> prn = std::nullopt) noexcept
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
316 : major{mj},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
317 minor{mn},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
318 patch{pt},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
319 prerelease_type{prt},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
320 prerelease_number{prt == prerelease::none ? std::nullopt : prn} {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
321 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
322
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
323 constexpr version(std::uint16_t mj,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
324 std::uint16_t mn,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
325 std::uint16_t pt,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
326 prerelease prt,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
327 std::uint16_t prn) noexcept
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
328 : major{mj},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
329 minor{mn},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
330 patch{pt},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
331 prerelease_type{prt},
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
332 prerelease_number{prt == prerelease::none ? std::nullopt : std::make_optional<std::uint16_t>(prn)} {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
333 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
334
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
335 explicit constexpr version(std::string_view str) : version(0, 0, 0, prerelease::none, std::nullopt) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
336 from_string(str);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
337 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
338
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
339 constexpr version() = default; // https://semver.org/#how-should-i-deal-with-revisions-in-the-0yz-initial-development-phase
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
340
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
341 constexpr version(const version&) = default;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
342
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
343 constexpr version(version&&) = default;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
344
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
345 ~version() = default;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
346
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
347 version& operator=(const version&) = default;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
348
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
349 version& operator=(version&&) = default;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
350
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
351 [[nodiscard]] constexpr from_chars_result from_chars(const char* first, const char* last) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
352 if (first == nullptr || last == nullptr || (last - first) < detail::min_version_string_length) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
353 return {first, std::errc::invalid_argument};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
354 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
355
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
356 auto next = first;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
357 if (next = detail::from_chars(next, last, major); detail::check_delimiter(next, last, '.')) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
358 if (next = detail::from_chars(++next, last, minor); detail::check_delimiter(next, last, '.')) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
359 if (next = detail::from_chars(++next, last, patch); next == last) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
360 prerelease_type = prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
361 prerelease_number = {};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
362 return {next, std::errc{}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
363 } else if (detail::check_delimiter(next, last, '-')) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
364 if (next = detail::from_chars(next, last, prerelease_type); next == last) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
365 prerelease_number = {};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
366 return {next, std::errc{}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
367 } else if (detail::check_delimiter(next, last, '.')) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
368 if (next = detail::from_chars(++next, last, prerelease_number); next == last) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
369 return {next, std::errc{}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
370 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
371 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
372 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
373 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
374 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
375
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
376 return {first, std::errc::invalid_argument};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
377 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
378
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
379 [[nodiscard]] constexpr to_chars_result to_chars(char* first, char* last) const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
380 const auto length = string_length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
381 if (first == nullptr || last == nullptr || (last - first) < length) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
382 return {last, std::errc::value_too_large};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
383 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
384
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
385 auto next = first + length;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
386 if (prerelease_type != prerelease::none) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
387 if (prerelease_number.has_value()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
388 next = detail::to_chars(next, prerelease_number.value());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
389 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
390 next = detail::to_chars(next, prerelease_type);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
391 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
392 next = detail::to_chars(next, patch);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
393 next = detail::to_chars(next, minor);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
394 next = detail::to_chars(next, major, false);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
395
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
396 return {first + length, std::errc{}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
397 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
398
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
399 [[nodiscard]] constexpr bool from_string_noexcept(std::string_view str) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
400 return from_chars(str.data(), str.data() + str.length());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
401 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
402
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
403 constexpr version& from_string(std::string_view str) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
404 if (!from_string_noexcept(str)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
405 SEMVER_THROW("semver::version::from_string invalid version.");
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
406 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
407
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
408 return *this;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
409 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
410
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
411 [[nodiscard]] std::string to_string() const {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
412 auto str = std::string{};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
413 detail::resize_uninitialized<std::string>::resize(str, string_length());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
414 if (!to_chars(str.data(), str.data() + str.length())) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
415 SEMVER_THROW("semver::version::to_string invalid version.");
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
416 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
417
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
418 return str;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
419 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
420
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
421 [[nodiscard]] constexpr std::uint8_t string_length() const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
422 // (<major>) + 1(.) + (<minor>) + 1(.) + (<patch>)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
423 auto length = detail::length(major) + detail::length(minor) + detail::length(patch) + 2;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
424 if (prerelease_type != prerelease::none) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
425 // + 1(-) + (<prerelease>)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
426 length += detail::length(prerelease_type) + 1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
427 if (prerelease_number.has_value()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
428 // + 1(.) + (<prereleaseversion>)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
429 length += detail::length(prerelease_number.value()) + 1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
430 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
431 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
432
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
433 return static_cast<std::uint8_t>(length);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
434 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
435
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
436 [[nodiscard]] constexpr int compare(const version& other) const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
437 if (major != other.major) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
438 return major - other.major;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
439 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
440
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
441 if (minor != other.minor) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
442 return minor - other.minor;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
443 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
444
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
445 if (patch != other.patch) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
446 return patch - other.patch;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
447 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
448
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
449 if (prerelease_type != other.prerelease_type) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
450 return static_cast<std::uint8_t>(prerelease_type) - static_cast<std::uint8_t>(other.prerelease_type);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
451 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
452
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
453 if (prerelease_number.has_value()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
454 if (other.prerelease_number.has_value()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
455 return prerelease_number.value() - other.prerelease_number.value();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
456 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
457 return 1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
458 } else if (other.prerelease_number.has_value()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
459 return -1;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
460 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
461
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
462 return 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
463 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
464 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
465
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
466 [[nodiscard]] constexpr bool operator==(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
467 return lhs.compare(rhs) == 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
468 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
469
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
470 [[nodiscard]] constexpr bool operator!=(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
471 return lhs.compare(rhs) != 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
472 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
473
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
474 [[nodiscard]] constexpr bool operator>(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
475 return lhs.compare(rhs) > 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
476 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
477
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
478 [[nodiscard]] constexpr bool operator>=(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
479 return lhs.compare(rhs) >= 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
480 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
481
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
482 [[nodiscard]] constexpr bool operator<(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
483 return lhs.compare(rhs) < 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
484 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
485
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
486 [[nodiscard]] constexpr bool operator<=(const version& lhs, const version& rhs) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
487 return lhs.compare(rhs) <= 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
488 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
489
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
490 #if __cpp_impl_three_way_comparison >= 201907L
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
491 [[nodiscard]] constexpr std::strong_ordering operator<=>(const version& lhs, const version& rhs) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
492 int compare = lhs.compare(rhs);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
493 if ( compare == 0 )
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
494 return std::strong_ordering::equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
495 if ( compare > 0 )
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
496 return std::strong_ordering::greater;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
497 return std::strong_ordering::less;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
498 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
499 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
500
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
501 [[nodiscard]] constexpr version operator""_version(const char* str, std::size_t length) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
502 return version{std::string_view{str, length}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
503 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
504
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
505 [[nodiscard]] constexpr bool valid(std::string_view str) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
506 return version{}.from_string_noexcept(str);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
507 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
508
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
509 [[nodiscard]] constexpr from_chars_result from_chars(const char* first, const char* last, version& v) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
510 return v.from_chars(first, last);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
511 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
512
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
513 [[nodiscard]] constexpr to_chars_result to_chars(char* first, char* last, const version& v) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
514 return v.to_chars(first, last);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
515 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
516
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
517 [[nodiscard]] constexpr std::optional<version> from_string_noexcept(std::string_view str) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
518 if (version v{}; v.from_string_noexcept(str)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
519 return v;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
520 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
521
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
522 return std::nullopt;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
523 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
524
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
525 [[nodiscard]] constexpr version from_string(std::string_view str) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
526 return version{str};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
527 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
528
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
529 [[nodiscard]] inline std::string to_string(const version& v) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
530 return v.to_string();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
531 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
532
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
533 template <typename Char, typename Traits>
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
534 inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const version& v) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
535 for (const auto c : v.to_string()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
536 os.put(c);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
537 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
538
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
539 return os;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
540 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
541
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
542 inline namespace comparators {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
543
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
544 enum struct comparators_option : std::uint8_t {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
545 exclude_prerelease,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
546 include_prerelease
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
547 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
548
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
549 [[nodiscard]] constexpr int compare(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
550 if (option == comparators_option::exclude_prerelease) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
551 return version{lhs.major, lhs.minor, lhs.patch}.compare(version{rhs.major, rhs.minor, rhs.patch});
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
552 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
553 return lhs.compare(rhs);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
554 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
555
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
556 [[nodiscard]] constexpr bool equal_to(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
557 return compare(lhs, rhs, option) == 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
558 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
559
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
560 [[nodiscard]] constexpr bool not_equal_to(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
561 return compare(lhs, rhs, option) != 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
562 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
563
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
564 [[nodiscard]] constexpr bool greater(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
565 return compare(lhs, rhs, option) > 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
566 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
567
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
568 [[nodiscard]] constexpr bool greater_equal(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
569 return compare(lhs, rhs, option) >= 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
570 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
571
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
572 [[nodiscard]] constexpr bool less(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
573 return compare(lhs, rhs, option) < 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
574 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
575
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
576 [[nodiscard]] constexpr bool less_equal(const version& lhs, const version& rhs, comparators_option option = comparators_option::include_prerelease) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
577 return compare(lhs, rhs, option) <= 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
578 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
579
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
580 } // namespace semver::comparators
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
581
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
582 namespace range {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
583
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
584 namespace detail {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
585
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
586 using namespace semver::detail;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
587
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
588 class range {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
589 public:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
590 constexpr explicit range(std::string_view str) noexcept : parser{str} {}
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
591
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
592 constexpr bool satisfies(const version& ver, bool include_prerelease) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
593 const bool has_prerelease = ver.prerelease_type != prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
594
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
595 do {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
596 if (is_logical_or_token()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
597 parser.advance_token(range_token_type::logical_or);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
598 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
599
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
600 bool contains = true;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
601 bool allow_compare = include_prerelease;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
602
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
603 while (is_operator_token() || is_number_token()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
604 const auto range = parser.parse_range();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
605 const bool equal_without_tags = equal_to(range.ver, ver, comparators_option::exclude_prerelease);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
606
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
607 if (has_prerelease && equal_without_tags) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
608 allow_compare = true;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
609 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
610
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
611 if (!range.satisfies(ver)) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
612 contains = false;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
613 break;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
614 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
615 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
616
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
617 if (has_prerelease) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
618 if (allow_compare && contains) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
619 return true;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
620 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
621 } else if (contains) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
622 return true;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
623 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
624
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
625 } while (is_logical_or_token());
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
626
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
627 return false;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
628 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
629
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
630 private:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
631 enum struct range_operator : std::uint8_t {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
632 less,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
633 less_or_equal,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
634 greater,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
635 greater_or_equal,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
636 equal
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
637 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
638
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
639 struct range_comparator {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
640 range_operator op;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
641 version ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
642
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
643 constexpr bool satisfies(const version& version) const {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
644 switch (op) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
645 case range_operator::equal:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
646 return version == ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
647 case range_operator::greater:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
648 return version > ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
649 case range_operator::greater_or_equal:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
650 return version >= ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
651 case range_operator::less:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
652 return version < ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
653 case range_operator::less_or_equal:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
654 return version <= ver;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
655 default:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
656 SEMVER_THROW("semver::range unexpected operator.");
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
657 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
658 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
659 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
660
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
661 enum struct range_token_type : std::uint8_t {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
662 none,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
663 number,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
664 range_operator,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
665 dot,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
666 logical_or,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
667 hyphen,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
668 prerelease,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
669 end_of_line
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
670 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
671
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
672 struct range_token {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
673 range_token_type type = range_token_type::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
674 std::uint16_t number = 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
675 range_operator op = range_operator::equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
676 prerelease prerelease_type = prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
677 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
678
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
679 struct range_lexer {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
680 std::string_view text;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
681 std::size_t pos;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
682
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
683 constexpr explicit range_lexer(std::string_view text) noexcept : text{text}, pos{0} {}
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
684
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
685 constexpr range_token get_next_token() noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
686 while (!end_of_line()) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
687
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
688 if (is_space(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
689 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
690 continue;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
691 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
692
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
693 if (is_logical_or(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
694 advance(2);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
695 return {range_token_type::logical_or};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
696 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
697
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
698 if (is_operator(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
699 const auto op = get_operator();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
700 return {range_token_type::range_operator, 0, op};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
701 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
702
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
703 if (is_digit(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
704 const auto number = get_number();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
705 return {range_token_type::number, number};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
706 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
707
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
708 if (is_dot(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
709 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
710 return {range_token_type::dot};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
711 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
712
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
713 if (is_hyphen(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
714 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
715 return {range_token_type::hyphen};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
716 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
717
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
718 if (is_letter(text[pos])) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
719 const auto prerelease = get_prerelease();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
720 return {range_token_type::prerelease, 0, range_operator::equal, prerelease};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
721 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
722 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
723
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
724 return {range_token_type::end_of_line};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
725 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
726
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
727 constexpr bool end_of_line() const noexcept { return pos >= text.length(); }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
728
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
729 constexpr void advance(std::size_t i) noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
730 pos += i;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
731 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
732
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
733 constexpr range_operator get_operator() noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
734 if (text[pos] == '<') {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
735 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
736 if (text[pos] == '=') {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
737 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
738 return range_operator::less_or_equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
739 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
740 return range_operator::less;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
741 } else if (text[pos] == '>') {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
742 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
743 if (text[pos] == '=') {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
744 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
745 return range_operator::greater_or_equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
746 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
747 return range_operator::greater;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
748 } else if (text[pos] == '=') {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
749 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
750 return range_operator::equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
751 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
752
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
753 return range_operator::equal;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
754 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
755
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
756 constexpr std::uint16_t get_number() noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
757 const auto first = text.data() + pos;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
758 const auto last = text.data() + text.length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
759 if (std::uint16_t n{}; from_chars(first, last, n) != nullptr) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
760 advance(length(n));
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
761 return n;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
762 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
763
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
764 return 0;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
765 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
766
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
767 constexpr prerelease get_prerelease() noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
768 const auto first = text.data() + pos;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
769 const auto last = text.data() + text.length();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
770 if (first > last) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
771 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
772 return prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
773 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
774
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
775 if (prerelease p{}; from_chars(first, last, p) != nullptr) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
776 advance(length(p));
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
777 return p;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
778 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
779
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
780 advance(1);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
781
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
782 return prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
783 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
784 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
785
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
786 struct range_parser {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
787 range_lexer lexer;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
788 range_token current_token;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
789
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
790 constexpr explicit range_parser(std::string_view str) : lexer{str}, current_token{range_token_type::none} {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
791 advance_token(range_token_type::none);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
792 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
793
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
794 constexpr void advance_token(range_token_type token_type) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
795 if (current_token.type != token_type) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
796 SEMVER_THROW("semver::range unexpected token.");
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
797 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
798 current_token = lexer.get_next_token();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
799 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
800
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
801 constexpr range_comparator parse_range() {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
802 if (current_token.type == range_token_type::number) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
803 const auto version = parse_version();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
804 return {range_operator::equal, version};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
805 } else if (current_token.type == range_token_type::range_operator) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
806 const auto range_operator = current_token.op;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
807 advance_token(range_token_type::range_operator);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
808 const auto version = parse_version();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
809 return {range_operator, version};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
810 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
811
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
812 return {range_operator::equal, version{}};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
813 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
814
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
815 constexpr version parse_version() {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
816 const auto major = parse_number();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
817
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
818 advance_token(range_token_type::dot);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
819 const auto minor = parse_number();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
820
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
821 advance_token(range_token_type::dot);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
822 const auto patch = parse_number();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
823
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
824 prerelease prerelease = prerelease::none;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
825 std::optional<std::uint16_t> prerelease_number = std::nullopt;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
826
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
827 if (current_token.type == range_token_type::hyphen) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
828 advance_token(range_token_type::hyphen);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
829 prerelease = parse_prerelease();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
830 if (current_token.type == range_token_type::dot) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
831 advance_token(range_token_type::dot);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
832 prerelease_number = parse_number();
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
833 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
834 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
835
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
836 return {major, minor, patch, prerelease, prerelease_number};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
837 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
838
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
839 constexpr std::uint16_t parse_number() {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
840 const auto token = current_token;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
841 advance_token(range_token_type::number);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
842
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
843 return token.number;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
844 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
845
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
846 constexpr prerelease parse_prerelease() {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
847 const auto token = current_token;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
848 advance_token(range_token_type::prerelease);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
849
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
850 return token.prerelease_type;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
851 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
852 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
853
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
854 [[nodiscard]] constexpr bool is_logical_or_token() const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
855 return parser.current_token.type == range_token_type::logical_or;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
856 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
857 [[nodiscard]] constexpr bool is_operator_token() const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
858 return parser.current_token.type == range_token_type::range_operator;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
859 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
860
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
861 [[nodiscard]] constexpr bool is_number_token() const noexcept {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
862 return parser.current_token.type == range_token_type::number;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
863 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
864
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
865 range_parser parser;
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
866 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
867
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
868 } // namespace semver::range::detail
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
869
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
870 enum struct satisfies_option : std::uint8_t {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
871 exclude_prerelease,
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
872 include_prerelease
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
873 };
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
874
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
875 constexpr bool satisfies(const version& ver, std::string_view str, satisfies_option option = satisfies_option::exclude_prerelease) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
876 switch (option) {
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
877 case satisfies_option::exclude_prerelease:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
878 return detail::range{str}.satisfies(ver, false);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
879 case satisfies_option::include_prerelease:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
880 return detail::range{str}.satisfies(ver, true);
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
881 default:
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
882 SEMVER_THROW("semver::range unexpected satisfies_option.");
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
883 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
884 }
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
885
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
886 } // namespace semver::range
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
887
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
888 // Version lib semver.
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
889 inline constexpr auto semver_version = version{SEMVER_VERSION_MAJOR, SEMVER_VERSION_MINOR, SEMVER_VERSION_PATCH};
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
890
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
891 } // namespace semver
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
892
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
893 #if defined(__clang__)
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
894 # pragma clang diagnostic pop
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
895 #endif
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
896
b9f111d84d95 *: move to semver, remove old macos build, add library files
Paper <paper@paper.us.eu.org>
parents:
diff changeset
897 #endif // NEARGYE_SEMANTIC_VERSIONING_HPP