arg_router  1.4.0
C++ command line argument parsing and routing
none_name.hpp
1 // Copyright (C) 2022 by Camden Mannett.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
4 
5 #pragma once
6 
7 #include "arg_router/policy/policy.hpp"
8 
9 namespace arg_router::policy
10 {
25 template <typename S>
27 {
28 public:
30  using string_type = S;
31 
36  constexpr explicit none_name_t([[maybe_unused]] S str = {}) noexcept {}
37 
42  [[nodiscard]] constexpr static std::string_view none_name() noexcept { return S::get(); }
43 
44 private:
45  static_assert(utility::utf8::count(none_name()) > 1,
46  "None names must be longer than one character");
48  "None names cannot contain whitespace");
49 };
50 
55 template <typename S>
56 constexpr auto none_name = none_name_t<S>{};
57 
58 template <typename S>
59 struct is_policy<none_name_t<S>> : std::true_type {
60 };
61 } // namespace arg_router::policy
constexpr none_name_t([[maybe_unused]] S str={}) noexcept
Definition: none_name.hpp:36
constexpr static std::string_view none_name() noexcept
Definition: none_name.hpp:42
constexpr auto none_name
Definition: none_name.hpp:56
constexpr bool contains_whitespace(std::string_view str) noexcept
Definition: utf8.hpp:304
constexpr std::size_t count(std::string_view str) noexcept
Definition: utf8.hpp:278