]>
Commit | Line | Data |
---|---|---|
374ca955 A |
1 | /* |
2 | ******************************************************************************* | |
3 | * | |
4 | * Copyright (C) 2001-2004, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ******************************************************************************* | |
8 | * file name: casetrn.h | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2004sep03 | |
14 | * created by: Markus W. Scherer | |
15 | * | |
16 | * Implementation class for lower-/upper-/title-casing transliterators. | |
17 | */ | |
18 | ||
19 | #ifndef __CASETRN_H__ | |
20 | #define __CASETRN_H__ | |
21 | ||
22 | #include "unicode/utypes.h" | |
23 | ||
24 | #if !UCONFIG_NO_TRANSLITERATION | |
25 | ||
26 | #include "unicode/translit.h" | |
27 | #include "unicode/locid.h" | |
28 | #include "ucase.h" | |
29 | ||
30 | U_CDECL_BEGIN | |
31 | ||
32 | typedef int32_t U_CALLCONV | |
33 | UCaseMapFull(const UCaseProps *csp, UChar32 c, | |
34 | UCaseContextIterator *iter, void *context, | |
35 | const UChar **pString, | |
36 | const char *locale, int32_t *locCache); | |
37 | ||
38 | U_CDECL_END | |
39 | ||
40 | U_NAMESPACE_BEGIN | |
41 | ||
42 | /** | |
43 | * A transliterator that performs locale-sensitive | |
44 | * case mapping. | |
45 | */ | |
46 | class U_I18N_API CaseMapTransliterator : public Transliterator { | |
47 | public: | |
48 | /** | |
49 | * Constructs a transliterator. | |
50 | * @param loc the given locale. | |
51 | * @param id the transliterator ID. | |
52 | * @param map the full case mapping function (see ucase.h) | |
53 | */ | |
54 | CaseMapTransliterator(const Locale &loc, const UnicodeString &id, UCaseMapFull *map); | |
55 | ||
56 | /** | |
57 | * Destructor. | |
58 | */ | |
59 | virtual ~CaseMapTransliterator(); | |
60 | ||
61 | /** | |
62 | * Copy constructor. | |
63 | */ | |
64 | CaseMapTransliterator(const CaseMapTransliterator&); | |
65 | ||
66 | /** | |
67 | * Assignment operator. | |
68 | */ | |
69 | CaseMapTransliterator& operator=(const CaseMapTransliterator&); | |
70 | ||
71 | /** | |
72 | * Transliterator API. | |
73 | * @return a copy of the object. | |
74 | */ | |
75 | virtual Transliterator* clone(void) const; | |
76 | ||
77 | /** | |
78 | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
79 | */ | |
80 | virtual UClassID getDynamicClassID() const; | |
81 | ||
82 | /** | |
83 | * ICU "poor man's RTTI", returns a UClassID for this class. | |
84 | */ | |
85 | static UClassID U_EXPORT2 getStaticClassID(); | |
86 | ||
87 | protected: | |
88 | /** | |
89 | * Implements {@link Transliterator#handleTransliterate}. | |
90 | * @param text the buffer holding transliterated and | |
91 | * untransliterated text | |
92 | * @param offset the start and limit of the text, the position | |
93 | * of the cursor, and the start and limit of transliteration. | |
94 | * @param incremental if true, assume more text may be coming after | |
95 | * pos.contextLimit. Otherwise, assume the text is complete. | |
96 | */ | |
97 | virtual void handleTransliterate(Replaceable& text, | |
98 | UTransPosition& offsets, | |
99 | UBool isIncremental) const; | |
100 | ||
101 | Locale fLoc; | |
102 | const char *fLocName; | |
103 | UCaseProps *fCsp; | |
104 | UCaseMapFull *fMap; | |
105 | }; | |
106 | ||
107 | U_NAMESPACE_END | |
108 | ||
109 | /** case context iterator using a Replaceable. This must be a C function because it is a callback. */ | |
110 | U_CFUNC UChar32 U_CALLCONV | |
111 | utrans_rep_caseContextIterator(void *context, int8_t dir); | |
112 | ||
113 | #endif /* #if !UCONFIG_NO_TRANSLITERATION */ | |
114 | ||
115 | #endif |