mrdocs::ParseResult

The result of a parse operation.

Synopsis

Declared in <mrdocs/Support/Parse.hpp>

struct ParseResult;

Description

This class holds the result of a parse operation. The structure is similar to std::from_chars_result, where we have a ptr member that points to the first character not parsed, and a ec member that holds the error code.

If parsing was successful, then ec stores a default constructed Error object, which indicates success. The operator bool can also be used to check for success.

The typical format of a parsing function is:

ParseResult
parseType(
    char const* first,
    char const* last,
    Type& value);

where more parameters can be defined as needed for parsing options.

Member Functions

Name

Description

operator bool

Return true if parsing succeeded.

Data Members

Name

Description

ec

Error status for the parse operation.

ptr

Pointer to the first unparsed character.

Friends

Name

Description

mrdocs::operator==

Equality operator

Non-Member Functions

Name

Description

parse

Parse a string view

Created with MrDocs