logmeow/misc.cpp

28 lines
697 B
C++
Raw Normal View History

2023-01-16 04:05:25 +00:00
#include <iomanip>
#include <sstream>
2023-01-16 08:41:26 +00:00
#include <system_error>
2023-01-16 04:05:25 +00:00
#include "misc.h"
std::string quote(const std::string& str) {
std::stringstream ss;
ss << std::quoted(str);
return ss.str();
}
2023-01-16 08:41:26 +00:00
std::system_error make_system_error(int err, const char* what) {
return std::system_error(err, std::generic_category(), what);
}
std::system_error make_system_error(int err, std::string what) {
return std::system_error(err, std::generic_category(), std::move(what));
}
std::system_error make_system_error(const char* what) {
return make_system_error(errno, what);
}
std::system_error make_system_error(std::string what) {
return make_system_error(errno, std::move(what));
}