SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Specifies the default character encoding scheme to use for subsequent implicit conversions from narrow character strings to UTF-16 encoded Unicode strings. More...
#include <rw/i18n/RWUToUnicodeConversionContext.h>
Public Member Functions | |
RWUToUnicodeConversionContext (const char *encoding=RWUConverterBase::getDefaultEncodingName()) | |
~RWUToUnicodeConversionContext () | |
RWUToUnicodeConverter & | getConverter () |
Static Public Member Functions | |
static RWUToUnicodeConversionContext & | getContext () |
Friends | |
class | RWTOnlyPointer< RWUToUnicodeConversionContext > |
RWUToUnicodeConversionContext specifies the default character encoding scheme to use for subsequent implicit conversions from narrow character strings to UTF-16 encoded Unicode strings.
RWUToUnicodeConversionContext uses the resource acquisition is initialization idiom to manage an internal, per-thread stack of RWUToUnicodeConversionContext instances, each containing an RWUToUnicodeConverter object.
The top-level element of the stack defines the conversion required to translate implicitly a narrow character string into an equivalent UTF-16 encoded Unicode string.
Each RWUToUnicodeConversionContext instance contains an RWUToUnicodeConverter instance used for all relevant implicit conversions.
The RWUToUnicodeConversionContext constructor pushes a reference to the new instance onto the context stack. The RWUToUnicodeConversionContext destructor pops the instance off the context stack.
Instances of this class can only be constructed with static or automatic storage duration; dynamic allocation is not allowed. Do not create unnamed, temporary instances. The destructors for such objects pop the context off the context stack prematurely.
Program output:
RWUToUnicodeConversionContext::RWUToUnicodeConversionContext | ( | const char * | encoding = RWUConverterBase::getDefaultEncodingName() | ) |
Constructs an RWUToUnicodeConversionContext for the specified encoding. The to-Unicode conversion context specifies the default implicit conversion to use when automatically converting a sequence of bytes, encoded accorded to the specified encoding, into a UTF-16 representation. The encoding name is encoded in US-ASCII and must specify one of the names or aliases recognized by the Internationalization Module (see RWUAvailableEncodingList and RWUEncodingAliasList).
The conversion context remains in effect until another conversion context is specified, or until the conversion context instance goes out of scope and is destroyed.
RWUException | Thrown to indicate that a converter could not be constructed for the specified encoding. The exception carries one of the following status codes: |
|
inline |
Destructor. Destroys self and restores the conversion context that was in effect prior to the construction of this instance.
|
static |
Returns a reference to the current RWUToUnicodeConversionContext.
|
inline |
Returns a reference to self's internal RWUToUnicodeConverter instance for use in converting strings in various encodings into UTF-16 encoded RWUString instances.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |