/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/argv_input.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2017-2020 Dr. Colin Hirsch and Daniel Frey |
2 | | // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ |
3 | | |
4 | | #ifndef TAO_PEGTL_ARGV_INPUT_HPP |
5 | | #define TAO_PEGTL_ARGV_INPUT_HPP |
6 | | |
7 | | #include <cstddef> |
8 | | #include <sstream> |
9 | | #include <string> |
10 | | #include <utility> |
11 | | |
12 | | #include "config.hpp" |
13 | | #include "eol.hpp" |
14 | | #include "memory_input.hpp" |
15 | | #include "tracking_mode.hpp" |
16 | | |
17 | | namespace tao |
18 | | { |
19 | | namespace TAO_PEGTL_NAMESPACE |
20 | | { |
21 | | namespace internal |
22 | | { |
23 | | inline std::string make_argv_source( const std::size_t argn ) |
24 | 0 | { |
25 | 0 | std::ostringstream os; |
26 | 0 | os << "argv[" << argn << ']'; |
27 | 0 | return os.str(); |
28 | 0 | } |
29 | | |
30 | | } // namespace internal |
31 | | |
32 | | template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > |
33 | | struct argv_input |
34 | | : public memory_input< P, Eol > |
35 | | { |
36 | | template< typename T > |
37 | | argv_input( char** argv, const std::size_t argn, T&& in_source ) |
38 | | : memory_input< P, Eol >( static_cast< const char* >( argv[ argn ] ), std::forward< T >( in_source ) ) |
39 | | { |
40 | | } |
41 | | |
42 | | argv_input( char** argv, const std::size_t argn ) |
43 | | : argv_input( argv, argn, internal::make_argv_source( argn ) ) |
44 | | { |
45 | | } |
46 | | }; |
47 | | |
48 | | #ifdef __cpp_deduction_guides |
49 | | template< typename... Ts > |
50 | | argv_input( Ts&&... )->argv_input<>; |
51 | | #endif |
52 | | |
53 | | } // namespace TAO_PEGTL_NAMESPACE |
54 | | |
55 | | } // namespace tao |
56 | | |
57 | | #endif |