arg_router  1.4.0
C++ command line argument parsing and routing
config.hpp
Go to the documentation of this file.
1 // Copyright (C) 2022-2023 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 
14 // If changing these or adding new ones, reflect those changes in config.cmake
15 #ifndef AR_MAX_CTS_SIZE
16 # define AR_MAX_CTS_SIZE 128
17 #endif
18 
19 #ifndef AR_LONG_PREFIX
20 # define AR_LONG_PREFIX "--"
21 #endif
22 
23 #ifndef AR_SHORT_PREFIX
24 # define AR_SHORT_PREFIX "-"
25 #endif
26 
27 #ifndef AR_ALLOCATOR
28 # define AR_ALLOCATOR std::allocator
29 #endif
30 
31 #ifndef AR_UTF8_TRAILING_WINDOW_SIZE
32 # define AR_UTF8_TRAILING_WINDOW_SIZE 16
33 #endif
34 
35 #ifndef AR_DISABLE_CPP20_STRINGS
36 # define AR_DISABLE_CPP20_STRINGS false
37 #endif
38 
39 #include "arg_router/utility/utf8.hpp"
40 
47 {
52 constexpr auto long_prefix = std::string_view{AR_LONG_PREFIX};
53 
58 constexpr auto short_prefix = std::string_view{AR_SHORT_PREFIX};
59 
60 static_assert(utility::utf8::count(short_prefix) == 1, "Short prefix must be one character");
61 
63  "Long prefix must be longer or the same as short prefix");
64 
69 template <typename T>
70 using allocator = AR_ALLOCATOR<T>;
71 
72 #if (__cplusplus >= 202002L) && !AR_DISABLE_CPP20_STRINGS
73 # define AR_ENABLE_CPP20_STRINGS
74 #endif
75 
79 #if (!defined(__clang__) && defined(_MSC_VER) && (_MSC_VER >= 1936))
80 # define MSVC_1936_WORKAROUND 1
81 #endif
82 } // namespace arg_router::config
std::allocator< T > allocator
Definition: config.hpp:70
constexpr auto short_prefix
Definition: config.hpp:58
constexpr auto long_prefix
Definition: config.hpp:52
constexpr std::size_t count(std::string_view str) noexcept
Definition: utf8.hpp:278