Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode) More...

#include <error.h>

Public Types

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

Public Member Functions

 ParseResult ()
 Default constructor, no error. More...
 
 ParseResult (ParseErrorCode code, size_t offset)
 Constructor to set an error. More...
 
ParseErrorCode Code () const
 Get the error code. More...
 
size_t Offset () const
 Get the error offset, if IsError(), 0 otherwise. More...
 
 operator BooleanType () const
 Explicit conversion to bool, returns true, iff !IsError(). More...
 
bool IsError () const
 Whether the result is an error. More...
 
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. 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

Member Typedef Documentation

◆ BooleanType

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

! Unspecified boolean type

Constructor & Destructor Documentation

◆ ParseResult() [1/2]

ParseResult::ParseResult ( )
inline

Default constructor, no error.

◆ ParseResult() [2/2]

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

Constructor to set an error.

Member Function Documentation

◆ Clear()

void ParseResult::Clear ( )
inline

Reset error code.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Code()

ParseErrorCode ParseResult::Code ( ) const
inline

Get the error code.

+ Here is the caller graph for this function:

◆ IsError()

bool ParseResult::IsError ( ) const
inline

Whether the result is an error.

+ Here is the caller graph for this function:

◆ Offset()

size_t ParseResult::Offset ( ) const
inline

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

+ Here is the caller graph for this function:

◆ operator BooleanType()

ParseResult::operator BooleanType ( ) const
inline

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

+ Here is the call graph for this function:

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

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

◆ operator==() [1/2]

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

◆ operator==() [2/2]

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

◆ Set()

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

Update error code and offset.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

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

◆ operator==

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

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