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