A parser result, which may contain a result of type T, or an error, or both.
More...
#include "donner/base/ParseResult.h"
|
|
| ParseResult (T &&result) |
| | Construct from a successful result.
|
|
| ParseResult (const T &result) |
| | Construct from a successful result.
|
|
| ParseResult (ParseError &&error) |
| | Construct from an error.
|
|
| ParseResult (const ParseError &error) |
| | Construct from an error by value.
|
| | ParseResult (T &&result, ParseError &&error) |
| | Return a result, but also an error.
|
| T & | result () & |
| | Returns the contained result.
|
| T && | result () && |
| | Returns the contained result.
|
| const T & | result () const & |
| | Returns the contained result.
|
| ParseError & | error () & |
| | Returns the contained error.
|
| ParseError && | error () && |
| | Returns the contained error.
|
| const ParseError & | error () const & |
| | Returns the contained error.
|
|
bool | hasResult () const noexcept |
| | Returns true if this ParseResult contains a valid result.
|
|
bool | hasError () const noexcept |
| | Returns true if this ParseResult contains an error.
|
| template<typename Target, typename Functor> |
| ParseResult< Target > | map (const Functor &functor) && |
| | Map the result of this ParseResult to a new type, by transforming the result with the provided functor.
|
| template<typename Target, typename Functor> |
| ParseResult< Target > | mapError (const Functor &functor) && |
| | Map the error of this ParseResult to a new type, by transforming the error with the provided functor.
|
template<typename T>
class donner::xml::ParseResult< T >
A parser result, which may contain a result of type T, or an error, or both.
- Template Parameters
-
◆ ParseResult()
Return a result, but also an error.
Used in the case where partial parse results may be returned.
◆ error() [1/3]
Returns the contained error.
- Precondition
- There is a valid error, i.e. hasError() returns true.
◆ error() [2/3]
Returns the contained error.
- Precondition
- There is a valid error, i.e. hasError() returns true.
◆ error() [3/3]
Returns the contained error.
- Precondition
- There is a valid error, i.e. hasError() returns true.
◆ map()
template<typename T>
template<typename Target, typename Functor>
Map the result of this ParseResult to a new type, by transforming the result with the provided functor.
- Template Parameters
-
| Target | The type to map to. |
| Functor | The functor type. |
- Parameters
-
| functor | The functor to apply to the result. |
◆ mapError()
template<typename T>
template<typename Target, typename Functor>
Map the error of this ParseResult to a new type, by transforming the error with the provided functor.
- Template Parameters
-
| Target | The type to map to. |
| Functor | The functor type. |
- Parameters
-
| functor | The functor to apply to the error. |
◆ result() [1/3]
Returns the contained result.
- Precondition
- There is a valid result, i.e. hasResult() returns true.
◆ result() [2/3]
Returns the contained result.
- Precondition
- There is a valid result, i.e. hasResult() returns true.
◆ result() [3/3]
Returns the contained result.
- Precondition
- There is a valid result, i.e. hasResult() returns true.
The documentation for this class was generated from the following file: