aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/process.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/winapi/process.hpp')
-rw-r--r--include/winapi/process.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/winapi/process.hpp b/include/winapi/process.hpp
index 095b50c..3c9a840 100644
--- a/include/winapi/process.hpp
+++ b/include/winapi/process.hpp
@@ -29,11 +29,19 @@ struct ProcessParameters {
explicit ProcessParameters(const CommandLine& cmd_line) : cmd_line{cmd_line} {}
+ // VS 2013 won't generate these automatically.
+ ProcessParameters(ProcessParameters&&) BOOST_NOEXCEPT_OR_NOTHROW;
+ ProcessParameters& operator=(ProcessParameters) BOOST_NOEXCEPT_OR_NOTHROW;
+ void swap(ProcessParameters& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ ProcessParameters(const ProcessParameters&) = delete;
+
CommandLine cmd_line;
boost::optional<process::IO> io;
ConsoleCreationMode console_mode = ConsoleNew;
};
+void swap(ProcessParameters&, ProcessParameters&) BOOST_NOEXCEPT_OR_NOTHROW;
+
struct ShellParameters : ProcessParameters {
explicit ShellParameters(const CommandLine& cmd_line) : ProcessParameters{cmd_line} {}
@@ -43,9 +51,17 @@ struct ShellParameters : ProcessParameters {
return params;
}
+ // VS 2013 won't generate these automatically.
+ ShellParameters(ShellParameters&&) BOOST_NOEXCEPT_OR_NOTHROW;
+ ShellParameters& operator=(ShellParameters) BOOST_NOEXCEPT_OR_NOTHROW;
+ void swap(ShellParameters& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ ShellParameters(const ShellParameters&) = delete;
+
boost::optional<std::string> verb;
};
+void swap(ShellParameters&, ShellParameters&) BOOST_NOEXCEPT_OR_NOTHROW;
+
class Process {
public:
static Process create(ProcessParameters);
@@ -55,6 +71,12 @@ public:
static Process shell(const ShellParameters&);
static Process shell(const CommandLine&);
+ // VS 2013 won't generate these automatically.
+ Process(Process&&) BOOST_NOEXCEPT_OR_NOTHROW;
+ Process& operator=(Process) BOOST_NOEXCEPT_OR_NOTHROW;
+ void swap(Process& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Process(const Process&) = delete;
+
bool is_running() const;
void wait() const;
void terminate(int ec = 0) const;
@@ -74,4 +96,26 @@ private:
Handle m_handle;
};
+void swap(Process& a, Process& b) BOOST_NOEXCEPT_OR_NOTHROW;
+
} // namespace winapi
+
+namespace std {
+
+template <>
+inline void swap(winapi::ProcessParameters& a,
+ winapi::ProcessParameters& b) BOOST_NOEXCEPT_OR_NOTHROW {
+ a.swap(b);
+}
+
+template <>
+inline void swap(winapi::ShellParameters& a, winapi::ShellParameters& b) BOOST_NOEXCEPT_OR_NOTHROW {
+ a.swap(b);
+}
+
+template <>
+inline void swap(winapi::Process& a, winapi::Process& b) BOOST_NOEXCEPT_OR_NOTHROW {
+ a.swap(b);
+}
+
+} // namespace std