1 // Copyright (c) 2016 Klemens D. Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 
7 #ifndef BOOST_PROCESS_DETAIL_TRAITS_CMD_OR_EXE_HPP_
8 #define BOOST_PROCESS_DETAIL_TRAITS_CMD_OR_EXE_HPP_
9 
10 #include <string>
11 #include <vector>
12 #include <type_traits>
13 #include <initializer_list>
14 #include <boost/filesystem/path.hpp>
15 #include <boost/process/detail/traits/decl.hpp>
16 namespace boost { namespace process { namespace detail {
17 
18 template<typename Char>
19 struct cmd_or_exe_tag {};
20 
21 struct shell_;
22 
23 
24 template<> struct initializer_tag<const char*    > { typedef cmd_or_exe_tag<char>    type;};
25 template<> struct initializer_tag<const wchar_t* > { typedef cmd_or_exe_tag<wchar_t> type;};
26 
27 template<> struct initializer_tag<char*    > { typedef cmd_or_exe_tag<char>     type;};
28 template<> struct initializer_tag<wchar_t* > { typedef cmd_or_exe_tag<wchar_t>  type;};
29 
30 template<std::size_t Size> struct initializer_tag<const char    [Size]> { typedef cmd_or_exe_tag<char>     type;};
31 template<std::size_t Size> struct initializer_tag<const wchar_t [Size]> { typedef cmd_or_exe_tag<wchar_t>  type;};
32 
33 template<std::size_t Size> struct initializer_tag<const char    (&)[Size]> { typedef cmd_or_exe_tag<char>     type;};
34 template<std::size_t Size> struct initializer_tag<const wchar_t (&)[Size]> { typedef cmd_or_exe_tag<wchar_t>  type;};
35 
36 template<> struct initializer_tag<std::basic_string<char    >> { typedef cmd_or_exe_tag<char>     type;};
37 template<> struct initializer_tag<std::basic_string<wchar_t >> { typedef cmd_or_exe_tag<wchar_t>  type;};
38 
39 template<> struct initializer_tag<std::vector<std::basic_string<char    >>> { typedef cmd_or_exe_tag<char>     type;};
40 template<> struct initializer_tag<std::vector<std::basic_string<wchar_t >>> { typedef cmd_or_exe_tag<wchar_t>  type;};
41 
42 template<> struct initializer_tag<std::initializer_list<std::basic_string<char    >>> { typedef cmd_or_exe_tag<char>     type;};
43 template<> struct initializer_tag<std::initializer_list<std::basic_string<wchar_t >>> { typedef cmd_or_exe_tag<wchar_t>  type;};
44 
45 template<> struct initializer_tag<std::vector<char    *>> { typedef cmd_or_exe_tag<char>     type;};
46 template<> struct initializer_tag<std::vector<wchar_t *>> { typedef cmd_or_exe_tag<wchar_t>  type;};
47 
48 template<> struct initializer_tag<std::initializer_list<char    *>> { typedef cmd_or_exe_tag<char>     type;};
49 template<> struct initializer_tag<std::initializer_list<wchar_t *>> { typedef cmd_or_exe_tag<wchar_t>  type;};
50 
51 template<> struct initializer_tag<std::initializer_list<const char    *>> { typedef cmd_or_exe_tag<char>     type;};
52 template<> struct initializer_tag<std::initializer_list<const wchar_t *>> { typedef cmd_or_exe_tag<wchar_t>  type;};
53 
54 template<> struct initializer_tag<shell_>
55 {
56     typedef cmd_or_exe_tag<typename boost::filesystem::path::value_type> type;
57 };
58 
59 template<> struct initializer_tag<boost::filesystem::path>
60 {
61     typedef cmd_or_exe_tag<typename boost::filesystem::path::value_type> type;
62 };
63 
64 template <typename Char>
65 struct exe_setter_;
66 template <typename Char, bool Append = false>
67 struct arg_setter_;
68 
69 template <typename Char, bool Append>
70 struct initializer_tag<arg_setter_<Char, Append>> { typedef cmd_or_exe_tag<Char> type;};
71 
72 template<typename Char> struct initializer_tag<exe_setter_<Char>> { typedef cmd_or_exe_tag<Char> type;};
73 
74 template<>
75 struct initializer_builder<cmd_or_exe_tag<char>>;
76 
77 template<>
78 struct initializer_builder<cmd_or_exe_tag<wchar_t>>;
79 
80 
81 }}}
82 
83 
84 
85 #endif /* BOOST_PROCESS_DETAIL_STRING_TRAITS_HPP_ */
86