SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members

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

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

Public Member Functions

 IConvBase (StringParam tocode, StringParam fromcode)
 This function allocates a context for the specified character set conversion.
 
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.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- 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.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
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.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ IConvBase()

SDL::IConvBase::IConvBase ( StringParam  tocode,
StringParam  fromcode 
)
inline
Parameters
tocodeThe target character encoding, must not be nullptr.
fromcodeThe source character encoding, must not be nullptr.
Postcondition
this becomes a valid handle convertible to true on success, or convertible to false on failure.
Since
This function is available since SDL 3.2.0.
See also
IConvBase.iconv
iconv_string

Member Function Documentation

◆ iconv()

size_t SDL::IConvBase::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
IConvBase.IConvBase
iconv_string

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