GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Friends | List of all members
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode) More...

#include <error.h>

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 bool () const
 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
 
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)
 

Detailed Description

Result of parsing (wraps ParseErrorCode)

ParseResult ok = doc.Parse("[42]");
if (!ok) {
fprintf(stderr, "JSON parse error: %s (%u)",
exit(EXIT_FAILURE);
}
A document for parsing JSON text as DOM.
Definition: document.h:2024
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2221
RAPIDJSON_NAMESPACE_BEGIN const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En(ParseErrorCode parseErrorCode)
Maps error code of parsing into error message.
Definition: en.h:36
Result of parsing (wraps ParseErrorCode)
Definition: error.h:106
ParseErrorCode Code() const
Get the error code.
Definition: error.h:114
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.
Definition: error.h:116
See also
GenericReader::Parse, GenericDocument::Parse

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