Corrade::Utility::String::ParseResult class new in Git master

String parse result.

Stores a ParseState and an optional byte index of where a parsing failure happened, returned from parseDecimal() and parseHexadecimal(). The instance is implicitly convertible to a ParseState, allowing you to use just the enum if details about parsing failure aren't needed for anything:

std::int32_t value;
if(Utility::String::parseDecimal(, value) !=
   Utility::String::ParseState::Failed)
{
    
}

Constructors, destructors, conversion operators

ParseResult(ParseState state, std::size_t index = 0)
Constructor.
operator ParseState() const
Parse state.

Public functions

auto state() const -> ParseState
Parse state.
auto index() const -> std::size_t
Parse failure byte index.

Function documentation

std::size_t Corrade::Utility::String::ParseResult::index() const

Parse failure byte index.

Index of a byte in the parsed string on which a parsing failure happened. Has a meaningful value only for ParseState::Failed, otherwise the value is 0.