SDL3pp
A slim C++ wrapper for SDL3
All Classes Namespaces Functions Variables Typedefs Modules Pages Concepts
Public Member Functions | Static Public 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 from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< T > > auto &resource)
 Constructs from pointer like.
 
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 from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< SDL_iconv_data_t * > > auto &resource)
 Constructs from pointer like.
 
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 operator value_type () const
 Converts back to underlying type.
 
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 const SDL_iconv_data_t * operator-> () const
 Access to fields.
 
constexpr SDL_iconv_data_t * operator-> ()
 Access to fields.
 

Static Public Member Functions

static void reset (SDL_iconv_data_t *resource)
 This function frees a context used for character set conversion.
 

Additional Inherited Members

- Public Types inherited from SDL::Resource< SDL_iconv_data_t * >
using value_type = SDL_iconv_data_t *
 The raw resource type.
 

Detailed Description

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

Member Function Documentation

◆ 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()

static void SDL::IConvRef::reset ( SDL_iconv_data_t *  resource)
inlinestatic
Parameters
resourceThe character set conversion handle.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
IConvRef.iconv
IConv.open
iconv_string

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