SimulationCraft
SimulationCraft is a tool to explore combat mechanics in the popular MMO RPG World of Warcraft (tm).
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode) More...

#include <error.h>

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.
 

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