uni2name.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. **********************************************************************
  5. * Copyright (C) 2001-2007, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. **********************************************************************
  8. * Date Name Description
  9. * 06/06/01 aliu Creation.
  10. **********************************************************************
  11. */
  12. #ifndef UNI2NAME_H
  13. #define UNI2NAME_H
  14. #include "unicode/utypes.h"
  15. #if !UCONFIG_NO_TRANSLITERATION
  16. #include "unicode/translit.h"
  17. U_NAMESPACE_BEGIN
  18. /**
  19. * A transliterator that performs character to name mapping.
  20. * It generates the Perl syntax \N{name}.
  21. * @author Alan Liu
  22. */
  23. class UnicodeNameTransliterator : public Transliterator {
  24. public:
  25. /**
  26. * Constructs a transliterator.
  27. * @param adoptedFilter the filter to be adopted.
  28. */
  29. UnicodeNameTransliterator(UnicodeFilter* adoptedFilter = 0);
  30. /**
  31. * Destructor.
  32. */
  33. virtual ~UnicodeNameTransliterator();
  34. /**
  35. * Copy constructor.
  36. */
  37. UnicodeNameTransliterator(const UnicodeNameTransliterator&);
  38. /**
  39. * Transliterator API.
  40. */
  41. virtual UnicodeNameTransliterator* clone() const;
  42. /**
  43. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  44. */
  45. virtual UClassID getDynamicClassID() const;
  46. /**
  47. * ICU "poor man's RTTI", returns a UClassID for this class.
  48. */
  49. U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
  50. protected:
  51. /**
  52. * Implements {@link Transliterator#handleTransliterate}.
  53. * @param text the buffer holding transliterated and
  54. * untransliterated text
  55. * @param offset the start and limit of the text, the position
  56. * of the cursor, and the start and limit of transliteration.
  57. * @param incremental if true, assume more text may be coming after
  58. * pos.contextLimit. Otherwise, assume the text is complete.
  59. */
  60. virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
  61. UBool isIncremental) const;
  62. private:
  63. /**
  64. * Assignment operator.
  65. */
  66. UnicodeNameTransliterator& operator=(const UnicodeNameTransliterator&);
  67. };
  68. U_NAMESPACE_END
  69. #endif /* #if !UCONFIG_NO_TRANSLITERATION */
  70. #endif