michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (c) 2001-2007, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: * Date Name Description michael@0: * 11/20/2001 aliu Creation. michael@0: ********************************************************************** michael@0: */ michael@0: #ifndef UNESCTRN_H michael@0: #define UNESCTRN_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: #if !UCONFIG_NO_TRANSLITERATION michael@0: michael@0: #include "unicode/translit.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * A transliterator that converts Unicode escape forms to the michael@0: * characters they represent. Escape forms have a prefix, a suffix, a michael@0: * radix, and minimum and maximum digit counts. michael@0: * michael@0: *
This class is package private. It registers several standard michael@0: * variants with the system which are then accessed via their IDs. michael@0: * michael@0: * @author Alan Liu michael@0: */ michael@0: class UnescapeTransliterator : public Transliterator { michael@0: michael@0: private: michael@0: michael@0: /** michael@0: * The encoded pattern specification. The pattern consists of michael@0: * zero or more forms. Each form consists of a prefix, suffix, michael@0: * radix, minimum digit count, and maximum digit count. These michael@0: * values are stored as a five character header. That is, their michael@0: * numeric values are cast to 16-bit characters and stored in the michael@0: * string. Following these five characters, the prefix michael@0: * characters, then suffix characters are stored. Each form thus michael@0: * takes n+5 characters, where n is the total length of the prefix michael@0: * and suffix. The end is marked by a header of length one michael@0: * consisting of the character END. michael@0: */ michael@0: UChar* spec; // owned; may not be NULL michael@0: michael@0: public: michael@0: michael@0: /** michael@0: * Registers standard variants with the system. Called by michael@0: * Transliterator during initialization. michael@0: */ michael@0: static void registerIDs(); michael@0: michael@0: /** michael@0: * Constructor. Takes the encoded spec array (does not adopt it). michael@0: * @param ID the string identifier for this transliterator michael@0: * @param spec the encoded spec array michael@0: */ michael@0: UnescapeTransliterator(const UnicodeString& ID, michael@0: const UChar *spec); michael@0: michael@0: /** michael@0: * Copy constructor. michael@0: */ michael@0: UnescapeTransliterator(const UnescapeTransliterator&); michael@0: michael@0: /** michael@0: * Destructor. michael@0: */ michael@0: virtual ~UnescapeTransliterator(); michael@0: michael@0: /** michael@0: * Transliterator API. michael@0: */ michael@0: virtual Transliterator* clone() const; michael@0: michael@0: /** michael@0: * ICU "poor man's RTTI", returns a UClassID for the actual class. michael@0: */ michael@0: virtual UClassID getDynamicClassID() const; michael@0: michael@0: /** michael@0: * ICU "poor man's RTTI", returns a UClassID for this class. michael@0: */ michael@0: U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); michael@0: michael@0: protected: michael@0: michael@0: /** michael@0: * Implements {@link Transliterator#handleTransliterate}. michael@0: * @param text the buffer holding transliterated and michael@0: * untransliterated text michael@0: * @param offset the start and limit of the text, the position michael@0: * of the cursor, and the start and limit of transliteration. michael@0: * @param incremental if true, assume more text may be coming after michael@0: * pos.contextLimit. Otherwise, assume the text is complete. michael@0: */ michael@0: virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, michael@0: UBool isIncremental) const; michael@0: michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_TRANSLITERATION */ michael@0: michael@0: #endif