Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internationalization Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWUFromUnicodeConverter

Module:  Internationalization Module   Group:  Character Encoding Scheme Conversion


RWUFromUnicodeConverter RWUConverterBase

Local Index

Members

Header File

#include <rw/i18n/RWUFromUnicodeConverter.h> 

Description

RWUFromUnicodeConverter provides a unidirectional text conversion facility for translating from UTF-16 to various byte-oriented standard character encoding schemes.

The convert() method appends the results of a conversion to a target buffer. If its flush argument is true, convert() flushes its internal buffers to the target buffer and clears its internal state. For modal encodings such as ISO-2022, clearing the internal state ensures that the next call to convert() produces target text that begins in the target encoding's default, unshifted state.

Calling convert() once with a value of true for flush is useful when converting a piece of text in its entirety from UTF-16 to a target encoding. In contrast, convert() may be used to fill a target buffer in a piecemeal fashion. Repeatedly calling convert() with a value of false for flush, then calling it once with a value of true, causes convert() to flush its buffers and clear its internal state only at the end of a multi-invocation conversion process.

At the conclusion of a successful call to convert() with flush set to true, the converter is reset automatically to a default, initial state, ready to start a new conversion process. Sometimes, however, it may be necessary to reset a converter explicitly using the reset() method:

Example

Related Classes

RWUConverterBase, RWUFromUnicodeConversionContext, RWUToUnicodeConverter

Public Enums

enum ErrorResponseType { Stop,
                         Skip,
                         Substitute, 
                         EscapeNativeHexadecimal, 
                         EscapeJavaHexadecimal, 
                         EscapeCHexadecimal,
                         EscapeXmlDecimal,
                         EscapeXmlHexadecimal
};

Public Constructors

RWUFromUnicodeConverter(const char* encoding);
RWUFromUnicodeConverter(const RWUConverterBase& original);

Public Destructor

~RWUFromUnicodeConverter();

Public Member Operators

RWUFromUnicodeConverter&
operator=(const RWUConverterBase& rhs);

Public Member Functions

void
convert(const RWUString& source, RWCString& target,
        bool flush = true);
void
convert(const RWUString& source, RW_SL_STD(string)& target, 
        bool flush = true);
void
convert(const RWUChar16* source, RWCString& target,
        bool flush = true);
void
convert(const RWUChar16* source, RW_SL_STD(string)& target,
        bool flush = true);
void 
convert(const RWUChar16 source[], int32_t size,
        RWCString& target, bool flush = true);
void 
convert(const RWUChar16 source[], int32_t size,
        RW_SL_STD(string)& target, bool flush = true);
RWCString
getSubstitutionSequence() const;
void
reset();
void
restoreErrorResponseState(const ErrorResponseState& state);

NOTE -- The saved state from one converter may be used to set the state on another converter. However, this operation may not be safe in future versions of the Internationalization Module.
ErrorResponseState
saveErrorResponseState() const;

NOTE -- The saved state from one converter may be used to set the state on another converter. However, this operation may not be safe in future versions of the Internationalization Module.
void
setErrorResponse(ErrorResponseType response);
void
setSubstitutionSequence(const char substitutionSequence[], 
                        size_t length);

Class ErrorResponseState

RWUFromUnicodeConverter::ErrorResponseState stores the current error response state of a converter so that it can be used to restore that state at a later time. See saveErrorResponseState() and restoreErrorResponseState().

Public Constructors

ErrorResponseState(const ErrorResponseState& state);

Public Member Operators

ErrorResponseState&
operator=(const ErrorResponseState& state);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.