aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--include/winapi/buffer.hpp4
-rw-r--r--include/winapi/cmd_line.hpp8
-rw-r--r--include/winapi/error.hpp4
-rw-r--r--include/winapi/file.hpp2
-rw-r--r--include/winapi/handle.hpp22
-rw-r--r--include/winapi/pipe.hpp21
-rw-r--r--include/winapi/process.hpp55
-rw-r--r--include/winapi/process_io.hpp51
-rw-r--r--include/winapi/resource.hpp2
-rw-r--r--include/winapi/shmem.hpp45
-rw-r--r--include/winapi/sid.hpp4
-rw-r--r--src/cmd_line.cpp7
-rw-r--r--src/handle.cpp18
-rw-r--r--src/path.cpp3
-rw-r--r--src/pipe.cpp19
-rw-r--r--src/process.cpp52
-rw-r--r--src/process_io.cpp77
-rw-r--r--src/shmem.cpp17
-rw-r--r--test/unit_tests/resource.cpp5
-rw-r--r--test/unit_tests/shared/command.hpp3
-rw-r--r--test/unit_tests/shared/console.hpp4
-rw-r--r--test/unit_tests/shared/test_data.hpp2
-rw-r--r--test/unit_tests/shared/worker.hpp33
-rw-r--r--test/unit_tests/shmem.cpp9
24 files changed, 49 insertions, 418 deletions
diff --git a/include/winapi/buffer.hpp b/include/winapi/buffer.hpp
index 08094f8..4d47930 100644
--- a/include/winapi/buffer.hpp
+++ b/include/winapi/buffer.hpp
@@ -22,9 +22,9 @@ public:
Buffer() = default;
- Buffer(std::initializer_list<unsigned char> lst) : Parent(lst) {}
+ Buffer(std::initializer_list<unsigned char> lst) : Parent{lst} {}
- explicit Buffer(Parent&& src) : Parent(std::move(src)) {}
+ explicit Buffer(Parent&& src) : Parent{std::move(src)} {}
template <typename CharT>
explicit Buffer(const std::basic_string<CharT>& src) {
diff --git a/include/winapi/cmd_line.hpp b/include/winapi/cmd_line.hpp
index 8ea1a92..d635350 100644
--- a/include/winapi/cmd_line.hpp
+++ b/include/winapi/cmd_line.hpp
@@ -5,8 +5,6 @@
#pragma once
-#include <boost/config.hpp>
-
#include <string>
#include <utility>
#include <vector>
@@ -24,10 +22,10 @@ public:
CommandLine() = default;
explicit CommandLine(const std::string& argv0, const std::vector<std::string>& args = {})
- : m_argv0(argv0), m_args(args) {}
+ : m_argv0{argv0}, m_args{args} {}
explicit CommandLine(std::string&& argv0, std::vector<std::string>&& args = {})
- : m_argv0(std::move(argv0)), m_args(std::move(args)) {}
+ : m_argv0{std::move(argv0)}, m_args{std::move(args)} {}
explicit CommandLine(const std::vector<std::string>& argv);
@@ -50,7 +48,7 @@ public:
std::vector<std::string> get_argv() const;
private:
- static BOOST_CONSTEXPR char token_sep() { return ' '; }
+ static constexpr char token_sep() { return ' '; }
std::string escape_argv0() const { return escape(get_argv0()); }
diff --git a/include/winapi/error.hpp b/include/winapi/error.hpp
index a14d333..8ecd720 100644
--- a/include/winapi/error.hpp
+++ b/include/winapi/error.hpp
@@ -5,8 +5,6 @@
#pragma once
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cstdint>
@@ -22,7 +20,7 @@ class CategoryWindows : public std::error_category {
public:
CategoryWindows() = default;
- const char* name() const BOOST_NOEXCEPT_OR_NOTHROW { return "Windows"; }
+ const char* name() const noexcept { return "Windows"; }
std::string message(int32_t) const;
};
diff --git a/include/winapi/file.hpp b/include/winapi/file.hpp
index e9f8510..7d0126c 100644
--- a/include/winapi/file.hpp
+++ b/include/winapi/file.hpp
@@ -42,7 +42,7 @@ public:
static void remove(const std::string&);
static void remove(const CanonicalPath&);
- explicit File(Handle&& handle) : Handle(std::move(handle)) {}
+ explicit File(Handle&& handle) : Handle{std::move(handle)} {}
std::size_t get_size() const;
diff --git a/include/winapi/handle.hpp b/include/winapi/handle.hpp
index 1145fd6..8ea90aa 100644
--- a/include/winapi/handle.hpp
+++ b/include/winapi/handle.hpp
@@ -7,8 +7,6 @@
#include "buffer.hpp"
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cstddef>
@@ -23,11 +21,6 @@ public:
Handle() = default;
explicit Handle(HANDLE);
- Handle(Handle&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Handle& operator=(Handle other) BOOST_NOEXCEPT_OR_NOTHROW;
- void swap(Handle& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Handle(const Handle&) = delete;
-
HANDLE get() const { return m_impl.get(); }
HANDLE ptr() const { return get(); }
@@ -45,7 +38,7 @@ public:
Buffer read() const;
- BOOST_STATIC_CONSTEXPR std::size_t max_chunk_size = 16 * 1024;
+ static constexpr std::size_t max_chunk_size = 16 * 1024;
bool read_chunk(Buffer& read_chunk) const;
void write(const void*, std::size_t nb) const;
@@ -67,17 +60,4 @@ private:
std::unique_ptr<void, Close> m_impl;
};
-inline void swap(Handle& a, Handle& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // namespace winapi
-
-namespace std {
-
-template <>
-inline void swap(winapi::Handle& a, winapi::Handle& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-} // namespace std
diff --git a/include/winapi/pipe.hpp b/include/winapi/pipe.hpp
index 9f71858..aec87cd 100644
--- a/include/winapi/pipe.hpp
+++ b/include/winapi/pipe.hpp
@@ -7,8 +7,6 @@
#include "handle.hpp"
-#include <boost/config.hpp>
-
#include <utility>
namespace winapi {
@@ -17,12 +15,6 @@ class Pipe {
public:
Pipe();
- // VS 2013 won't generate these automatically.
- Pipe(Pipe&&) BOOST_NOEXCEPT_OR_NOTHROW;
- Pipe& operator=(Pipe) BOOST_NOEXCEPT_OR_NOTHROW;
- void swap(Pipe&) BOOST_NOEXCEPT_OR_NOTHROW;
- Pipe(const Pipe&) = delete;
-
Handle& read_end() { return m_read_end; }
const Handle& read_end() const { return m_read_end; }
Handle& write_end() { return m_write_end; }
@@ -33,17 +25,4 @@ private:
Handle m_write_end;
};
-inline void swap(Pipe& a, Pipe& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // namespace winapi
-
-namespace std {
-
-template <>
-inline void swap(winapi::Pipe& a, winapi::Pipe& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-} // namespace std
diff --git a/include/winapi/process.hpp b/include/winapi/process.hpp
index b79d7c2..d5a4ed5 100644
--- a/include/winapi/process.hpp
+++ b/include/winapi/process.hpp
@@ -10,7 +10,6 @@
#include "process_io.hpp"
#include "resource.hpp"
-#include <boost/config.hpp>
#include <boost/optional.hpp>
#include <windows.h>
@@ -28,23 +27,13 @@ struct ProcessParameters {
ConsoleNew,
};
- 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;
+ explicit ProcessParameters(const CommandLine& cmd_line) : cmd_line{cmd_line} {}
CommandLine cmd_line;
boost::optional<process::IO> io;
ConsoleCreationMode console_mode = ConsoleNew;
};
-inline void swap(ProcessParameters& a, ProcessParameters& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
struct ShellParameters : ProcessParameters {
static ShellParameters runas(const CommandLine& cmd_line) {
ShellParameters params{cmd_line};
@@ -52,21 +41,11 @@ struct ShellParameters : ProcessParameters {
return params;
}
- explicit ShellParameters(const CommandLine& cmd_line) : ProcessParameters(cmd_line) {}
-
- // 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;
+ explicit ShellParameters(const CommandLine& cmd_line) : ProcessParameters{cmd_line} {}
boost::optional<std::string> verb;
};
-inline void swap(ShellParameters& a, ShellParameters& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
class Process {
public:
using ID = DWORD;
@@ -85,12 +64,6 @@ public:
static DWORD default_permissions();
static DWORD read_permissions();
- // 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;
-
ID get_id() const { return m_id; }
const Handle& get_handle() const { return m_handle; }
@@ -115,28 +88,4 @@ private:
Handle m_handle;
};
-inline void swap(Process& a, Process& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // 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
diff --git a/include/winapi/process_io.hpp b/include/winapi/process_io.hpp
index 976ad6e..805ada8 100644
--- a/include/winapi/process_io.hpp
+++ b/include/winapi/process_io.hpp
@@ -9,8 +9,6 @@
#include "path.hpp"
#include "pipe.hpp"
-#include <boost/config.hpp>
-
#include <string>
#include <utility>
@@ -20,29 +18,14 @@ namespace process {
struct Stream {
Stream(Handle&& handle) : handle{std::move(handle)} {}
- // VS 2013 won't generate these automatically.
- Stream(Stream&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stream& operator=(Stream other) BOOST_NOEXCEPT_OR_NOTHROW;
- void swap(Stream& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stream(const Stream&) = delete;
-
Handle handle;
};
-inline void swap(Stream& a, Stream& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
struct Stdin : Stream {
Stdin();
explicit Stdin(const std::string& file);
explicit Stdin(const CanonicalPath& file);
explicit Stdin(Pipe&);
-
- // VS 2013 won't generate these automatically.
- Stdin(Stdin&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stdin& operator=(Stdin other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stdin(const Stdin&) = delete;
};
struct Stdout : Stream {
@@ -50,11 +33,6 @@ struct Stdout : Stream {
explicit Stdout(const std::string& file);
explicit Stdout(const CanonicalPath& file);
explicit Stdout(Pipe&);
-
- // VS 2013 won't generate these automatically.
- Stdout(Stdout&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stdout& operator=(Stdout other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stdout(const Stdout&) = delete;
};
struct Stderr : Stream {
@@ -62,22 +40,11 @@ struct Stderr : Stream {
explicit Stderr(const std::string& file);
explicit Stderr(const CanonicalPath& file);
explicit Stderr(Pipe&);
-
- // VS 2013 won't generate these automatically.
- Stderr(Stderr&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stderr& operator=(Stderr other) BOOST_NOEXCEPT_OR_NOTHROW;
- Stderr(const Stderr&) = delete;
};
struct IO {
IO() = default;
- // VS 2013 won't generate these automatically.
- IO(IO&& other) BOOST_NOEXCEPT_OR_NOTHROW;
- IO& operator=(IO other) BOOST_NOEXCEPT_OR_NOTHROW;
- void swap(IO& other) BOOST_NOEXCEPT_OR_NOTHROW;
- IO(const IO&) = delete;
-
void close();
Stdin std_in;
@@ -85,23 +52,5 @@ struct IO {
Stderr std_err;
};
-inline void swap(IO& a, IO& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // namespace process
} // namespace winapi
-
-namespace std {
-
-template <>
-inline void swap(winapi::process::Stream& a, winapi::process::Stream& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-template <>
-inline void swap(winapi::process::IO& a, winapi::process::IO& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-} // namespace std
diff --git a/include/winapi/resource.hpp b/include/winapi/resource.hpp
index 3fda73e..2f77d3e 100644
--- a/include/winapi/resource.hpp
+++ b/include/winapi/resource.hpp
@@ -16,7 +16,7 @@ struct Resource {
Resource() = default;
- Resource(const void* data, std::size_t nb) : data(data), nb(nb) {}
+ Resource(const void* data, std::size_t nb) : data{data}, nb{nb} {}
Buffer copy() const { return {data, nb}; }
diff --git a/include/winapi/shmem.hpp b/include/winapi/shmem.hpp
index f2ce33e..4fc5ac7 100644
--- a/include/winapi/shmem.hpp
+++ b/include/winapi/shmem.hpp
@@ -7,8 +7,6 @@
#include "handle.hpp"
-#include <boost/config.hpp>
-
#include <cstddef>
#include <memory>
#include <string>
@@ -22,12 +20,6 @@ public:
static SharedMemory create(const std::string& name, std::size_t nb);
static SharedMemory open(const std::string& name);
- // VS 2013 won't generate these automatically:
- SharedMemory(SharedMemory&&) BOOST_NOEXCEPT_OR_NOTHROW;
- SharedMemory& operator=(SharedMemory) BOOST_NOEXCEPT_OR_NOTHROW;
- void swap(SharedMemory&) BOOST_NOEXCEPT_OR_NOTHROW;
- SharedMemory(const SharedMemory&) = delete;
-
void* get() const { return m_addr.get(); }
void* ptr() const { return get(); }
@@ -38,16 +30,12 @@ private:
SharedMemory() = default;
- SharedMemory(Handle&& handle, void* addr) : m_handle(std::move(handle)), m_addr(addr) {}
+ SharedMemory(Handle&& handle, void* addr) : m_handle{std::move(handle)}, m_addr{addr} {}
Handle m_handle;
std::unique_ptr<void, Unmap> m_addr;
};
-inline void swap(SharedMemory& a, SharedMemory& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
template <typename T>
class SharedObject {
public:
@@ -66,21 +54,8 @@ public:
return obj;
}
- SharedObject(SharedObject&& other) BOOST_NOEXCEPT_OR_NOTHROW
- : m_shmem(std::move(other.m_shmem)),
- m_destruct(other.m_destruct) {}
-
- SharedObject& operator=(SharedObject other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
- }
-
- void swap(SharedObject& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_shmem, other.m_shmem);
- swap(m_destruct, other.m_destruct);
- }
-
+ SharedObject(SharedObject&& other) noexcept = default;
+ SharedObject& operator=(const SharedObject& other) noexcept = default;
SharedObject(const SharedObject&) = delete;
~SharedObject() {
@@ -103,18 +78,4 @@ private:
bool m_destruct = false;
};
-template <typename T>
-inline void swap(SharedObject<T>& a, SharedObject<T>& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // namespace winapi
-
-namespace std {
-
-template <>
-inline void swap(winapi::SharedMemory& a, winapi::SharedMemory& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-} // namespace std
diff --git a/include/winapi/sid.hpp b/include/winapi/sid.hpp
index f418b89..5a7c759 100644
--- a/include/winapi/sid.hpp
+++ b/include/winapi/sid.hpp
@@ -7,8 +7,6 @@
#include "buffer.hpp"
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cstddef>
@@ -18,7 +16,7 @@ namespace winapi {
class Sid {
public:
- BOOST_STATIC_CONSTEXPR std::size_t MAX_SID_SIZE = SECURITY_MAX_SID_SIZE;
+ static constexpr std::size_t MAX_SID_SIZE = SECURITY_MAX_SID_SIZE;
typedef SID Impl;
diff --git a/src/cmd_line.cpp b/src/cmd_line.cpp
index d2eeab5..3fc0a7e 100644
--- a/src/cmd_line.cpp
+++ b/src/cmd_line.cpp
@@ -9,7 +9,6 @@
#include <winapi/utils.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/config.hpp>
// clang-format off
#include <windows.h>
@@ -87,11 +86,11 @@ CommandLine CommandLine::from_main(int argc, wchar_t* argv[]) {
return CommandLine{narrow_all(argc, argv)};
}
-CommandLine::CommandLine(const std::vector<std::string>& argv) : m_args(argv) {
+CommandLine::CommandLine(const std::vector<std::string>& argv) : m_args{argv} {
m_argv0 = split_argv0(m_args);
}
-CommandLine::CommandLine(std::vector<std::string>&& argv) : m_args(std::move(argv)) {
+CommandLine::CommandLine(std::vector<std::string>&& argv) : m_args{std::move(argv)} {
m_argv0 = split_argv0(m_args);
}
@@ -128,7 +127,7 @@ std::string CommandLine::escape(const std::string& arg) {
}
std::string CommandLine::escape_cmd(const std::string& arg) {
- BOOST_STATIC_CONSTEXPR auto escape_symbol = '^';
+ static constexpr auto escape_symbol = '^';
static const std::string dangerous_symbols{"^!\"%&()<>|"};
auto safe = escape(arg);
diff --git a/src/handle.cpp b/src/handle.cpp
index 66f878f..2260aa3 100644
--- a/src/handle.cpp
+++ b/src/handle.cpp
@@ -8,8 +8,6 @@
#include <winapi/handle.hpp>
#include <winapi/utils.hpp>
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cassert>
@@ -36,21 +34,7 @@ bool is_std_handle(HANDLE handle) {
} // namespace
-Handle::Handle(HANDLE impl) : m_impl(impl) {}
-
-Handle::Handle(Handle&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-Handle& Handle::operator=(Handle other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void Handle::swap(Handle& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_impl, other.m_impl);
-}
+Handle::Handle(HANDLE impl) : m_impl{impl} {}
bool Handle::is_valid() const {
return m_impl && is_valid(m_impl.get());
diff --git a/src/path.cpp b/src/path.cpp
index 7848df2..409fc44 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -9,6 +9,7 @@
#include <windows.h>
+#include <cstddef>
#include <limits>
#include <stdexcept>
#include <string>
@@ -18,7 +19,7 @@ namespace winapi {
namespace {
std::wstring do_canonicalize(const std::wstring& path) {
- BOOST_STATIC_CONSTEXPR std::size_t init_buffer_size = MAX_PATH;
+ static constexpr std::size_t init_buffer_size = MAX_PATH;
static_assert(init_buffer_size > 0, "init_buffer_size must be positive");
std::vector<wchar_t> buffer;
diff --git a/src/pipe.cpp b/src/pipe.cpp
index 299ab0f..d649657 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -7,8 +7,6 @@
#include <winapi/handle.hpp>
#include <winapi/pipe.hpp>
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cstring>
@@ -26,7 +24,7 @@ void create_pipe(Handle& read_end, Handle& write_end) {
attributes.nLength = sizeof(attributes);
attributes.bInheritHandle = TRUE;
- BOOST_STATIC_CONSTEXPR DWORD buffer_size = 16 * 1024;
+ static constexpr DWORD buffer_size = 16 * 1024;
const auto ret = ::CreatePipe(&read_end_impl, &write_end_impl, &attributes, buffer_size);
@@ -44,19 +42,4 @@ Pipe::Pipe() {
create_pipe(m_read_end, m_write_end);
}
-Pipe::Pipe(Pipe&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-Pipe& Pipe::operator=(Pipe other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void Pipe::swap(Pipe& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_read_end, other.m_read_end);
- swap(m_write_end, other.m_write_end);
-}
-
} // namespace winapi
diff --git a/src/process.cpp b/src/process.cpp
index 5e9ac13..9a602c8 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -11,8 +11,6 @@
#include <winapi/resource.hpp>
#include <winapi/utf8.hpp>
-#include <boost/config.hpp>
-
// clang-format off
#include <windows.h>
#include <shellapi.h>
@@ -61,7 +59,7 @@ Handle create_process(ProcessParameters& params) {
*
* Another useful link is https://ikriv.com/dev/cpp/ConsoleProxy/flags.
*/
- BOOST_STATIC_CONSTEXPR DWORD default_dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
+ static constexpr DWORD default_dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
STARTUPINFOW startup_info;
std::memset(&startup_info, 0, sizeof(startup_info));
@@ -125,7 +123,7 @@ Handle shell_execute(const ShellParameters& params) {
const auto lpFile = widen(params.cmd_line.get_argv0());
const auto lpParameters = widen(params.cmd_line.args_to_string());
- BOOST_STATIC_CONSTEXPR uint32_t default_fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
+ static constexpr uint32_t default_fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
auto fMask = default_fMask;
auto nShow = SW_SHOWDEFAULT;
@@ -240,38 +238,6 @@ std::string get_exe_path(const Handle& process) {
} // namespace
-ProcessParameters::ProcessParameters(ProcessParameters&& other) BOOST_NOEXCEPT_OR_NOTHROW
- : cmd_line(std::move(other.cmd_line)),
- io(std::move(other.io)),
- console_mode(std::move(other.console_mode)) {}
-
-ProcessParameters& ProcessParameters::operator=(ProcessParameters other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void ProcessParameters::swap(ProcessParameters& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(cmd_line, other.cmd_line);
- swap(io, other.io);
- swap(console_mode, other.console_mode);
-}
-
-ShellParameters::ShellParameters(ShellParameters&& other) BOOST_NOEXCEPT_OR_NOTHROW
- : ProcessParameters(std::move(other)),
- verb(std::move(verb)) {}
-
-ShellParameters& ShellParameters::operator=(ShellParameters other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void ShellParameters::swap(ShellParameters& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- ProcessParameters::swap(other);
- swap(verb, other.verb);
-}
-
Process Process::create(ProcessParameters params) {
return Process{create_process(params)};
}
@@ -316,20 +282,6 @@ DWORD Process::read_permissions() {
return default_permissions() | PROCESS_VM_READ;
}
-Process::Process(Process&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-Process& Process::operator=(Process other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void Process::swap(Process& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_handle, other.m_handle);
-}
-
bool Process::is_running() const {
const auto ret = ::WaitForSingleObject(static_cast<HANDLE>(m_handle), 0);
diff --git a/src/process_io.cpp b/src/process_io.cpp
index e18558c..149081b 100644
--- a/src/process_io.cpp
+++ b/src/process_io.cpp
@@ -8,95 +8,42 @@
#include <winapi/path.hpp>
#include <winapi/process_io.hpp>
-#include <boost/config.hpp>
-
#include <string>
#include <utility>
namespace winapi {
namespace process {
-Stdin::Stdin() : Stream(Handle::std_in()) {}
+Stdin::Stdin() : Stream{Handle::std_in()} {}
-Stdout::Stdout() : Stream(Handle::std_out()) {}
+Stdout::Stdout() : Stream{Handle::std_out()} {}
-Stderr::Stderr() : Stream(Handle::std_err()) {}
+Stderr::Stderr() : Stream{Handle::std_err()} {}
-Stdin::Stdin(const std::string& path) : Stream(File::open_r(path)) {}
+Stdin::Stdin(const std::string& path) : Stream{File::open_r(path)} {}
-Stdin::Stdin(const CanonicalPath& path) : Stream(File::open_r(path)) {}
+Stdin::Stdin(const CanonicalPath& path) : Stream{File::open_r(path)} {}
-Stdout::Stdout(const std::string& path) : Stream(File::open_w(path)) {}
+Stdout::Stdout(const std::string& path) : Stream{File::open_w(path)} {}
-Stdout::Stdout(const CanonicalPath& path) : Stream(File::open_w(path)) {}
+Stdout::Stdout(const CanonicalPath& path) : Stream{File::open_w(path)} {}
-Stderr::Stderr(const std::string& path) : Stream(File::open_w(path)) {}
+Stderr::Stderr(const std::string& path) : Stream{File::open_w(path)} {}
-Stderr::Stderr(const CanonicalPath& path) : Stream(File::open_w(path)) {}
+Stderr::Stderr(const CanonicalPath& path) : Stream{File::open_w(path)} {}
-Stdin::Stdin(Pipe& pipe) : Stream(std::move(pipe.read_end())) {
+Stdin::Stdin(Pipe& pipe) : Stream{std::move(pipe.read_end())} {
pipe.write_end().dont_inherit();
}
-Stdout::Stdout(Pipe& pipe) : Stream(std::move(pipe.write_end())) {
+Stdout::Stdout(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
pipe.read_end().dont_inherit();
}
-Stderr::Stderr(Pipe& pipe) : Stream(std::move(pipe.write_end())) {
+Stderr::Stderr(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
pipe.read_end().dont_inherit();
}
-Stream::Stream(Stream&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-Stream& Stream::operator=(Stream other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void Stream::swap(Stream& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(handle, other.handle);
-}
-
-Stdin::Stdin(Stdin&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream(std::move(other)) {}
-
-Stdin& Stdin::operator=(Stdin other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
-}
-
-Stdout::Stdout(Stdout&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream(std::move(other)) {}
-
-Stdout& Stdout::operator=(Stdout other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
-}
-
-Stderr::Stderr(Stderr&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream(std::move(other)) {}
-
-Stderr& Stderr::operator=(Stderr other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
-}
-
-IO::IO(IO&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-IO& IO::operator=(IO other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void IO::swap(IO& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(std_in, other.std_in);
- swap(std_out, other.std_out);
- swap(std_err, other.std_err);
-}
-
void IO::close() {
std_in.handle.close();
std_out.handle.close();
diff --git a/src/shmem.cpp b/src/shmem.cpp
index c1f3757..a636f4e 100644
--- a/src/shmem.cpp
+++ b/src/shmem.cpp
@@ -9,8 +9,6 @@
#include <winapi/utf8.hpp>
#include <winapi/utils.hpp>
-#include <boost/config.hpp>
-
#include <windows.h>
#include <cstddef>
@@ -70,19 +68,4 @@ SharedMemory SharedMemory::open(const std::string& name) {
return {std::move(mapping), addr};
}
-SharedMemory::SharedMemory(SharedMemory&& other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
-}
-
-SharedMemory& SharedMemory::operator=(SharedMemory other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
-}
-
-void SharedMemory::swap(SharedMemory& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_handle, other.m_handle);
- swap(m_addr, other.m_addr);
-}
-
} // namespace winapi
diff --git a/test/unit_tests/resource.cpp b/test/unit_tests/resource.cpp
index 66556d5..2f63703 100644
--- a/test/unit_tests/resource.cpp
+++ b/test/unit_tests/resource.cpp
@@ -8,7 +8,6 @@
#include <winapi/process.hpp>
#include <winapi/utf8.hpp>
-#include <boost/config.hpp>
#include <boost/format.hpp>
#include <boost/test/unit_test.hpp>
@@ -39,13 +38,13 @@ BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(Buffer);
BOOST_AUTO_TEST_SUITE(resource_tests)
BOOST_AUTO_TEST_CASE(get_string) {
- BOOST_STATIC_CONSTEXPR auto expected = "This is a test resource string!";
+ static constexpr auto expected = "This is a test resource string!";
const auto actual = Process::get_resource_string(IDS_TEST_STRING);
BOOST_TEST(actual == expected);
}
BOOST_AUTO_TEST_CASE(get_string_wide) {
- BOOST_STATIC_CONSTEXPR auto expected = "This is another test string, wide this time.";
+ static constexpr auto expected = "This is another test string, wide this time.";
const auto actual = Process::get_resource_string(IDS_TEST_STRING_WIDE);
BOOST_TEST(actual == expected);
}
diff --git a/test/unit_tests/shared/command.hpp b/test/unit_tests/shared/command.hpp
index 4a91370..4ba9385 100644
--- a/test/unit_tests/shared/command.hpp
+++ b/test/unit_tests/shared/command.hpp
@@ -9,7 +9,6 @@
#include <winapi/shmem.hpp>
-#include <boost/config.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
@@ -29,7 +28,7 @@ struct StdHandles {
HANDLE err;
};
-BOOST_STATIC_CONSTEXPR auto COMMAND_SHMEM_NAME = "shmem-test-cmd";
+static constexpr auto COMMAND_SHMEM_NAME = "shmem-test-cmd";
class Command {
public:
diff --git a/test/unit_tests/shared/console.hpp b/test/unit_tests/shared/console.hpp
index 48d1faa..cdc12e4 100644
--- a/test/unit_tests/shared/console.hpp
+++ b/test/unit_tests/shared/console.hpp
@@ -28,9 +28,9 @@ class Buffer {
public:
typedef CONSOLE_SCREEN_BUFFER_INFO Info;
- Buffer() : m_handle(winapi::Handle::std_out()), m_info(get_info(m_handle)) {}
+ Buffer() : m_handle{winapi::Handle::std_out()}, m_info{get_info(m_handle)} {}
- Buffer(winapi::Handle&& handle) : m_handle(std::move(handle)), m_info(get_info(m_handle)) {}
+ Buffer(winapi::Handle&& handle) : m_handle{std::move(handle)}, m_info{get_info(m_handle)} {}
int16_t get_columns() const { return m_info.dwSize.X; }
diff --git a/test/unit_tests/shared/test_data.hpp b/test/unit_tests/shared/test_data.hpp
index 0094f0b..1c8316a 100644
--- a/test/unit_tests/shared/test_data.hpp
+++ b/test/unit_tests/shared/test_data.hpp
@@ -10,7 +10,7 @@
namespace worker {
namespace test_data {
-BOOST_STATIC_CONSTEXPR auto str = "Test output.";
+static constexpr auto str = "Test output.";
inline std::string out() {
return "stdout: " + std::string{str};
diff --git a/test/unit_tests/shared/worker.hpp b/test/unit_tests/shared/worker.hpp
index a1067ac..9ba7020 100644
--- a/test/unit_tests/shared/worker.hpp
+++ b/test/unit_tests/shared/worker.hpp
@@ -9,8 +9,6 @@
#include <winapi/process.hpp>
-#include <boost/config.hpp>
-
#include <windows.h>
#include <exception>
@@ -22,23 +20,11 @@ namespace worker {
class Worker {
public:
- Worker(winapi::Process&& process) : m_cmd(Command::create()), m_process(std::move(process)) {}
-
- Worker(Worker&& other) BOOST_NOEXCEPT_OR_NOTHROW : m_cmd(std::move(other.m_cmd)),
- m_process(std::move(other.m_process)) {}
-
- Worker& operator=(Worker other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
- }
-
- void swap(Worker& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(m_cmd, other.m_cmd);
- swap(m_process, other.m_process);
- }
+ Worker(winapi::Process&& process) : m_cmd{Command::create()}, m_process{std::move(process)} {}
+ Worker(Worker&& other) noexcept = default;
Worker(const Worker&) = delete;
+ Worker& operator=(const Worker& other) noexcept = default;
~Worker() {
try {
@@ -101,17 +87,4 @@ private:
winapi::Process m_process;
};
-inline void swap(Worker& a, Worker& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
} // namespace worker
-
-namespace std {
-
-template <>
-inline void swap(worker::Worker& a, worker::Worker& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
-
-} // namespace std
diff --git a/test/unit_tests/shmem.cpp b/test/unit_tests/shmem.cpp
index 894a0f9..d56242c 100644
--- a/test/unit_tests/shmem.cpp
+++ b/test/unit_tests/shmem.cpp
@@ -5,7 +5,6 @@
#include <winapi/shmem.hpp>
-#include <boost/config.hpp>
#include <boost/test/unit_test.hpp>
#include <condition_variable>
@@ -17,11 +16,11 @@ using namespace winapi;
namespace {
-BOOST_CONSTEXPR_OR_CONST auto shmem_name = "test-data-struct";
+static constexpr auto shmem_name = "test-data-struct";
-BOOST_CONSTEXPR_OR_CONST int32_t main_data = -1;
-BOOST_CONSTEXPR_OR_CONST int32_t setter1_data = 69;
-BOOST_CONSTEXPR_OR_CONST int32_t setter2_data = 420;
+static constexpr int32_t main_data = -1;
+static constexpr int32_t setter1_data = 69;
+static constexpr int32_t setter2_data = 420;
struct DataStruct {
std::mutex mtx;