nlib
nn::nlib::exi::ExiErrorStatus Class Referencefinal

Sets and stores the error status of the XML parser. More...

#include "nn/nlib/exi/ExiErrorStatus.h"

Public Types

enum  ErrorValue {
  OK = 0,
  OUT_OF_MEMORY,
  ARGUMENT_ERROR,
  IO_ERROR,
  UNEXPECTED_EOS,
  STREAM_DETACHED,
  ILLEGAL_CHARACTER,
  INTERNAL_ERROR,
  NOT_SUPPORTED,
  DUPLICATE_ATTRIBUTE,
  RESERVED_PREFIX,
  UNDECLARING_PREFIX,
  ATTRIBUTE_DEFAULT_NS,
  ILLEGAL_COMMENT,
  ILLEGAL_PI,
  ILLEGAL_BINARY,
  ILLEGAL_BINARY_IDX,
  ILLEGAL_BINARY_EVT,
  SYNTAX_ERROR,
  ILLEGAL_BINARY_HDR,
  FUNC_NOT_AVAILABLE
}
 Enumerates error statuses. More...
 

Public Member Functions

 ExiErrorStatus () noexcept
 Instantiates the object.
 
ErrorValue GetError () const noexcept
 Gets a value that indicates the error status. More...
 
int GetLineNo () const noexcept
 Returns the line number of the code that generated the error.
 
const char * GetFileName () const noexcept
 Returns the filename of the code that generated the error. More...
 
bool SetError (ErrorValue e, int line, const char *filename) noexcept
 Sets an error. More...
 
void Reset () noexcept
 Resets the error status. This is not used under normal circumstances.
 
 operator bool () const
 Returns true if an error has not occurred.
 

Detailed Description

Sets and stores the error status of the XML parser.

Definition at line 30 of file ExiErrorStatus.h.

Member Enumeration Documentation

◆ ErrorValue

Enumerates error statuses.

Description
Reference information about which error has occurred. Any value other than OK indicates that reading or writing failed.
Enumerator
OK 

No error.

OUT_OF_MEMORY 

Failed to allocate memory.

ARGUMENT_ERROR 

Invalid argument.

IO_ERROR 

I/O error occurred.

UNEXPECTED_EOS 

Unexpected EOS was detected.

STREAM_DETACHED 

Stream was detached (closed).

ILLEGAL_CHARACTER 

Attempted to read or write an invalid character.

INTERNAL_ERROR 

Internal error.

NOT_SUPPORTED 

Unsupported feature or format.

DUPLICATE_ATTRIBUTE 

Duplicate attribute.

RESERVED_PREFIX 

Attempted to define a reserved prefix (xml or xmlns).

UNDECLARING_PREFIX 

Attempted to delete (undeclare) a prefix.

ATTRIBUTE_DEFAULT_NS 

Cannot turn an attribute namespace into the default namespace.

ILLEGAL_COMMENT 

Invalid comment.

ILLEGAL_PI 

Invalid PI.

ILLEGAL_BINARY 

Binary data may be invalid.

ILLEGAL_BINARY_IDX 

Binary data may be invalid. Index exceeds the expected range.

ILLEGAL_BINARY_EVT 

Binary data may be invalid. Specified event was either invalid or could not be found.

SYNTAX_ERROR 

Syntax error.

ILLEGAL_BINARY_HDR 

Binary data may be invalid. An error occurred while parsing the EXI header. Either the data is invalid, or an option was specified that is not supported by the exi library.

FUNC_NOT_AVAILABLE 

An API call was attempted in a state in which calls cannot be made. An API was called before such calls were allowed. (For example, a function that opens tags may have been called before writing an XML declaration.)

Definition at line 32 of file ExiErrorStatus.h.

Member Function Documentation

◆ GetError()

nn::nlib::exi::ExiErrorStatus::GetError ( ) const
inlinenoexcept

Gets a value that indicates the error status.

Returns
An ErrorValue type value.

Definition at line 58 of file ExiErrorStatus.h.

◆ GetFileName()

nn::nlib::exi::ExiErrorStatus::GetFileName ( ) const
inlinenoexcept

Returns the filename of the code that generated the error.

Returns
Filename of the source code.

Definition at line 60 of file ExiErrorStatus.h.

◆ SetError()

nn::nlib::exi::ExiErrorStatus::SetError ( ErrorValue  e,
int  line,
const char *  filename 
)
noexcept

Sets an error.

Parameters
[in]eAn error value.
[in]lineSpecifies the line number.
[in]filenameSpecifies the filename.
Returns
Returns true if the specified error status was set.
Description
Normally, this is called by using the NEXI_SET_ERROR macro within the internals of the XML parser. It returns false if an error status was already in effect, in which case it does not set the specified error.

The documentation for this class was generated from the following files: