scnlib  0.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scn::error Class Reference

Error class. More...

#include <result.h>

Classes

struct  success_tag_t
 

Public Types

enum  code : char {
  good, end_of_range, invalid_format_string, invalid_scanned_value,
  invalid_operation, value_out_of_range, invalid_argument, exceptions_required,
  source_error, unrecoverable_source_error, unrecoverable_internal_error, max_error
}
 Error code. More...
 

Public Member Functions

constexpr error () noexcept=default
 
constexpr error (success_tag_t) noexcept
 
constexpr error (enum code c, const char *m) noexcept
 
constexpr operator bool () const noexcept
 Evaluated to true if there was no error. More...
 
constexpr bool operator! () const noexcept
 
constexpr operator enum code () const noexcept
 
constexpr enum code code () const noexcept
 Get error code. More...
 
constexpr const char * msg () const noexcept
 
constexpr bool is_recoverable () const noexcept
 Can the stream be used again. More...
 

Static Public Member Functions

static constexpr success_tag_t success_tag ()
 

Detailed Description

Error class.

Used as a return value for functions without a success value.

Definition at line 32 of file result.h.

Member Enumeration Documentation

enum scn::error::code : char

Error code.

Enumerator
good 

No error.

end_of_range 

EOF.

invalid_format_string 

Format string was invalid.

invalid_scanned_value 

Scanned value was invalid for given type.

e.g. a period '.' when scanning for an int

invalid_operation 

Stream does not support the performed operation.

value_out_of_range 

Scanned value was out of range for the desired type.

(e.g. >2^32 for an uint32_t)

invalid_argument 

Invalid argument given to operation.

exceptions_required 

This operation is only possible with exceptions enabled.

source_error 

The source range emitted an error.

unrecoverable_source_error 

The source range emitted an error that cannot be recovered from.

The stream is now unusable.

unrecoverable_internal_error 
max_error 

Definition at line 35 of file result.h.

Constructor & Destructor Documentation

constexpr scn::error::error ( )
defaultnoexcept
constexpr scn::error::error ( success_tag_t  )
inlinenoexcept

Definition at line 73 of file result.h.

constexpr scn::error::error ( enum code  c,
const char *  m 
)
inlinenoexcept

Definition at line 74 of file result.h.

Member Function Documentation

constexpr enum code scn::error::code ( ) const
inlinenoexcept

Get error code.

Definition at line 92 of file result.h.

constexpr bool scn::error::is_recoverable ( ) const
inlinenoexcept

Can the stream be used again.

Definition at line 102 of file result.h.

constexpr const char* scn::error::msg ( ) const
inlinenoexcept

Definition at line 96 of file result.h.

constexpr scn::error::operator bool ( ) const
inlineexplicitnoexcept

Evaluated to true if there was no error.

Definition at line 80 of file result.h.

constexpr scn::error::operator enum code ( ) const
inlinenoexcept

Definition at line 89 of file result.h.

constexpr bool scn::error::operator! ( ) const
inlinenoexcept

Definition at line 84 of file result.h.

static constexpr success_tag_t scn::error::success_tag ( )
inlinestatic

Definition at line 67 of file result.h.


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