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