glibmm 2.80.0
Public Types | Public Member Functions | List of all members
Glib::ConvertError Class Reference

Exception class for charset conversion errors. More...

#include <glibmm/convert.h>

Inheritance diagram for Glib::ConvertError:
Inheritance graph
[legend]

Public Types

enum  Code {
  NO_CONVERSION ,
  ILLEGAL_SEQUENCE ,
  FAILED ,
  PARTIAL_INPUT ,
  BAD_URI ,
  NOT_ABSOLUTE_PATH ,
  NO_MEMORY ,
  EMBEDDED_NUL
}
 Error codes returned by character set conversion routines. More...
 

Public Member Functions

 ConvertError (Code error_code, const Glib::ustring &error_message)
 
 ConvertError (GError *gobject)
 
Code code () const
 
- Public Member Functions inherited from Glib::Error
 Error ()
 
 Error (GQuark error_domain, int error_code, const Glib::ustring & message)
 
 Error (GError *gobject, bool take_copy=false)
 
 Error (const Error &other)
 
Erroroperator= (const Error &other)
 
 ~Error () noexcept override
 
 operator bool () const
 Test whether the Error has an underlying instance.
 
GQuark domain () const
 
int code () const
 
const charwhat () const noexcept override
 
bool matches (GQuark error_domain, int error_code) const
 
GErrorgobj ()
 
const GErrorgobj () const
 

Additional Inherited Members

- Protected Attributes inherited from Glib::Error
GErrorgobject_
 

Detailed Description

Exception class for charset conversion errors.

Glib::convert() and friends throw a ConvertError exception if the charset conversion failed for some reason. When writing non-trivial applications you should always catch those errors, and then try to recover, or tell the user the input was invalid.

Member Enumeration Documentation

◆ Code

Error codes returned by character set conversion routines.

Enumerator
NO_CONVERSION 

Conversion between the requested character sets is not supported.

ILLEGAL_SEQUENCE 

Invalid byte sequence in conversion input; or the character sequence could not be represented in the target character set.

FAILED 

Conversion failed for some reason.

PARTIAL_INPUT 

Partial character sequence at end of input.

BAD_URI 

URI is invalid.

NOT_ABSOLUTE_PATH 

Pathname is not an absolute path.

NO_MEMORY 

No memory available.

Since glibmm 2.40:
EMBEDDED_NUL 

An embedded NUL character is present in conversion output where a NUL-terminated string is expected.

Since glibmm 2.56:

Constructor & Destructor Documentation

◆ ConvertError() [1/2]

Glib::ConvertError::ConvertError ( Code  error_code,
const Glib::ustring error_message 
)

◆ ConvertError() [2/2]

Glib::ConvertError::ConvertError ( GError gobject)
explicit

Member Function Documentation

◆ code()

Code Glib::ConvertError::code ( ) const