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