Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode). More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/common/arccore/common/internal/json/rapidjson/error/error.h>

Collaboration diagram for ParseResult:

Public Types

typedef bool(ParseResult::* BooleanType) () const
 ! Unspecified boolean type

Public Member Functions

 ParseResult ()
 Default constructor, no error.
 ParseResult (ParseErrorCode code, size_t offset)
 Constructor to set an error.
ParseErrorCode Code () const
 Get the error code.
size_t Offset () const
 Get the error offset, if IsError(), 0 otherwise.
 operator BooleanType () const
 Explicit conversion to bool, returns true, iff !IsError().
bool IsError () const
 Whether the result is an error.
bool operator== (const ParseResult &that) const
bool operator== (ParseErrorCode code) const
bool operator!= (const ParseResult &that) const
bool operator!= (ParseErrorCode code) const
void Clear ()
 Reset error code.
void Set (ParseErrorCode code, size_t offset=0)
 Update error code and offset.

Private Attributes

ParseErrorCode code_
size_t offset_

Friends

bool operator== (ParseErrorCode code, const ParseResult &err)
bool operator!= (ParseErrorCode code, const ParseResult &err)

Detailed Description

Result of parsing (wraps ParseErrorCode).

ParseResult ok = doc.Parse("[42]");
if (!ok) {
fprintf(stderr, "JSON parse error: %s (%u)",
exit(EXIT_FAILURE);
}
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion).
Definition document.h:2710
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
Definition document.h:2891
RAPIDJSON_NAMESPACE_BEGIN const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition en.h:37
ParseErrorCode Code() const
Get the error code.
Definition error.h:117
ParseResult()
Default constructor, no error.
Definition error.h:112
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.
Definition error.h:119
See also
GenericReader::Parse, GenericDocument::Parse

Definition at line 107 of file error.h.

Member Typedef Documentation

◆ BooleanType

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

! Unspecified boolean type

Definition at line 109 of file error.h.

Constructor & Destructor Documentation

◆ ParseResult() [1/2]

ParseResult::ParseResult ( )
inline

Default constructor, no error.

Definition at line 112 of file error.h.

References kParseErrorNone.

◆ ParseResult() [2/2]

ParseResult::ParseResult ( ParseErrorCode code,
size_t offset )
inline

Constructor to set an error.

Definition at line 114 of file error.h.

Member Function Documentation

◆ Clear()

void ParseResult::Clear ( )
inline

Reset error code.

Definition at line 135 of file error.h.

References kParseErrorNone, and Set().

Here is the call graph for this function:

◆ Code()

ParseErrorCode ParseResult::Code ( ) const
inline

Get the error code.

Definition at line 117 of file error.h.

Referenced by Arcane::JSONDocument::parse().

Here is the caller graph for this function:

◆ IsError()

bool ParseResult::IsError ( ) const
inline

Whether the result is an error.

Definition at line 124 of file error.h.

References kParseErrorNone.

Referenced by operator BooleanType().

Here is the caller graph for this function:

◆ Offset()

size_t ParseResult::Offset ( ) const
inline

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

Definition at line 119 of file error.h.

Referenced by Arcane::JSONDocument::parse().

Here is the caller graph for this function:

◆ operator BooleanType()

ParseResult::operator BooleanType ( ) const
inline

Explicit conversion to bool, returns true, iff !IsError().

Definition at line 122 of file error.h.

References IsError().

Here is the call graph for this function:

◆ operator!=() [1/2]

bool ParseResult::operator!= ( const ParseResult & that) const
inline

Definition at line 130 of file error.h.

◆ operator!=() [2/2]

bool ParseResult::operator!= ( ParseErrorCode code) const
inline

Definition at line 131 of file error.h.

◆ operator==() [1/2]

bool ParseResult::operator== ( const ParseResult & that) const
inline

Definition at line 126 of file error.h.

◆ operator==() [2/2]

bool ParseResult::operator== ( ParseErrorCode code) const
inline

Definition at line 127 of file error.h.

◆ Set()

void ParseResult::Set ( ParseErrorCode code,
size_t offset = 0 )
inline

Update error code and offset.

Definition at line 137 of file error.h.

Referenced by Clear().

Here is the caller graph for this function:

◆ operator!=

bool operator!= ( ParseErrorCode code,
const ParseResult & err )
friend

Definition at line 132 of file error.h.

◆ operator==

bool operator== ( ParseErrorCode code,
const ParseResult & err )
friend

Definition at line 128 of file error.h.

Member Data Documentation

◆ code_

ParseErrorCode ParseResult::code_
private

Definition at line 140 of file error.h.

◆ offset_

size_t ParseResult::offset_
private

Definition at line 141 of file error.h.


The documentation for this struct was generated from the following file: