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 
13 #include <filesystem>
14 #include <string>
15 
17 {
18 
19  template <class String>
20  class run_exe_ : public initializer_base
21  {
22  public:
23  explicit run_exe_(const String& s) : s_(s) {}
24 
25  template <class WindowsExecutor>
26  void on_CreateProcess_setup(WindowsExecutor& e) const
27  {
28  e.exe = s_.c_str();
29  }
30 
31  private:
32  String s_;
33  };
34 
35 #if defined(_UNICODE) || defined(UNICODE)
36  inline run_exe_<std::wstring> run_exe(const wchar_t* ws)
37  {
38  return run_exe_<std::wstring>(ws);
39  }
40 
41  inline run_exe_<std::wstring> run_exe(const std::wstring& ws)
42  {
43  return run_exe_<std::wstring>(ws);
44  }
45 
46  inline run_exe_<std::wstring> run_exe(const std::filesystem::path& p)
47  {
48  return run_exe_<std::wstring>(p.wstring());
49  }
50 #else
51  inline run_exe_<std::string> run_exe(const char* s)
52  {
53  return run_exe_<std::string>(s);
54  }
55 
56  inline run_exe_<std::string> run_exe(const std::string& s)
57  {
58  return run_exe_<std::string>(s);
59  }
60 
61  inline run_exe_<std::string> run_exe(const std::filesystem::path& p)
62  {
63  return run_exe_<std::string>(p.string());
64  }
65 #endif
66 
67 }
boost::process::windows::initializers
Definition: bind_stderr.hpp:16
boost::process::windows::initializers::run_exe_::run_exe_
run_exe_(const String &s)
Definition: run_exe.hpp:23
boost::process::windows::initializers::run_exe_
Definition: run_exe.hpp:20
boost::process::windows::initializers::run_exe
run_exe_< std::string > run_exe(const char *s)
Definition: run_exe.hpp:51
cxxopts::String
std::string String
Definition: cxxopts.hpp:209
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:26