Public Types | Public Member Functions | Private Attributes | Friends | List of all members
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

void Clear ()
 Reset error code. More...
 
ParseErrorCode Code () const
 Get the error code. More...
 
bool IsError () const
 Whether the result is an error. 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 operator!= (const ParseResult &that) const
 
bool operator!= (ParseErrorCode code) const
 
bool operator== (const ParseResult &that) const
 
bool operator== (ParseErrorCode code) const
 
 ParseResult ()
 Default constructor, no 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...
 

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

Definition at line 120 of file error.h.

Member Typedef Documentation

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

! Unspecified boolean type

Definition at line 122 of file error.h.

Constructor & Destructor Documentation

ParseResult::ParseResult ( )
inline

Default constructor, no error.

Definition at line 126 of file error.h.

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

Constructor to set an error.

Definition at line 128 of file error.h.

Member Function Documentation

void ParseResult::Clear ( )
inline

Reset error code.

Definition at line 156 of file error.h.

ParseErrorCode ParseResult::Code ( ) const
inline

Get the error code.

Definition at line 132 of file error.h.

bool ParseResult::IsError ( ) const
inline

Whether the result is an error.

Definition at line 141 of file error.h.

size_t ParseResult::Offset ( ) const
inline

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

Definition at line 134 of file error.h.

ParseResult::operator BooleanType ( ) const
inline

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

Definition at line 137 of file error.h.

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

Definition at line 149 of file error.h.

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

Definition at line 150 of file error.h.

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

Definition at line 143 of file error.h.

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

Definition at line 144 of file error.h.

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

Update error code and offset.

Definition at line 158 of file error.h.

Friends And Related Function Documentation

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

Definition at line 151 of file error.h.

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

Definition at line 145 of file error.h.

Member Data Documentation

ParseErrorCode ParseResult::code_
private

Definition at line 164 of file error.h.

size_t ParseResult::offset_
private

Definition at line 165 of file error.h.


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


livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46