Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

UnicodeToHexTransliterator Class Reference

A transliterator that converts from Unicode characters to hexadecimal Unicode escape sequences. More...

#include <unitohex.h>

Inheritance diagram for UnicodeToHexTransliterator::

Transliterator UObject List of all members.

Public Methods

 UnicodeToHexTransliterator (const UnicodeString &pattern, UBool isUppercase, UnicodeFilter *adoptedFilter, UErrorCode &status)
 Constructs a transliterator. More...

 UnicodeToHexTransliterator (const UnicodeString &pattern, UErrorCode &status)
 Constructs an uppercase transliterator with no filter. More...

 UnicodeToHexTransliterator (UnicodeFilter *adoptedFilter=0)
 Constructs a transliterator with the default prefix "\u" that outputs uppercase hex digits. More...

virtual ~UnicodeToHexTransliterator ()
 Destructor. More...

 UnicodeToHexTransliterator (const UnicodeToHexTransliterator &)
 Copy constructor. More...

UnicodeToHexTransliterator & operator= (const UnicodeToHexTransliterator &)
 Assignment operator. More...

virtual Transliteratorclone (void) const
 Transliterator API. More...

void applyPattern (const UnicodeString &thePattern, UErrorCode &status)
 Set the pattern recognized by this transliterator. More...

const UnicodeStringtoPattern (void) const
 Return this transliterator's pattern. More...

virtual UBool isUppercase (void) const
 Returns true if this transliterator outputs uppercase hex digits. More...

virtual void setUppercase (UBool outputUppercase)
 Sets if this transliterator outputs uppercase hex digits. More...

virtual void handleTransliterate (Replaceable &text, UTransPosition &offsets, UBool isIncremental) const
 Implements Transliterator::handleTransliterate. More...

virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class. More...


Static Public Methods

UClassID getStaticClassID ()
 ICU "poor man's RTTI", returns a UClassID for this class. More...


Private Types

enum  { ZERO = 0x0030, POUND = 0x0023, BACKSLASH = 0x005C }

Private Attributes

UnicodeString pattern
 The pattern set by applyPattern() and returned by toPattern(). More...

UnicodeString prefix
 The string preceding the hex digits, parsed from the pattern. More...

UnicodeString suffix
 The string following the hex digits, parsed from the pattern. More...

int8_t minDigits
 The minimum number of hex digits to output, between 1 and 4, inclusive. More...

UBool uppercase
 If TRUE, output uppercase hex digits; otherwise output lowercase. More...


Static Private Attributes

const UChar HEX_DIGITS [32]
const char _ID []
 ID for this transliterator. More...

const char fgClassID
 The address of this static class variable serves as this class's ID for ICU "poor man's RTTI". More...


Detailed Description

A transliterator that converts from Unicode characters to hexadecimal Unicode escape sequences.

It outputs a prefix specified in the constructor and optionally converts the hex digits to uppercase.

The format of the output is set by a pattern. This pattern follows the same syntax as HexToUnicodeTransliterator, except it does not allow multiple specifications. The pattern sets the prefix string, suffix string, and minimum and maximum digit count. There are no setters or getters for these attributes; they are set only through the pattern.

The setUppercase() and isUppercase() methods control whether 'a' through 'f' or 'A' through 'F' are output as hex digits. This is not controlled through the pattern; only through the methods. The default is uppercase.

Author:
Alan Liu
Deprecated:
To be removed after 2002-sep-30.

Definition at line 40 of file unitohex.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
ZERO 
POUND 
BACKSLASH 

Definition at line 45 of file unitohex.h.


Constructor & Destructor Documentation

UnicodeToHexTransliterator::UnicodeToHexTransliterator const UnicodeString   pattern,
UBool    isUppercase,
UnicodeFilter   adoptedFilter,
UErrorCode   status
 

Constructs a transliterator.

Parameters:
pattern  The pattern for this transliterator. See applyPattern() for pattern syntax.
isUppercase  if true, the four hex digits will be converted to uppercase; otherwise they will be lowercase.
adoptedFilter  the filter for this transliterator, or NULL if none. Adopted by this transliterator.
status  Error code indicating success or failure to parse pattern.
Deprecated:
To be removed after 2002-sep-30; use Transliterator::createInstance factory method.

UnicodeToHexTransliterator::UnicodeToHexTransliterator const UnicodeString   pattern,
UErrorCode   status
 

Constructs an uppercase transliterator with no filter.

Parameters:
pattern  The pattern for this transliterator. See applyPattern() for pattern syntax.
status  Error code indicating success or failure to parse pattern.
Deprecated:
To be removed after 2002-sep-30; use Transliterator::createInstance factory method.

UnicodeToHexTransliterator::UnicodeToHexTransliterator UnicodeFilter   adoptedFilter = 0
 

Constructs a transliterator with the default prefix "\u" that outputs uppercase hex digits.

Deprecated:
To be removed after 2002-sep-30; use Transliterator::createInstance factory method.

UnicodeToHexTransliterator::~UnicodeToHexTransliterator   [inline, virtual]
 

Destructor.

Deprecated:
To be removed after 2002-sep-30.

Definition at line 221 of file unitohex.h.

UnicodeToHexTransliterator::UnicodeToHexTransliterator const UnicodeToHexTransliterator &   
 

Copy constructor.

Deprecated:
To be removed after 2002-sep-30; use Transliterator::createInstance factory method.


Member Function Documentation

void UnicodeToHexTransliterator::applyPattern const UnicodeString   thePattern,
UErrorCode   status
 

Set the pattern recognized by this transliterator.

The pattern must contain zero or more prefix characters, one or more digit characters, and zero or more suffix characters. The digit characters indicates optional digits ('#') followed by required digits ('0'). The total number of digits cannot exceed 4, and must be at least 1 required digit. Use a backslash ('\') to escape any of the special characters. An empty pattern is not allowed.

Example: "U+0000" specifies a prefix of "U+", exactly four digits, and no suffix. "<###0>" has a prefix of "<", between one and four digits, and a suffix of ">".

 pattern := prefix-char* digit-spec suffix-char*
 digit-spec := '#'* '0'+
 prefix-char := [^special-char] | '\' special-char
 suffix-char := [^special-char] | '\' special-char
 special-char := ';' | '0' | '#' | '\'
 

Limitations: There is no way to set the uppercase attribute in the pattern. (applyPattern() does not alter the uppercase attribute.)

Deprecated:
To be removed after 2002-sep-30.

virtual Transliterator* UnicodeToHexTransliterator::clone void    const [virtual]
 

Transliterator API.

Deprecated:
To be removed after 2002-sep-30.

Reimplemented from Transliterator.

virtual UClassID UnicodeToHexTransliterator::getDynamicClassID void    const [inline, virtual]
 

ICU "poor man's RTTI", returns a UClassID for the actual class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from Transliterator.

Definition at line 211 of file unitohex.h.

UClassID UnicodeToHexTransliterator::getStaticClassID void    [inline, static]
 

ICU "poor man's RTTI", returns a UClassID for this class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from Transliterator.

Definition at line 218 of file unitohex.h.

virtual void UnicodeToHexTransliterator::handleTransliterate Replaceable   text,
UTransPosition   offsets,
UBool    isIncremental
const [virtual]
 

Implements Transliterator::handleTransliterate.

Deprecated:
To be removed after 2002-sep-30.

Reimplemented from Transliterator.

virtual UBool UnicodeToHexTransliterator::isUppercase void    const [virtual]
 

Returns true if this transliterator outputs uppercase hex digits.

Deprecated:
To be removed after 2002-sep-30.

UnicodeToHexTransliterator& UnicodeToHexTransliterator::operator= const UnicodeToHexTransliterator &   
 

Assignment operator.

Stable:

virtual void UnicodeToHexTransliterator::setUppercase UBool    outputUppercase [virtual]
 

Sets if this transliterator outputs uppercase hex digits.

Deprecated:
To be removed after 2002-sep-30.

const UnicodeString& UnicodeToHexTransliterator::toPattern void    const
 

Return this transliterator's pattern.

Deprecated:
To be removed after 2002-sep-30.


Member Data Documentation

const UChar UnicodeToHexTransliterator::HEX_DIGITS[32] [static, private]
 

Definition at line 51 of file unitohex.h.

const char UnicodeToHexTransliterator::_ID[] [static, private]
 

ID for this transliterator.

Definition at line 56 of file unitohex.h.

const char UnicodeToHexTransliterator::fgClassID [static, private]
 

The address of this static class variable serves as this class's ID for ICU "poor man's RTTI".

Reimplemented from Transliterator.

Definition at line 89 of file unitohex.h.

int8_t UnicodeToHexTransliterator::minDigits [private]
 

The minimum number of hex digits to output, between 1 and 4, inclusive.

Parsed from the pattern.

Definition at line 77 of file unitohex.h.

UnicodeString UnicodeToHexTransliterator::pattern [private]
 

The pattern set by applyPattern() and returned by toPattern().

Definition at line 61 of file unitohex.h.

UnicodeString UnicodeToHexTransliterator::prefix [private]
 

The string preceding the hex digits, parsed from the pattern.

Definition at line 66 of file unitohex.h.

UnicodeString UnicodeToHexTransliterator::suffix [private]
 

The string following the hex digits, parsed from the pattern.

Definition at line 71 of file unitohex.h.

UBool UnicodeToHexTransliterator::uppercase [private]
 

If TRUE, output uppercase hex digits; otherwise output lowercase.

Set by setUppercase() and returned by isUppercase().

Definition at line 83 of file unitohex.h.


The documentation for this class was generated from the following file:
Generated on Thu Aug 15 14:14:19 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001