intl/icu/source/i18n/unesctrn.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /*
     2  **********************************************************************
     3  *   Copyright (c) 2001-2007, International Business Machines
     4  *   Corporation and others.  All Rights Reserved.
     5  **********************************************************************
     6  *   Date        Name        Description
     7  *   11/20/2001  aliu        Creation.
     8  **********************************************************************
     9  */
    10 #ifndef UNESCTRN_H
    11 #define UNESCTRN_H
    13 #include "unicode/utypes.h"
    15 #if !UCONFIG_NO_TRANSLITERATION
    17 #include "unicode/translit.h"
    19 U_NAMESPACE_BEGIN
    21 /**
    22  * A transliterator that converts Unicode escape forms to the
    23  * characters they represent.  Escape forms have a prefix, a suffix, a
    24  * radix, and minimum and maximum digit counts.
    25  *
    26  * <p>This class is package private.  It registers several standard
    27  * variants with the system which are then accessed via their IDs.
    28  *
    29  * @author Alan Liu
    30  */
    31 class UnescapeTransliterator : public Transliterator {
    33  private:
    35     /**
    36      * The encoded pattern specification.  The pattern consists of
    37      * zero or more forms.  Each form consists of a prefix, suffix,
    38      * radix, minimum digit count, and maximum digit count.  These
    39      * values are stored as a five character header.  That is, their
    40      * numeric values are cast to 16-bit characters and stored in the
    41      * string.  Following these five characters, the prefix
    42      * characters, then suffix characters are stored.  Each form thus
    43      * takes n+5 characters, where n is the total length of the prefix
    44      * and suffix.  The end is marked by a header of length one
    45      * consisting of the character END.
    46      */
    47     UChar* spec; // owned; may not be NULL
    49  public:
    51     /**
    52      * Registers standard variants with the system.  Called by
    53      * Transliterator during initialization.
    54      */
    55     static void registerIDs();
    57     /**
    58      * Constructor.  Takes the encoded spec array (does not adopt it).
    59      * @param ID   the string identifier for this transliterator
    60      * @param spec the encoded spec array
    61      */
    62     UnescapeTransliterator(const UnicodeString& ID,
    63                            const UChar *spec);
    65     /**
    66      * Copy constructor.
    67      */
    68     UnescapeTransliterator(const UnescapeTransliterator&);
    70     /**
    71      * Destructor.
    72      */
    73     virtual ~UnescapeTransliterator();
    75     /**
    76      * Transliterator API.
    77      */
    78     virtual Transliterator* clone() const;
    80     /**
    81      * ICU "poor man's RTTI", returns a UClassID for the actual class.
    82      */
    83     virtual UClassID getDynamicClassID() const;
    85     /**
    86      * ICU "poor man's RTTI", returns a UClassID for this class.
    87      */
    88     U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
    90  protected:
    92     /**
    93      * Implements {@link Transliterator#handleTransliterate}.
    94      * @param text        the buffer holding transliterated and
    95      *                    untransliterated text
    96      * @param offset      the start and limit of the text, the position
    97      *                    of the cursor, and the start and limit of transliteration.
    98      * @param incremental if true, assume more text may be coming after
    99      *                    pos.contextLimit.  Otherwise, assume the text is complete.
   100      */
   101     virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
   102                              UBool isIncremental) const;
   104 };
   106 U_NAMESPACE_END
   108 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
   110 #endif

mercurial