24#ifndef MYSQL_STRCONV_DECODE_PARSE_RESULT_H
25#define MYSQL_STRCONV_DECODE_PARSE_RESULT_H
41class Parser_internals;
97 [[nodiscard]]
bool is_ok()
const {
160 auto sposition =
static_cast<std::ptrdiff_t
>(position);
229 [[nodiscard]] std::string_view
message()
const {
Helper class that exports the internals from Parse_result.
Definition: parse_result.h:212
std::ptrdiff_t parse_error_position() const
Definition: parse_result.h:219
Parse_status status() const
Definition: parse_result.h:223
Parse_result_internals(const Parse_result &parse_result)
Definition: parse_result.h:216
const Parse_result & m_parse_result
Definition: parse_result.h:233
auto message_form() const
Definition: parse_result.h:225
std::string_view message() const
Definition: parse_result.h:229
Class holding the result from parsing a string, in the form of a status and a message.
Definition: parse_result.h:45
bool is_found() const
Return true if found_count() != 0.
Definition: parse_result.h:118
std::ptrdiff_t m_parse_error_position
The position of the most recent "parse_error".
Definition: parse_result.h:198
Parse_status m_status
The status.
Definition: parse_result.h:201
void set_match_count(std::size_t count) noexcept
Store a result representing that the requested object was successfully parsed, overriding a previous ...
Definition: parse_result.h:175
Message_form m_message_form
The form of the message.
Definition: parse_result.h:204
static constexpr char oom_message[]
Message to use on out-of-memory.
Definition: parse_result.h:189
bool is_prefix_ok() const
Return true if either the last operation succeeded, or failed because a full match was requested and ...
Definition: parse_result.h:104
void revert_parse_error_to_ok() noexcept
Definition: parse_result.h:47
bool is_fullmatch_error() const
Return true if the object was parsed successfully, but there were more characters after the end.
Definition: parse_result.h:133
Message_form
The form of the message stored in this object.
Definition: parse_result.h:140
@ sentence
The message is expressed as a full sentence, for example "Value out of range".
@ expected_string
The message is a string that was expected but not found at the current position.
void update_parse_error_pos(std::size_t position)
Update the position of a parse error to the given position.
Definition: parse_result.h:58
bool is_parse_error() const
Return true if a parse error occurred.
Definition: parse_result.h:126
void set_oom() noexcept
Store a result representing that the requested object could not be parsed because and out-of-memory c...
Definition: parse_result.h:88
std::size_t found_count() const
Return the number of repetitions found in the last call.
Definition: parse_result.h:112
void set_fullmatch_error() noexcept
Store a result representing that an object was successfully parsed from a prefix of the string,...
Definition: parse_result.h:80
void set_store_error(const std::string_view &message) noexcept
Store a result representing that the requested object could not be parsed because something went wron...
Definition: parse_result.h:68
std::size_t m_found_count
If the status is "ok", the number of tokens found.
Definition: parse_result.h:195
bool is_ok() const
Return true if the last operation succeeded, i.e., either a full match was requested and an object wa...
Definition: parse_result.h:97
Parse_status status() const
Return the current status.
Definition: parse_result.h:183
std::string_view message() const
Return the message.
Definition: parse_result.h:186
std::string_view m_message
The message.
Definition: parse_result.h:192
void do_set_parse_error(const std::string_view &string, Message_form message_form, std::size_t position)
Common implementation of set_parse_error and set_parse_error_expected_string.
Definition: parse_result.h:157
bool is_store_error() const
Return true if an environment error occurred.
Definition: parse_result.h:121
static int count
Definition: myisam_ftdump.cc:45
Definition: gtid_binary_format_conv.h:252
Parse_status
The status after parsing an object from a string.
Definition: parse_status.h:39
@ store_error
No parse error was found in the string, but an error occurred when storing into the output object - f...
@ ok
The object could be successfully parsed.
@ parse_error
The object could not be successfully parsed because the string was wrong.
@ ok_backtracked_from_parse_error
There was previously a parse error; the parser has backtracked to a non-error status; the information...
@ fullmatch_error
An object was parsed successfully from a prefix of the string, but there were extra characters after ...
@ string
String represented as std::string
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76