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: * 06/07/01 aliu Creation. michael@0: ********************************************************************** michael@0: */ michael@0: #ifndef NAME2UNI_H michael@0: #define NAME2UNI_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: #include "unicode/uniset.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * A transliterator that performs name to character mapping. michael@0: * It recognizes the Perl syntax \N{name}. michael@0: * @author Alan Liu michael@0: */ michael@0: class NameUnicodeTransliterator : public Transliterator { michael@0: public: michael@0: michael@0: /** michael@0: * Constructs a transliterator. michael@0: * @param adoptedFilter the filter for this transliterator. michael@0: */ michael@0: NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0); michael@0: michael@0: /** michael@0: * Destructor. michael@0: */ michael@0: virtual ~NameUnicodeTransliterator(); michael@0: michael@0: /** michael@0: * Copy constructor. michael@0: */ michael@0: NameUnicodeTransliterator(const NameUnicodeTransliterator&); michael@0: michael@0: /** michael@0: * Transliterator API. michael@0: * @return A copy of the object. michael@0: */ michael@0: virtual Transliterator* clone(void) 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: * Set of characters which occur in Unicode character names. michael@0: */ michael@0: UnicodeSet legal; michael@0: private: michael@0: /** michael@0: * Assignment operator. michael@0: */ michael@0: NameUnicodeTransliterator& operator=(const NameUnicodeTransliterator&); michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_TRANSLITERATION */ michael@0: michael@0: #endif