1 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
2 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3 // Copyright (c) 2009 Boris Schaeling
4 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6 // Copyright (c) 2016 Klemens D. Morgenstern
7 //
8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 
11 #ifndef BOOST_PROCESS_EXE_HPP
12 #define BOOST_PROCESS_EXE_HPP
13 
14 #include <boost/process/detail/basic_cmd.hpp>
15 
16 /** \file boost/process/exe.hpp
17  *
18  *    Header which provides the exe property.
19 \xmlonly
20 <programlisting>
21 namespace boost {
22   namespace process {
23     <emphasis>unspecified</emphasis> <globalname alt="boost::process::exe">exe</globalname>;
24   }
25 }
26 </programlisting>
27 \endxmlonly
28  */
29 namespace boost {
30 namespace filesystem { class path; }
31 
32 namespace process {
33 
34 namespace detail {
35 
36 struct exe_
37 {
38     template<typename = void>
operator ()boost::process::detail::exe_39     inline exe_setter_<typename boost::filesystem::path::value_type> operator()(const boost::filesystem::path & pth) const
40     {
41         return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
42     }
43 
44     template<typename = void>
operator =boost::process::detail::exe_45     inline exe_setter_<typename boost::filesystem::path::value_type> operator=(const boost::filesystem::path & pth) const
46     {
47         return exe_setter_<typename boost::filesystem::path::value_type>(pth.native());
48     }
49 
50 
51     template<typename Char>
operator ()boost::process::detail::exe_52     inline exe_setter_<Char> operator()(const Char *s) const
53     {
54         return exe_setter_<Char>(s);
55     }
56     template<typename Char>
operator =boost::process::detail::exe_57     inline exe_setter_<Char> operator= (const Char *s) const
58     {
59         return exe_setter_<Char>(s);
60     }
61 
62     template<typename Char>
operator ()boost::process::detail::exe_63     inline exe_setter_<Char> operator()(const std::basic_string<Char> &s) const
64     {
65         return exe_setter_<Char>(s);
66     }
67     template<typename Char>
operator =boost::process::detail::exe_68     inline exe_setter_<Char> operator= (const std::basic_string<Char> &s) const
69     {
70         return exe_setter_<Char>(s);
71     }
72 };
73 
74 }
75 
76 /** The exe property allows to explicitly set the executable.
77 
78 The overload form applies when to the first, when several strings are passed to a launching
79 function.
80 
81 The following expressions are valid, with `value` being either a C-String or
82 a `std::basic_string` with `char` or `wchar_t` or a `boost::filesystem::path`.
83 
84 \code{.cpp}
85 exe="value";
86 exe(value);
87 \endcode
88 
89 The property can only be used for assignments.
90 
91 
92  */
93 constexpr boost::process::detail::exe_ exe{};
94 
95 }}
96 
97 #endif
98