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