titletrn.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. * 05/24/01 aliu Creation.
  10. **********************************************************************
  11. */
  12. #ifndef TITLETRN_H
  13. #define TITLETRN_H
  14. #include "unicode/utypes.h"
  15. #if !UCONFIG_NO_TRANSLITERATION
  16. #include "unicode/translit.h"
  17. #include "ucase.h"
  18. #include "casetrn.h"
  19. U_NAMESPACE_BEGIN
  20. /**
  21. * A transliterator that converts all letters (as defined by
  22. * <code>UCharacter.isLetter()</code>) to lower case, except for those
  23. * letters preceded by non-letters. The latter are converted to title
  24. * case using <code>u_totitle()</code>.
  25. * @author Alan Liu
  26. */
  27. class TitlecaseTransliterator : public CaseMapTransliterator {
  28. public:
  29. /**
  30. * Constructs a transliterator.
  31. * @param loc the given locale.
  32. */
  33. TitlecaseTransliterator();
  34. /**
  35. * Destructor.
  36. */
  37. virtual ~TitlecaseTransliterator();
  38. /**
  39. * Copy constructor.
  40. */
  41. TitlecaseTransliterator(const TitlecaseTransliterator&);
  42. /**
  43. * Transliterator API.
  44. * @return a copy of the object.
  45. */
  46. virtual TitlecaseTransliterator* clone() const;
  47. /**
  48. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  49. */
  50. virtual UClassID getDynamicClassID() const;
  51. /**
  52. * ICU "poor man's RTTI", returns a UClassID for this class.
  53. */
  54. U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
  55. protected:
  56. /**
  57. * Implements {@link Transliterator#handleTransliterate}.
  58. * @param text the buffer holding transliterated and
  59. * untransliterated text
  60. * @param offset the start and limit of the text, the position
  61. * of the cursor, and the start and limit of transliteration.
  62. * @param incremental if true, assume more text may be coming after
  63. * pos.contextLimit. Otherwise, assume the text is complete.
  64. */
  65. virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
  66. UBool isIncremental) const;
  67. private:
  68. /**
  69. * Assignment operator.
  70. */
  71. TitlecaseTransliterator& operator=(const TitlecaseTransliterator&);
  72. };
  73. U_NAMESPACE_END
  74. #endif /* #if !UCONFIG_NO_TRANSLITERATION */
  75. #endif