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