libvirtualhid 16
Cross-platform C++ library for virtual HID devices.
lvh::OperationStatus Class Reference

Result status with an error category and human-readable message. More...

#include <src/include/libvirtualhid/types.hpp>

Public Member Functions

ErrorCode code () const
 Get the status error category.
 
const std::string & message () const
 Get the human-readable status message.
 
bool ok () const
 Check whether the operation succeeded.
 
 OperationStatus ()
 Construct a successful status.
 
 OperationStatus (ErrorCode code, std::string message)
 Construct a status with an explicit error code and message.
 

Static Public Member Functions

static OperationStatus failure (ErrorCode code, std::string message)
 Create a failing status.
 
static OperationStatus success ()
 Create a successful status.
 

Detailed Description

Result status with an error category and human-readable message.

Constructor & Destructor Documentation

◆ OperationStatus()

lvh::OperationStatus::OperationStatus ( ErrorCode code,
std::string message )

Construct a status with an explicit error code and message.

Parameters
codeError category.
messageHuman-readable status message.

Member Function Documentation

◆ code()

ErrorCode lvh::OperationStatus::code ( ) const

Get the status error category.

Returns
Error category.

◆ failure()

static OperationStatus lvh::OperationStatus::failure ( ErrorCode code,
std::string message )
static

Create a failing status.

Parameters
codeError category.
messageHuman-readable failure message.
Returns
Failing status object.

◆ message()

const std::string & lvh::OperationStatus::message ( ) const

Get the human-readable status message.

Returns
Human-readable status message.

◆ ok()

bool lvh::OperationStatus::ok ( ) const

Check whether the operation succeeded.

Returns
true when the status is successful.

◆ success()

static OperationStatus lvh::OperationStatus::success ( )
static

Create a successful status.

Returns
Successful status object.

The documentation for this class was generated from the following file: