libfilezilla
process.hpp
Go to the documentation of this file.
1 #ifndef LIBFILEZILLA_PROCESS_HEADER
2 #define LIBFILEZILLA_PROCESS_HEADER
3 
4 #include "libfilezilla.hpp"
5 
10 #include <vector>
11 
12 namespace fz {
13 
21 class FZ_PUBLIC_SYMBOL process final
22 {
23 public:
24  process();
25  ~process();
26 
27  process(process const&) = delete;
28  process& operator=(process const&) = delete;
29 
41  bool spawn(native_string const& cmd, std::vector<native_string> const& args = std::vector<native_string>());
42 
43  bool spawn(std::vector<native_string> const& command_with_args);
44 
51  void kill();
52 
61  int read(char* buffer, unsigned int len);
62 
70  bool write(char const* buffer, unsigned int len);
71 
72  inline bool write(std::string_view const& s) {
73  return write(s.data(), static_cast<unsigned int>(s.size()));
74  }
75 
76 private:
77  class impl;
78  impl* impl_;
79 };
80 
81 
90 bool FZ_PUBLIC_SYMBOL spawn_detached_process(std::vector<native_string> const& cmd_with_args);
91 
92 }
93 
94 #endif
bool spawn_detached_process(std::vector< native_string > const &cmd_with_args)
Starts a detached process.
std::wstring native_string
A string in the system&#39;s native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:33
The namespace used by libfilezilla.
Definition: apply.hpp:17
Sets some global macros and further includes string.hpp.
The buffer class is a simple buffer where data can be appended at the end and consumed at the front...
Definition: buffer.hpp:23
The process class manages an asynchronous process with redirected IO.
Definition: process.hpp:21