arg_router  1.4.0
C++ command line argument parsing and routing
display_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 {
28 template <typename S>
30 {
31 public:
33  using string_type = S;
34 
39  constexpr explicit display_name_t([[maybe_unused]] S str = {}) noexcept {}
40 
45  [[nodiscard]] constexpr static std::string_view display_name() noexcept { return S::get(); }
46 
47 private:
48  static_assert(!display_name().empty(), "Display name must not be empty");
49 };
50 
55 template <typename S>
56 constexpr auto display_name = display_name_t<S>{};
57 
58 template <typename S>
59 struct is_policy<display_name_t<S>> : std::true_type {
60 };
61 } // namespace arg_router::policy
constexpr display_name_t([[maybe_unused]] S str={}) noexcept
constexpr static std::string_view display_name() noexcept
constexpr auto display_name