mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-23 05:31:03 +00:00
Small fixes
This commit is contained in:
@@ -8,7 +8,19 @@
|
||||
|
||||
namespace utils::nt
|
||||
{
|
||||
template <HANDLE InvalidHandle = nullptr>
|
||||
using HandleFunction = HANDLE();
|
||||
|
||||
inline HANDLE null_handle()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline HANDLE invalid_handle()
|
||||
{
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
template <HandleFunction InvalidHandleFunction = null_handle>
|
||||
class handle
|
||||
{
|
||||
public:
|
||||
@@ -24,7 +36,7 @@ namespace utils::nt
|
||||
if (*this)
|
||||
{
|
||||
CloseHandle(this->handle_);
|
||||
this->handle_ = InvalidHandle;
|
||||
this->handle_ = InvalidHandleFunction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +55,7 @@ namespace utils::nt
|
||||
{
|
||||
this->~handle();
|
||||
this->handle_ = obj.handle_;
|
||||
obj.handle_ = InvalidHandle;
|
||||
obj.handle_ = InvalidHandleFunction();
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -59,7 +71,7 @@ namespace utils::nt
|
||||
|
||||
[[nodiscard]] operator bool() const
|
||||
{
|
||||
return this->handle_ != InvalidHandle;
|
||||
return this->handle_ != InvalidHandleFunction();
|
||||
}
|
||||
|
||||
[[nodiscard]] operator HANDLE() const
|
||||
@@ -68,6 +80,6 @@ namespace utils::nt
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE handle_{InvalidHandle};
|
||||
HANDLE handle_{InvalidHandleFunction()};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,7 +77,9 @@ namespace handle_detail
|
||||
|
||||
template <typename T>
|
||||
struct has_deleter_function<T, std::void_t<decltype(T::deleter(std::declval<T&>()))>>
|
||||
: std::is_same<decltype(T::deleter(std::declval<T&>())), bool> {};
|
||||
: std::is_same<decltype(T::deleter(std::declval<T&>())), bool>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
template <handle_types::type Type, typename T>
|
||||
@@ -145,7 +147,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this->store_.erase(entry);
|
||||
return true;
|
||||
}
|
||||
@@ -173,7 +175,8 @@ public:
|
||||
buffer.read_map(this->store_);
|
||||
}
|
||||
|
||||
value_map::iterator begin() {
|
||||
value_map::iterator begin()
|
||||
{
|
||||
return this->store_.begin();
|
||||
}
|
||||
|
||||
@@ -193,7 +196,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename value_map::iterator get_iterator(const handle_value h)
|
||||
{
|
||||
if (h.type != Type || h.is_pseudo)
|
||||
|
||||
@@ -19,31 +19,31 @@ class logger
|
||||
public:
|
||||
void print(color c, const char* message, ...) const;
|
||||
|
||||
template<typename... Args>
|
||||
template <typename... Args>
|
||||
void info(const char* message, Args... args)
|
||||
{
|
||||
this->print(color::cyan, message, args...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
template <typename... Args>
|
||||
void warn(const char* message, Args... args)
|
||||
{
|
||||
this->print(color::yellow, message, args...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
template <typename... Args>
|
||||
void error(const char* message, Args... args)
|
||||
{
|
||||
this->print(color::red, message, args...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
template <typename... Args>
|
||||
void success(const char* message, Args... args)
|
||||
{
|
||||
this->print(color::green, message, args...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
template <typename... Args>
|
||||
void log(const char* message, Args... args)
|
||||
{
|
||||
this->print(color::gray, message, args...);
|
||||
|
||||
@@ -51,7 +51,7 @@ struct event
|
||||
|
||||
struct file
|
||||
{
|
||||
utils::nt::handle<INVALID_HANDLE_VALUE> handle{};
|
||||
utils::nt::handle<utils::nt::invalid_handle> handle{};
|
||||
std::wstring name{};
|
||||
|
||||
void serialize(utils::buffer_serializer& buffer) const
|
||||
|
||||
Reference in New Issue
Block a user