123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <chapter xml:id="windows.handle.h">
- <title><tt>__vic/windows/handle.h</tt></title>
- <chapter xml:id="windows--Handle">
- <title><tt>windows::Handle</tt></title>
- <code-block lang="C++"><![CDATA[
- class windows::Handle
- {
- public:
- Handle() = default; // uninitialized
- constexpr Handle(HANDLE h);
- void Close();
- bool CloseNT() noexcept;
- static void Close(HANDLE h);
- bool Wait(DWORD timeout = INFINITE) const;
- bool IsInvalid() const;
- void SetInvalid();
- operator HANDLE() const;
- void swap(Handle &o) noexcept;
- };
- ]]></code-block>
- <p>A C++ wrapper for Win32 API <tt>HANDLE</tt>.</p>
- <section><title>Class members</title>
- <synopsis>
- <prototype>Handle() = default</prototype>
- <p>Creates an uninitialized value.</p>
- </synopsis>
- <synopsis>
- <prototype>constexpr Handle(HANDLE h)</prototype>
- <p>Implicit converter from <tt>HANDLE</tt>.</p>
- <postcondition><tt>*this == h</tt></postcondition>
- </synopsis>
- <synopsis>
- <prototype>operator HANDLE() const</prototype>
- <p>Implicit converter to <tt>HANDLE</tt>.</p>
- </synopsis>
- <synopsis>
- <prototype>bool IsInvalid() const</prototype>
- <p>Returns <tt>true</tt> if the handle has value <tt>INVALID_HANDLE_VALUE</tt>.
- </p>
- </synopsis>
- <synopsis>
- <prototype>void SetInvalid()</prototype>
- <p>Assigns value <tt>INVALID_HANDLE_VALUE</tt> to the handle.</p>
- <postcondition><tt>IsInvalid() == true</tt></postcondition>
- </synopsis>
- <synopsis>
- <prototype>void Close()</prototype>
- <prototype>static void Close(HANDLE h)</prototype>
- <p>Calls <tt>::CloseHandle()</tt>. Throws on error.</p>
- <precondition>The same as for <tt>::CloseHandle()</tt>.</precondition>
- </synopsis>
- <synopsis>
- <prototype>bool CloseNT() noexcept</prototype>
- <p>Calls <tt>::CloseHandle()</tt> and returns <tt>true</tt> on success.
- On failure <tt>::GetLastError()</tt> can be used to get the error
- description.</p>
- <precondition>The same as for <tt>::CloseHandle()</tt>.</precondition>
- </synopsis>
- <synopsis>
- <prototype>bool Wait(DWORD timeout = INFINITE) const</prototype>
- <p>Calls <tt>::WaitForSingleObject()</tt> with the specified timeout. Returns
- <tt>false</tt> in case of <tt>WAIT_TIMEOUT</tt>. Throws on error.
- <xref to="windows--WaitAbandoned"/> is thrown in case of
- <tt>WAIT_ABANDONED</tt>.</p>
- </synopsis>
- <synopsis>
- <prototype>void swap(Handle &o) noexcept</prototype>
- <p>Swaps the value with <tt>o</tt>.</p>
- </synopsis>
- </section>
- </chapter>
- <chapter xml:id="windows--WaitAbandoned">
- <title><tt>windows::WaitAbandoned</tt></title>
- <code-block lang="C++"><![CDATA[
- struct windows::WaitAbandoned : public std::exception
- {
- const char *what() const noexcept;
- };
- ]]></code-block>
- <p>An exception class thrown by <tt>__vic::windows::Handle::Wait()</tt>.</p>
- </chapter>
- </chapter>
|