Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:13

0001 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
0002 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
0003 // Copyright (c) 2009 Boris Schaeling
0004 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
0005 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
0006 // Copyright (c) 2016 Klemens D. Morgenstern
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0009 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_PROCESS_ARGS_HPP
0012 #define BOOST_PROCESS_ARGS_HPP
0013 
0014 /** \file boost/process/args.hpp
0015  *
0016  *    This header provides the \xmlonly <globalname alt="boost::process::args">args</globalname>\endxmlonly property. It also provides the
0017  *    alternative name \xmlonly <globalname alt="boost::process::argv">argv</globalname>\endxmlonly .
0018  *
0019  *
0020 \xmlonly
0021 <programlisting>
0022 namespace boost {
0023   namespace process {
0024     <emphasis>unspecified</emphasis> <globalname alt="boost::process::args">args</globalname>;
0025     <emphasis>unspecified</emphasis> <globalname alt="boost::process::argv">argv</globalname>;
0026   }
0027 }
0028 </programlisting>
0029 \endxmlonly
0030  */
0031 
0032 
0033 #include <boost/process/detail/basic_cmd.hpp>
0034 #include <iterator>
0035 
0036 namespace boost { namespace process { namespace detail {
0037 
0038 struct args_
0039 {
0040     template<typename T>
0041     using remove_reference_t = typename std::remove_reference<T>::type;
0042     template<typename T>
0043     using value_type = typename remove_reference_t<T>::value_type;
0044 
0045     template<typename T>
0046     using vvalue_type = value_type<value_type<T>>;
0047 
0048     template <class Range>
0049     arg_setter_<vvalue_type<Range>, true>     operator()(Range &&range) const
0050     {
0051         return arg_setter_<vvalue_type<Range>, true>(std::forward<Range>(range));
0052     }
0053     template <class Range>
0054     arg_setter_<vvalue_type<Range>, true>     operator+=(Range &&range) const
0055     {
0056         return arg_setter_<vvalue_type<Range>, true>(std::forward<Range>(range));
0057     }
0058     template <class Range>
0059     arg_setter_<vvalue_type<Range>, false>    operator= (Range &&range) const
0060     {
0061         return arg_setter_<vvalue_type<Range>, false>(std::forward<Range>(range));
0062     }
0063     template<typename Char>
0064     arg_setter_<Char, true>     operator()(std::basic_string<Char> && str) const
0065     {
0066         return arg_setter_<Char, true> (str);
0067     }
0068     template<typename Char>
0069     arg_setter_<Char, true>     operator+=(std::basic_string<Char> && str) const
0070     {
0071         return arg_setter_<Char, true> (str);
0072     }
0073     template<typename Char>
0074     arg_setter_<Char, false>    operator= (std::basic_string<Char> && str) const
0075     {
0076         return arg_setter_<Char, false>(str);
0077     }
0078     template<typename Char>
0079     arg_setter_<Char, true>     operator()(const std::basic_string<Char> & str) const
0080     {
0081         return arg_setter_<Char, true> (str);
0082     }
0083     template<typename Char>
0084     arg_setter_<Char, true>     operator+=(const std::basic_string<Char> & str) const
0085     {
0086         return arg_setter_<Char, true> (str);
0087     }
0088     template<typename Char>
0089     arg_setter_<Char, false>    operator= (const std::basic_string<Char> & str) const
0090     {
0091         return arg_setter_<Char, false>(str);
0092     }
0093     template<typename Char>
0094     arg_setter_<Char, true>     operator()(std::basic_string<Char> & str) const
0095     {
0096         return arg_setter_<Char, true> (str);
0097     }
0098     template<typename Char>
0099     arg_setter_<Char, true>     operator+=(std::basic_string<Char> & str) const
0100     {
0101         return arg_setter_<Char, true> (str);
0102     }
0103     template<typename Char>
0104     arg_setter_<Char, false>    operator= (std::basic_string<Char> & str) const
0105     {
0106         return arg_setter_<Char, false>(str);
0107     }
0108     template<typename Char>
0109     arg_setter_<Char, true>     operator()(const Char* str) const
0110     {
0111         return arg_setter_<Char, true> (str);
0112     }
0113     template<typename Char>
0114     arg_setter_<Char, true>     operator+=(const Char* str) const
0115     {
0116         return arg_setter_<Char, true> (str);
0117     }
0118     template<typename Char>
0119     arg_setter_<Char, false>    operator= (const Char* str) const
0120     {
0121         return arg_setter_<Char, false>(str);
0122     }
0123 //    template<typename Char, std::size_t Size>
0124 //    arg_setter_<Char, true>     operator()(const Char (&str) [Size]) const
0125 //    {
0126 //        return arg_setter_<Char, true> (str);
0127 //    }
0128 //    template<typename Char, std::size_t Size>
0129 //    arg_setter_<Char, true>     operator+=(const Char (&str) [Size]) const
0130 //    {
0131 //        return arg_setter_<Char, true> (str);
0132 //    }
0133 //    template<typename Char, std::size_t Size>
0134 //    arg_setter_<Char, false>    operator= (const Char (&str) [Size]) const
0135 //    {
0136 //        return arg_setter_<Char, false>(str);
0137 //    }
0138 
0139     arg_setter_<char, true> operator()(std::initializer_list<const char*> &&range) const
0140     {
0141         return arg_setter_<char, true>(range.begin(), range.end());
0142     }
0143     arg_setter_<char, true> operator+=(std::initializer_list<const char*> &&range) const
0144     {
0145         return arg_setter_<char, true>(range.begin(), range.end());
0146     }
0147     arg_setter_<char, false> operator= (std::initializer_list<const char*> &&range) const
0148     {
0149         return arg_setter_<char, false>(range.begin(), range.end());
0150     }
0151     arg_setter_<char, true> operator()(std::initializer_list<std::string> &&range) const
0152     {
0153         return arg_setter_<char, true>(range.begin(), range.end());
0154     }
0155     arg_setter_<char, true> operator+=(std::initializer_list<std::string> &&range) const
0156     {
0157         return arg_setter_<char, true>(range.begin(), range.end());
0158     }
0159     arg_setter_<char, false> operator= (std::initializer_list<std::string> &&range) const
0160     {
0161         return arg_setter_<char, false>(range.begin(), range.end());
0162     }
0163 
0164     arg_setter_<wchar_t, true> operator()(std::initializer_list<const wchar_t*> &&range) const
0165     {
0166         return arg_setter_<wchar_t, true>(range.begin(), range.end());
0167     }
0168     arg_setter_<wchar_t, true> operator+=(std::initializer_list<const wchar_t*> &&range) const
0169     {
0170         return arg_setter_<wchar_t, true>(range.begin(), range.end());
0171     }
0172     arg_setter_<wchar_t, false> operator= (std::initializer_list<const wchar_t*> &&range) const
0173     {
0174         return arg_setter_<wchar_t, false>(range.begin(), range.end());
0175     }
0176     arg_setter_<wchar_t, true> operator()(std::initializer_list<std::wstring> &&range) const
0177     {
0178         return arg_setter_<wchar_t, true>(range.begin(), range.end());
0179     }
0180     arg_setter_<wchar_t, true> operator+=(std::initializer_list<std::wstring> &&range) const
0181     {
0182         return arg_setter_<wchar_t, true>(range.begin(), range.end());
0183     }
0184     arg_setter_<wchar_t, false> operator= (std::initializer_list<std::wstring> &&range) const
0185     {
0186         return arg_setter_<wchar_t, false>(range.begin(), range.end());
0187     }
0188 };
0189 
0190 
0191 }
0192 /**
0193 
0194 The `args` property allows to explicitly set arguments for the execution. The
0195 name of the executable will always be the first element in the arg-vector.
0196 
0197 \section args_details Details
0198 
0199 \subsection args_operations Operations
0200 
0201 \subsubsection args_set_var Setting values
0202 
0203 To set a the argument vector the following syntax can be used.
0204 
0205 \code{.cpp}
0206 args = value;
0207 args(value);
0208 \endcode
0209 
0210 `std::initializer_list` is among the allowed types, so the following syntax is also possible.
0211 
0212 \code{.cpp}
0213 args = {value1, value2};
0214 args({value1, value2});
0215 \endcode
0216 
0217 Below the possible types for `value` are listed, with `char_type` being either `char` or `wchar_t`.
0218 
0219 \paragraph args_set_var_value value
0220 
0221  - `std::basic_string<char_type>`
0222  - `const char_type * `
0223  - `std::initializer_list<const char_type *>`
0224  - `std::vector<std::basic_string<char_type>>`
0225 
0226 Additionally any range of `std::basic_string<char_type>` can be passed.
0227 
0228 \subsubsection args_append_var Appending values
0229 
0230 To append a the argument vector the following syntax can be used.
0231 
0232 \code{.cpp}
0233 args += value;
0234 \endcode
0235 
0236 `std::initializer_list` is among the allowed types, so the following syntax is also possible.
0237 
0238 \code{.cpp}
0239 args += {value1, value2};
0240 \endcode
0241 
0242 Below the possible types for `value` are listed, with `char_type` being either `char` or `wchar_t`.
0243 
0244 \paragraph args_append_var_value value
0245 
0246  - `std::basic_string<char_type>`
0247  - `const char_type * `
0248  - `std::initializer_list<const char_type *>`
0249  - `std::vector<std::basic_string<char_type>>`
0250 
0251 Additionally any range of `std::basic_string<char_type>` can be passed.
0252 
0253 
0254 \subsection args_example Example
0255 
0256 The overload form is used when more than one string is passed, from the second one forward.
0257 I.e. the following expressions have the same results:
0258 
0259 \code{.cpp}
0260 spawn("gcc", "--version");
0261 spawn("gcc", args ="--version");
0262 spawn("gcc", args+="--version");
0263 spawn("gcc", args ={"--version"});
0264 spawn("gcc", args+={"--version"});
0265 \endcode
0266 
0267 \note A string will be parsed and set in quotes if it has none and contains spaces.
0268 
0269 
0270  */
0271 constexpr boost::process::detail::args_ args{};
0272 
0273 ///Alias for \xmlonly <globalname alt="boost::process::args">args</globalname> \endxmlonly .
0274 constexpr boost::process::detail::args_ argv{};
0275 
0276 
0277 }}
0278 
0279 #endif