casetrn.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. *
  6. * Copyright (C) 2001-2008, International Business Machines
  7. * Corporation and others. All Rights Reserved.
  8. *
  9. *******************************************************************************
  10. * file name: casetrn.h
  11. * encoding: UTF-8
  12. * tab size: 8 (not used)
  13. * indentation:4
  14. *
  15. * created on: 2004sep03
  16. * created by: Markus W. Scherer
  17. *
  18. * Implementation class for lower-/upper-/title-casing transliterators.
  19. */
  20. #ifndef __CASETRN_H__
  21. #define __CASETRN_H__
  22. #include "unicode/utypes.h"
  23. #if !UCONFIG_NO_TRANSLITERATION
  24. #include "unicode/translit.h"
  25. #include "ucase.h"
  26. U_NAMESPACE_BEGIN
  27. /**
  28. * A transliterator that performs locale-sensitive
  29. * case mapping.
  30. */
  31. class CaseMapTransliterator : public Transliterator {
  32. public:
  33. /**
  34. * Constructs a transliterator.
  35. * @param loc the given locale.
  36. * @param id the transliterator ID.
  37. * @param map the full case mapping function (see ucase.h)
  38. */
  39. CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map);
  40. /**
  41. * Destructor.
  42. */
  43. virtual ~CaseMapTransliterator();
  44. /**
  45. * Copy constructor.
  46. */
  47. CaseMapTransliterator(const CaseMapTransliterator&);
  48. /**
  49. * Transliterator API.
  50. * @return a copy of the object.
  51. */
  52. virtual CaseMapTransliterator* clone() const = 0;
  53. /**
  54. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  55. */
  56. //virtual UClassID getDynamicClassID() const;
  57. /**
  58. * ICU "poor man's RTTI", returns a UClassID for this class.
  59. */
  60. U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
  61. protected:
  62. /**
  63. * Implements {@link Transliterator#handleTransliterate}.
  64. * @param text the buffer holding transliterated and
  65. * untransliterated text
  66. * @param offset the start and limit of the text, the position
  67. * of the cursor, and the start and limit of transliteration.
  68. * @param incremental if true, assume more text may be coming after
  69. * pos.contextLimit. Otherwise, assume the text is complete.
  70. */
  71. virtual void handleTransliterate(Replaceable& text,
  72. UTransPosition& offsets,
  73. UBool isIncremental) const;
  74. UCaseMapFull *fMap;
  75. private:
  76. /**
  77. * Assignment operator.
  78. */
  79. CaseMapTransliterator& operator=(const CaseMapTransliterator&);
  80. };
  81. U_NAMESPACE_END
  82. /** case context iterator using a Replaceable. This must be a C function because it is a callback. */
  83. U_CFUNC UChar32 U_CALLCONV
  84. utrans_rep_caseContextIterator(void *context, int8_t dir);
  85. #endif /* #if !UCONFIG_NO_TRANSLITERATION */
  86. #endif