cppfig 0.1.0
Modern C++20 compile-time type-safe configuration library
Loading...
Searching...
No Matches
cppfig::Status Class Reference

A lightweight status object carrying an error code and message. More...

#include <status.h>

Public Member Functions

 Status ()=default
 Constructs an OK status.
 
 Status (StatusCode code, std::string message)
 Constructs a status with the given code and message.
 
auto ok () const noexcept -> bool
 Returns true if the status represents success.
 
auto code () const noexcept -> StatusCode
 Returns the error code.
 
auto message () const noexcept -> std::string_view
 Returns the error message (empty for OK status).
 

Detailed Description

A lightweight status object carrying an error code and message.

A default-constructed Status is OK. Error states carry a non-empty message describing the failure.

Constructor & Destructor Documentation

◆ Status() [1/2]

cppfig::Status::Status ( )
default

Constructs an OK status.

◆ Status() [2/2]

cppfig::Status::Status ( StatusCode  code,
std::string  message 
)
inline

Constructs a status with the given code and message.

Member Function Documentation

◆ code()

auto cppfig::Status::code ( ) const -> StatusCode
inlinenoexcept

Returns the error code.

◆ message()

auto cppfig::Status::message ( ) const -> std::string_view
inlinenoexcept

Returns the error message (empty for OK status).

◆ ok()

auto cppfig::Status::ok ( ) const -> bool
inlinenoexcept

Returns true if the status represents success.


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