SDL3pp
A slim C++ wrapper for SDL3
All Classes Namespaces Functions Variables Typedefs Modules Pages Concepts
Public Member Functions | Protected Member Functions | List of all members

An opaque handle representing string encoding conversion state. More...

Inheritance diagram for SDL::IConvRef:
Inheritance graph
[legend]

Public Member Functions

size_t iconv (const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 This function converts text between encodings, reading from and writing to a buffer.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
- Public Member Functions inherited from SDL::Resource< SDL_iconv_data_t * >
constexpr Resource (SDL_iconv_data_t * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_iconv_data_t * get () const
 Return contained resource;.
 
constexpr SDL_iconv_data_t * release (SDL_iconv_data_t * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_iconv_data_t * operator-> () const
 Access to fields.
 
constexpr SDL_iconv_data_t * operator-> ()
 Access to fields.
 

Protected Member Functions

int close ()
 This function frees a context used for character set conversion.
 
int reset (SDL_iconv_data_t *newResource={})
 This function frees a context used for character set conversion.
 

Detailed Description

Since
This datatype is available since SDL 3.2.0.
Category:
Resource
See also
IConvRef.IConvRef
IConv

Member Function Documentation

◆ close()

int SDL::IConvRef::close ( )
inlineprotected
Returns
0 on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
IConvRef.iconv
IConv.IConv
iconv_string

◆ iconv()

size_t SDL::IConvRef::iconv ( const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
)
inline

It returns the number of successful conversions on success. On error, SDL_ICONV_E2BIG is returned when the output buffer is too small, or SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered, or SDL_ICONV_EINVAL is returned when an incomplete input sequence is encountered.

On exit:

  • inbuf will point to the beginning of the next multibyte sequence. On error, this is the location of the problematic input sequence. On success, this is the end of the input sequence.
  • inbytesleft will be set to the number of bytes left to convert, which will be 0 on success.
  • outbuf will point to the location where to store the next output byte.
  • outbytesleft will be set to the number of bytes left in the output buffer.
Parameters
inbufAddress of variable that points to the first character of the input sequence.
inbytesleftThe number of bytes in the input buffer.
outbufAddress of variable that points to the output buffer.
outbytesleftThe number of bytes in the output buffer.
Returns
the number of conversions on success, or a negative error code.
Since
This function is available since SDL 3.2.0.
See also
IConv.IConv
IConvRef.close
iconv_string

◆ reset()

int SDL::IConvRef::reset ( SDL_iconv_data_t *  newResource = {})
inlineprotected
Returns
0 on success, or -1 on failure.
Since
This function is available since SDL 3.2.0.
See also
IConvRef.iconv
IConv.IConv
iconv_string

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