VR-Vantage 2.8 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes | Friends
ParseResult Struct Reference

Result of parsing (wraps ParseErrorCode) More...

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.

Private Attributes

ParseErrorCode code_
size_t 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);
}
See Also
GenericReader::Parse, GenericDocument::Parse

Constructor & Destructor Documentation

ParseResult::ParseResult ( )
inline

Default constructor, no error.

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

Constructor to set an error.

Member Function Documentation

ParseErrorCode ParseResult::Code ( ) const
inline
size_t ParseResult::Offset ( ) const
inline

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

References offset_.

Referenced by GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetErrorOffset().

ParseResult::operator bool ( ) const
inline

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

References IsError().

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

References code_.

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

References code_.

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

Update error code and offset.

References code_, and offset_.

Referenced by Clear(), and GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::SetParseError().

Friends And Related Function Documentation

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

Member Data Documentation

ParseErrorCode ParseResult::code_
private

Referenced by Code(), IsError(), operator==(), and Set().

size_t ParseResult::offset_
private

Referenced by Offset(), and Set().


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


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)