ParseResult

Engine/source/persistence/rapidjson/error/error.h

Result of parsing (wraps ParseErrorCode)

More...

Public Types

bool(ParseResult::*
BooleanType )() const

! Unspecified boolean type

Private Attributes

Public Functions

Default constructor, no error.

ParseResult(ParseErrorCode code, size_t offset)

Constructor to set an error.

size_t

Get the error offset, if IsError(), 0 otherwise.

Reset error code.

Code()

Get the error code.

bool

Whether the result is an error.

Explicit conversion to

bool
, returns
true
, iff !IsError().

Set(ParseErrorCode code, size_t offset)

Update error code and offset.

Public Friends

Detailed Description

Result of parsing (wraps ParseErrorCode)

Document doc;
ParseResult ok = doc.Parse("[42]");
if (!ok) {
    fprintf(stderr, "JSON parse error: %s (%u)",
            GetParseError_En(ok.Code()), ok.Offset());
    exit(EXIT_FAILURE);
}

Public Types

typedef bool(ParseResult::* BooleanType )() const

! Unspecified boolean type

Private Attributes

ParseErrorCode code_ 
size_t offset_ 

Public Functions

ParseResult()

Default constructor, no error.

ParseResult(ParseErrorCode code, size_t offset)

Constructor to set an error.

_Offset()

Get the error offset, if IsError(), 0 otherwise.

Clear()

Reset error code.

Code()

Get the error code.

IsError()

Whether the result is an error.

operator BooleanType()

Explicit conversion to

bool
, returns
true
, iff !IsError().

operator!=(const ParseResult & that)

operator!=(ParseErrorCode code)

operator==(const ParseResult & that)

operator==(ParseErrorCode code)

Set(ParseErrorCode code, size_t offset)

Update error code and offset.

Public Friends