]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/casetrn.h
ICU-8.11.tar.gz
[apple/icu.git] / icuSources / i18n / casetrn.h
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2001-2005, 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 "ucase.h"
28
29 U_CDECL_BEGIN
30
31 typedef int32_t U_CALLCONV
32 UCaseMapFull(const UCaseProps *csp, UChar32 c,
33 UCaseContextIterator *iter, void *context,
34 const UChar **pString,
35 const char *locale, int32_t *locCache);
36
37 U_CDECL_END
38
39 U_NAMESPACE_BEGIN
40
41 /**
42 * A transliterator that performs locale-sensitive
43 * case mapping.
44 */
45 class U_I18N_API CaseMapTransliterator : public Transliterator {
46 public:
47 /**
48 * Constructs a transliterator.
49 * @param loc the given locale.
50 * @param id the transliterator ID.
51 * @param map the full case mapping function (see ucase.h)
52 */
53 CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map);
54
55 /**
56 * Destructor.
57 */
58 virtual ~CaseMapTransliterator();
59
60 /**
61 * Copy constructor.
62 */
63 CaseMapTransliterator(const CaseMapTransliterator&);
64
65 /**
66 * Assignment operator.
67 */
68 CaseMapTransliterator& operator=(const CaseMapTransliterator&);
69
70 /**
71 * Transliterator API.
72 * @return a copy of the object.
73 */
74 virtual Transliterator* clone(void) const;
75
76 /**
77 * ICU "poor man's RTTI", returns a UClassID for the actual class.
78 */
79 virtual UClassID getDynamicClassID() const;
80
81 /**
82 * ICU "poor man's RTTI", returns a UClassID for this class.
83 */
84 static UClassID U_EXPORT2 getStaticClassID();
85
86 protected:
87 /**
88 * Implements {@link Transliterator#handleTransliterate}.
89 * @param text the buffer holding transliterated and
90 * untransliterated text
91 * @param offset the start and limit of the text, the position
92 * of the cursor, and the start and limit of transliteration.
93 * @param incremental if true, assume more text may be coming after
94 * pos.contextLimit. Otherwise, assume the text is complete.
95 */
96 virtual void handleTransliterate(Replaceable& text,
97 UTransPosition& offsets,
98 UBool isIncremental) const;
99
100 const UCaseProps *fCsp;
101 UCaseMapFull *fMap;
102 };
103
104 U_NAMESPACE_END
105
106 /** case context iterator using a Replaceable. This must be a C function because it is a callback. */
107 U_CFUNC UChar32 U_CALLCONV
108 utrans_rep_caseContextIterator(void *context, int8_t dir);
109
110 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
111
112 #endif