SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Specifies the character encoding scheme to use for default conversions from UTF-16 strings into another encoding. More...
#include <rw/i18n/RWUFromUnicodeConversionContext.h>
Public Member Functions | |
RWUFromUnicodeConversionContext (const char *encoding=RWUConverterBase::getDefaultEncodingName()) | |
~RWUFromUnicodeConversionContext () | |
RWUFromUnicodeConverter & | getConverter () |
Static Public Member Functions | |
static RWUFromUnicodeConversionContext & | getContext () |
Friends | |
class | RWTOnlyPointer< RWUFromUnicodeConversionContext > |
RWUFromUnicodeConversionContext specifies the character encoding scheme to use for subsequent implicit conversions from UTF-16 encoded Unicode strings into another encoding.
RWUFromUnicodeConversionContext uses the resource acquisition is initialization idiom to manage internal, per-thread stacks of RWUFromUnicodeConversionContext instances, each containing an RWUFromUnicodeConverter object. The RWUFromUnicodeConversionContext constructor pushes a reference to the new instance onto the context stack. The RWUFromUnicodeConversionContext destructor pops the instance off the context stack. The top-level element of each thread's stack defines the conversion required to translate implicitly a UTF-16 encoded Unicode string into another encoding.
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:
RWUFromUnicodeConversionContext::RWUFromUnicodeConversionContext | ( | const char * | encoding = RWUConverterBase::getDefaultEncodingName() | ) |
Constructs an RWUFromUnicodeConversionContext for the specified encoding. The from-Unicode conversion context specifies the converter to use when implicitly converting a sequence of UTF-16 code units into a sequence of bytes encoded according to the specified encoding.
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 RWUFromUnicodeConversionContext.
main()
may produce unpredictable or erroneous behavior. Do not use conversion contexts during the destruction of static-duration objects.
|
inline |
Returns a reference to the internal RWUFromUnicodeConverter instance used in converting UTF-16 encoded strings to another encoding.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |