]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unesctrn.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2001-2007, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * Date Name Description
9 * 11/20/2001 aliu Creation.
10 **********************************************************************
15 #include "unicode/utypes.h"
17 #if !UCONFIG_NO_TRANSLITERATION
19 #include "unicode/translit.h"
24 * A transliterator that converts Unicode escape forms to the
25 * characters they represent. Escape forms have a prefix, a suffix, a
26 * radix, and minimum and maximum digit counts.
28 * <p>This class is package private. It registers several standard
29 * variants with the system which are then accessed via their IDs.
33 class UnescapeTransliterator
: public Transliterator
{
38 * The encoded pattern specification. The pattern consists of
39 * zero or more forms. Each form consists of a prefix, suffix,
40 * radix, minimum digit count, and maximum digit count. These
41 * values are stored as a five character header. That is, their
42 * numeric values are cast to 16-bit characters and stored in the
43 * string. Following these five characters, the prefix
44 * characters, then suffix characters are stored. Each form thus
45 * takes n+5 characters, where n is the total length of the prefix
46 * and suffix. The end is marked by a header of length one
47 * consisting of the character END.
49 UChar
* spec
; // owned; may not be NULL
54 * Registers standard variants with the system. Called by
55 * Transliterator during initialization.
57 static void registerIDs();
60 * Constructor. Takes the encoded spec array (does not adopt it).
61 * @param ID the string identifier for this transliterator
62 * @param spec the encoded spec array
64 UnescapeTransliterator(const UnicodeString
& ID
,
70 UnescapeTransliterator(const UnescapeTransliterator
&);
75 virtual ~UnescapeTransliterator();
80 virtual Transliterator
* clone() const;
83 * ICU "poor man's RTTI", returns a UClassID for the actual class.
85 virtual UClassID
getDynamicClassID() const;
88 * ICU "poor man's RTTI", returns a UClassID for this class.
90 U_I18N_API
static UClassID U_EXPORT2
getStaticClassID();
95 * Implements {@link Transliterator#handleTransliterate}.
96 * @param text the buffer holding transliterated and
97 * untransliterated text
98 * @param offset the start and limit of the text, the position
99 * of the cursor, and the start and limit of transliteration.
100 * @param incremental if true, assume more text may be coming after
101 * pos.contextLimit. Otherwise, assume the text is complete.
103 virtual void handleTransliterate(Replaceable
& text
, UTransPosition
& offset
,
104 UBool isIncremental
) const;
110 #endif /* #if !UCONFIG_NO_TRANSLITERATION */