Base Framework
Public Types | Public Member Functions | List of all members
MultibyteException Class Reference

Multibyte character conversion exception. More...

#include <base/string/MultibyteException.h>

Inherits Exception.

Public Types

enum  Cause { INVALID_CHARACTER_CODE, INCOMPLETE_CHARACTER_CODE }
 
- Public Types inherited from Exception
enum  DumpOnThrow { DUMP_ON_THROW_NO = 0, DUMP_ON_THROW_EXCEPTION, DUMP_ON_THROW_STACK }
 
typedef void(* ExceptionHandler) (const Exception *exception)
 

Public Member Functions

 MultibyteException () noexcept
 
 MultibyteException (const char *message) noexcept
 
 MultibyteException (const Type &type) noexcept
 
 MultibyteException (const char *message, const Type &type) noexcept
 
 MultibyteException (const char *message, const Type &type, unsigned int cause, MemoryDiff octetIndex, MemoryDiff suboctetIndex) noexcept
 
MemoryDiff getIndex () const noexcept
 
void setIndex (MemoryDiff index) noexcept
 
MemoryDiff getOctetIndex () const noexcept
 
void setOctetIndex (MemoryDiff _octetIndex) noexcept
 
MemoryDiff getSuboctetIndex () const noexcept
 
void setSuboctetIndex (uint8 _suboctetIndex) noexcept
 
- Public Member Functions inherited from Exception
 Exception () noexcept
 
 Exception (const char *message) noexcept
 
 Exception (const Type &type) noexcept
 
 Exception (const char *message, const Type &type) noexcept
 
 Exception (const Exception &copy) noexcept
 
 Exception (Exception &&move) noexcept
 
unsigned int getCause () const noexcept
 
void setCause (unsigned int cause) noexcept
 
unsigned int getError () const noexcept
 
void setError (unsigned int error) noexcept
 
const char * getMessage () const noexcept
 
void setMessage (const char *message) noexcept
 
template<decltype(sizeof(void *)) SIZE>
void setMessage (const char(&_message)[SIZE]) noexcept
 
virtual Type getThisType () const noexcept
 
const TypegetType () const noexcept
 
void setType (const Type &type) noexcept
 
virtual bool isCommonException () const noexcept
 
OwnedNativeString getHTML () const
 
virtual ~Exception () noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from Exception
static void onThrow (const Exception &exception) noexcept
 
static void rethrow ()
 
static bool getDumpExceptions () noexcept
 
static void setDumpExceptions (bool _dumpExceptions) noexcept
 
static ExceptionHandler setExceptionHandler (ExceptionHandler _exceptionHandler) noexcept
 
static bool hasPendingException () noexcept
 
static bool isUnwinding () noexcept
 
static unsigned int getPendingExceptions () noexcept
 
static const char * getStdExceptionName (const std::exception &e) noexcept
 
static Type getExceptionType () noexcept
 
static StackTrace getStackTrace ()
 
static void setDumpOnThrow (DumpOnThrow dumpOnThrow) noexcept
 
- Static Public Attributes inherited from Exception
static constexpr bool SUPPORTS_EXCEPTIONS = true
 

Detailed Description

Multibyte character conversion exception.

This exception is raised on convertion errors from or to multibyte characters. A negative index indicates an invalid index.

Version
1.0

Member Enumeration Documentation

◆ Cause

Enumerator
INVALID_CHARACTER_CODE 

Invalid character code.

INCOMPLETE_CHARACTER_CODE 

Incomplete character code.

Constructor & Destructor Documentation

◆ MultibyteException() [1/4]

MultibyteException::MultibyteException ( )
noexcept

Initializes the exception object with no message.

◆ MultibyteException() [2/4]

MultibyteException::MultibyteException ( const char *  message)
noexcept

Initializes the exception object.

Parameters
messageThe message.

◆ MultibyteException() [3/4]

MultibyteException::MultibyteException ( const Type type)
noexcept

Initializes the exception object without an associated message.

Parameters
typeThe identity of the type.

◆ MultibyteException() [4/4]

MultibyteException::MultibyteException ( const char *  message,
const Type type 
)
noexcept

Initializes the exception object.

Parameters
messageAn NULL-terminated string (ASCII).
typeThe identity of the type.

Member Function Documentation

◆ getIndex()

MemoryDiff MultibyteException::getIndex ( ) const
inlinenoexcept

Returns the index of the first invalid character.

◆ getOctetIndex()

MemoryDiff MultibyteException::getOctetIndex ( ) const
inlinenoexcept

Returns the octet index.

◆ getSuboctetIndex()

MemoryDiff MultibyteException::getSuboctetIndex ( ) const
inlinenoexcept

Returns the index of the first invalid octet within the first invalid character.

◆ setIndex()

void MultibyteException::setIndex ( MemoryDiff  index)
inlinenoexcept

Sets the index of the first invalid character.

◆ setOctetIndex()

void MultibyteException::setOctetIndex ( MemoryDiff  _octetIndex)
inlinenoexcept

Sets the index of the first invalid octet.

◆ setSuboctetIndex()

void MultibyteException::setSuboctetIndex ( uint8  _suboctetIndex)
inlinenoexcept

Sets the index of the first invalid octet within the first invalid character.