xentara-utils v2.1
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::windows::service::ServiceHandle Class Referencefinal

A Windows service handle that closes itself on destruct. More...

#include <xentara/utils/windows/service/ServiceHandle.hpp>

+ Inheritance diagram for xentara::utils::windows::service::ServiceHandle:

Classes

class  Setter
 

Public Types

using NativeType = SC_HANDLE
 A native Windows service handle.
 

Public Member Functions

constexpr ServiceHandle () noexcept=default
 Default constructor.
 
constexpr ServiceHandle (SC_HANDLE nativeHandle) noexcept
 Conversion from a native handle.
 
constexpr ServiceHandle (ServiceHandle &&other) noexcept
 Move constructor.
 
 ~ServiceHandle ()
 Destructor. Silently closes the handle.
 
auto operator= (ServiceHandle &&rhs) noexcept -> ServiceHandle &
 Move assignment operator.
 
 operator SC_HANDLE () const
 Conversion to a native Windows service handle.
 
constexpr operator bool () const noexcept
 Checks whether the object contains a handle.
 
auto operator= (SC_HANDLE nativeHandle) noexcept -> ServiceHandle &
 Assignment from a native handle.
 
constexpr auto release () noexcept -> SC_HANDLE
 Removes the handle and passes ownership to the caller.
 
auto close () noexcept -> bool
 Closes the handle, if any.
 
auto setter () noexcept -> Setter
 Gets a setter for use as an output parameter for C functions.
 

Detailed Description

A Windows service handle that closes itself on destruct.

Member Typedef Documentation

◆ NativeType

A native Windows service handle.

Constructor & Destructor Documentation

◆ ServiceHandle() [1/3]

constexpr xentara::utils::windows::service::ServiceHandle::ServiceHandle ( )
constexprdefaultnoexcept

Default constructor.

Creates an empty object that does not contain a handle.

◆ ServiceHandle() [2/3]

constexpr xentara::utils::windows::service::ServiceHandle::ServiceHandle ( SC_HANDLE  nativeHandle)
constexprnoexcept

Conversion from a native handle.

◆ ServiceHandle() [3/3]

constexpr xentara::utils::windows::service::ServiceHandle::ServiceHandle ( ServiceHandle &&  other)
constexprnoexcept

Move constructor.

◆ ~ServiceHandle()

xentara::utils::windows::service::ServiceHandle::~ServiceHandle ( )

Destructor. Silently closes the handle.

Member Function Documentation

◆ close()

auto xentara::utils::windows::service::ServiceHandle::close ( ) -> bool
noexcept

Closes the handle, if any.

◆ operator bool()

constexpr xentara::utils::windows::service::ServiceHandle::operator bool ( ) const
explicitconstexprnoexcept

Checks whether the object contains a handle.

◆ operator SC_HANDLE()

xentara::utils::windows::service::ServiceHandle::operator SC_HANDLE ( ) const

Conversion to a native Windows service handle.

◆ operator=() [1/2]

auto xentara::utils::windows::service::ServiceHandle::operator= ( SC_HANDLE  nativeHandle) -> ServiceHandle &
noexcept

Assignment from a native handle.

◆ operator=() [2/2]

auto xentara::utils::windows::service::ServiceHandle::operator= ( ServiceHandle &&  rhs) -> ServiceHandle &
noexcept

Move assignment operator.

◆ release()

constexpr auto xentara::utils::windows::service::ServiceHandle::release ( ) -> SC_HANDLE
constexprnoexcept

Removes the handle and passes ownership to the caller.

◆ setter()

auto xentara::utils::windows::service::ServiceHandle::setter ( ) -> Setter
noexcept

Gets a setter for use as an output parameter for C functions.