arg_router  1.4.0
C++ command line argument parsing and routing
long_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 {
22 template <typename S>
24 {
25 public:
27  using string_type = S;
28 
33  constexpr explicit long_name_t([[maybe_unused]] S str = {}) noexcept {}
34 
39  [[nodiscard]] constexpr static std::string_view long_name() noexcept { return S::get(); }
40 
41 private:
42  static_assert(utility::utf8::count(long_name()) > 1,
43  "Long names must be longer than one character");
45  "Long names cannot contain whitespace");
46 };
47 
52 template <typename S>
53 constexpr auto long_name = long_name_t<S>{};
54 
55 template <typename S>
56 struct is_policy<long_name_t<S>> : std::true_type {
57 };
58 } // namespace arg_router::policy
constexpr long_name_t([[maybe_unused]] S str={}) noexcept
Definition: long_name.hpp:33
constexpr static std::string_view long_name() noexcept
Definition: long_name.hpp:39
constexpr auto long_name
Definition: long_name.hpp:53
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