scnlib  0.1.2
FormattedinputformodernC++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
scn::error Class Reference

Error class. More...

#include <result.h>

Classes

struct  success_tag_t
 

Public Types

enum  code : char {
  good, end_of_stream, invalid_format_string, invalid_scanned_value,
  invalid_operation, value_out_of_range, invalid_argument, exceptions_required,
  unrecoverable_stream_error, stream_source_error, unrecoverable_stream_source_error, unrecoverable_internal_error,
  max_error
}
 Error code. More...
 

Public Member Functions

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

Static Public Member Functions

static SCN_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_stream 

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.

unrecoverable_stream_error 

The stream has encountered an error that cannot be recovered from.

The stream is now unusable.

stream_source_error 

The stream source emitted an error.

unrecoverable_stream_source_error 

The stream source 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

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

Definition at line 76 of file result.h.

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

Definition at line 77 of file result.h.

Member Function Documentation

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

Get error code.

Definition at line 95 of file result.h.

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

Can the stream be used again.

Definition at line 105 of file result.h.

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

Definition at line 99 of file result.h.

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

Evaluated to true if there was no error.

Definition at line 83 of file result.h.

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

Definition at line 92 of file result.h.

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

Definition at line 87 of file result.h.

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

Definition at line 70 of file result.h.


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