![]() |
simdjson 4.6.4
Ridiculously Fast JSON
|
The result of a simdjson operation that could fail. More...
#include <implementation_simdjson_result_base.h>
Public Types | |
| using | value_type = T |
| using | error_type = error_code |
Public Member Functions | |
| simdjson_inline | implementation_simdjson_result_base () noexcept=default |
| Create a new empty result with error = UNINITIALIZED. | |
| simdjson_inline | implementation_simdjson_result_base (error_code error) noexcept |
| Create a new error result. | |
| simdjson_inline | implementation_simdjson_result_base (T &&value) noexcept |
| Create a new successful result. | |
| simdjson_inline | implementation_simdjson_result_base (T &&value, error_code error) noexcept |
| Create a new result with both things (use if you don't want to branch when creating the result). | |
| simdjson_inline void | tie (T &value, error_code &error) &&noexcept |
| Move the value and the error to the provided variables. | |
| simdjson_warn_unused simdjson_inline error_code | get (T &value) &&noexcept |
| Move the value to the provided variable. | |
| simdjson_warn_unused simdjson_inline error_code | error () const noexcept |
| The error. | |
| simdjson_warn_unused simdjson_inline bool | has_value () const noexcept |
| Whether there is a value. | |
| simdjson_inline T & | operator* () &noexcept(false) |
| Get the result value. | |
| simdjson_inline T && | operator* () &&noexcept(false) |
| simdjson_inline T * | operator-> () noexcept(false) |
| Arrow operator to access members of the contained value. | |
| simdjson_inline const T * | operator-> () const noexcept(false) |
| simdjson_inline T & | value () &noexcept(false) |
| simdjson_inline T && | value () &&noexcept(false) |
| Take the result value (move it). | |
| simdjson_inline T && | take_value () &&noexcept(false) |
| Take the result value (move it). | |
| simdjson_inline | operator T&& () &&noexcept(false) |
| Cast to the value (will throw on error). | |
| simdjson_inline const T & | value_unsafe () const &noexcept |
| Get the result value. | |
| simdjson_inline T & | value_unsafe () &noexcept |
| Get the result value. | |
| simdjson_inline T && | value_unsafe () &&noexcept |
| Take the result value (move it). | |
Protected Attributes | |
| T | first {} |
| users should never directly access first and second. | |
| error_code | second {UNINITIALIZED} |
| Users should never directly access 'first'. | |
The result of a simdjson operation that could fail.
Gives the option of reading error codes, or throwing an exception by casting to the desired result.
This is a base class for implementations that want to add functions to the result type for chaining.
Override like:
struct simdjson_result<T> : public internal::implementation_simdjson_result_base<T> { simdjson_result() noexcept : internal::implementation_simdjson_result_base<T>() {} simdjson_result(error_code error) noexcept : internal::implementation_simdjson_result_base<T>(error) {} simdjson_result(T &&value) noexcept : internal::implementation_simdjson_result_base<T>(std::forward(value)) {} simdjson_result(T &&value, error_code error) noexcept : internal::implementation_simdjson_result_base<T>(value, error) {} // Your extra methods here }
Then any method returning simdjson_result<T> will be chainable with your methods.
Definition at line 35 of file implementation_simdjson_result_base.h.
| using simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::error_type = error_code |
Definition at line 142 of file implementation_simdjson_result_base.h.
| using simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::value_type = T |
Definition at line 141 of file implementation_simdjson_result_base.h.
|
noexcept |
Create a new error result.
Definition at line 110 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Create a new successful result.
Definition at line 113 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Create a new result with both things (use if you don't want to branch when creating the result).
Definition at line 107 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
The error.
Definition at line 32 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Move the value to the provided variable.
| value | The variable to assign the value to. May not be set if there is an error. |
Definition at line 25 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Whether there is a value.
Definition at line 38 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::operator T&& | ( | ) | && |
Cast to the value (will throw on error).
| simdjson_error | if there was an error. |
Definition at line 85 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T && simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::operator* | ( | ) | && |
Definition at line 50 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T & simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::operator* | ( | ) | & |
Get the result value.
| simdjson_error | if there was an error. |
Definition at line 45 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline const T * simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::operator-> | ( | ) | const |
Definition at line 62 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T * simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::operator-> | ( | ) |
Arrow operator to access members of the contained value.
| simdjson_error | if there was an error. |
Definition at line 55 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T && simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::take_value | ( | ) | && |
Take the result value (move it).
| simdjson_error | if there was an error. |
Definition at line 79 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Move the value and the error to the provided variables.
| value | The variable to assign the value to. May not be set if there is an error. |
| error | The variable to assign the error to. Set to SUCCESS if there is no error. |
Definition at line 17 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T && simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::value | ( | ) | && |
Take the result value (move it).
| simdjson_error | if there was an error. |
Definition at line 74 of file implementation_simdjson_result_base-inl.h.
| simdjson_inline T & simdjson::SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base< T >::value | ( | ) | & |
Definition at line 68 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Take the result value (move it).
This function is safe if and only the error() method returns a value that evaluates to false.
Definition at line 102 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Get the result value.
This function is safe if and only the error() method returns a value that evaluates to false.
Definition at line 97 of file implementation_simdjson_result_base-inl.h.
|
noexcept |
Get the result value.
This function is safe if and only the error() method returns a value that evaluates to false.
Definition at line 92 of file implementation_simdjson_result_base-inl.h.
|
protected |
users should never directly access first and second.
Definition at line 146 of file implementation_simdjson_result_base.h.
|
protected |
Users should never directly access 'first'.
Definition at line 147 of file implementation_simdjson_result_base.h.