bes  Updated for version 3.20.6
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode) More...

#include <error.h>

Collaboration diagram for ParseResult:
Collaboration graph

Public Member Functions

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

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);
}
See also
GenericReader::Parse, GenericDocument::Parse

Definition at line 106 of file cmr_module/rapidjson/error/error.h.

Constructor & Destructor Documentation

◆ ParseResult() [1/4]

ParseResult::ParseResult ( )
inline

Default constructor, no error.

Definition at line 109 of file cmr_module/rapidjson/error/error.h.

◆ ParseResult() [2/4]

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

Constructor to set an error.

Definition at line 111 of file cmr_module/rapidjson/error/error.h.

◆ ParseResult() [3/4]

ParseResult::ParseResult ( )
inline

Default constructor, no error.

Definition at line 109 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ ParseResult() [4/4]

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

Constructor to set an error.

Definition at line 111 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

Member Function Documentation

◆ Clear() [1/2]

void ParseResult::Clear ( )
inline

Reset error code.

Definition at line 128 of file cmr_module/rapidjson/error/error.h.

◆ Clear() [2/2]

void ParseResult::Clear ( )
inline

Reset error code.

Definition at line 128 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ Code() [1/2]

ParseErrorCode ParseResult::Code ( ) const
inline

Get the error code.

Definition at line 114 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ Code() [2/2]

ParseErrorCode ParseResult::Code ( ) const
inline

Get the error code.

Definition at line 114 of file cmr_module/rapidjson/error/error.h.

◆ IsError() [1/2]

bool ParseResult::IsError ( ) const
inline

Whether the result is an error.

Definition at line 121 of file cmr_module/rapidjson/error/error.h.

◆ IsError() [2/2]

bool ParseResult::IsError ( ) const
inline

Whether the result is an error.

Definition at line 121 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ Offset() [1/2]

size_t ParseResult::Offset ( ) const
inline

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

Definition at line 116 of file cmr_module/rapidjson/error/error.h.

◆ Offset() [2/2]

size_t ParseResult::Offset ( ) const
inline

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

Definition at line 116 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ operator bool() [1/2]

ParseResult::operator bool ( ) const
inline

Conversion to bool, returns true, iff !IsError().

Definition at line 119 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.

◆ operator bool() [2/2]

ParseResult::operator bool ( ) const
inline

Conversion to bool, returns true, iff !IsError().

Definition at line 119 of file cmr_module/rapidjson/error/error.h.

◆ Set() [1/2]

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

Update error code and offset.

Definition at line 130 of file cmr_module/rapidjson/error/error.h.

◆ Set() [2/2]

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

Update error code and offset.

Definition at line 130 of file dmrpp_module/xml2json/include/rapidjson/error/error.h.


The documentation for this struct was generated from the following file:
ParseResult::Offset
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.
Definition: cmr_module/rapidjson/error/error.h:116
GenericDocument
A document for parsing JSON text as DOM.
Definition: cmr_module/rapidjson/document.h:62
GenericDocument::Parse
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: cmr_module/rapidjson/document.h:2221
ParseResult::Code
ParseErrorCode Code() const
Get the error code.
Definition: cmr_module/rapidjson/error/error.h:114
GetParseError_En
const RAPIDJSON_NAMESPACE_BEGIN RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition: cmr_module/rapidjson/error/en.h:36
ParseResult
Result of parsing (wraps ParseErrorCode)
Definition: cmr_module/rapidjson/error/error.h:106