run_exe.hpp
Go to the documentation of this file.
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 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 
10 #pragma once
11 
12 #include <filesystem>
13 #include <string>
14 
16 
18 {
19 
20  template <class String>
21  class run_exe_ : public initializer_base
22  {
23  public:
24  explicit run_exe_(const String& s) : s_(s)
25  {
26  }
27 
28  template <class WindowsExecutor>
29  void
30  on_CreateProcess_setup(WindowsExecutor& e) const
31  {
32  e.exe = s_.c_str();
33  }
34 
35  private:
36  String s_;
37  };
38 
39 #if defined(_UNICODE) || defined(UNICODE)
40  inline run_exe_<std::wstring>
41  run_exe(const wchar_t* ws)
42  {
43  return run_exe_<std::wstring>(ws);
44  }
45 
46  inline run_exe_<std::wstring>
47  run_exe(const std::wstring& ws)
48  {
49  return run_exe_<std::wstring>(ws);
50  }
51 
52  inline run_exe_<std::wstring>
53  run_exe(const std::filesystem::path& p)
54  {
55  return run_exe_<std::wstring>(p.wstring());
56  }
57 #else
58  inline run_exe_<std::string>
59  run_exe(const char* s)
60  {
61  return run_exe_<std::string>(s);
62  }
63 
64  inline run_exe_<std::string>
65  run_exe(const std::string& s)
66  {
67  return run_exe_<std::string>(s);
68  }
69 
70  inline run_exe_<std::string>
71  run_exe(const std::filesystem::path& p)
72  {
73  return run_exe_<std::string>(p.string());
74  }
75 #endif
76 
77 } // namespace boost::process::windows::initializers
boost::process::windows::initializers
Definition: bind_stderr.hpp:17
boost::process::windows::initializers::run_exe_::run_exe_
run_exe_(const String &s)
Definition: run_exe.hpp:24
boost::process::windows::initializers::run_exe_
Definition: run_exe.hpp:21
boost::process::windows::initializers::run_exe
run_exe_< std::string > run_exe(const char *s)
Definition: run_exe.hpp:59
cxxopts::String
std::string String
Definition: cxxopts.hpp:192
initializer_base.hpp
boost::process::windows::initializers::initializer_base
Definition: initializer_base.hpp:15
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
boost::process::windows::initializers::run_exe_::on_CreateProcess_setup
void on_CreateProcess_setup(WindowsExecutor &e) const
Definition: run_exe.hpp:30