michael@0: /*
michael@0: **********************************************************************
michael@0: * Copyright (C) 2001-2007, International Business Machines
michael@0: * Corporation and others. All Rights Reserved.
michael@0: **********************************************************************
michael@0: * Date Name Description
michael@0: * 05/24/01 aliu Creation.
michael@0: **********************************************************************
michael@0: */
michael@0: #ifndef TITLETRN_H
michael@0: #define TITLETRN_H
michael@0:
michael@0: #include "unicode/utypes.h"
michael@0:
michael@0: #if !UCONFIG_NO_TRANSLITERATION
michael@0:
michael@0: #include "unicode/translit.h"
michael@0: #include "ucase.h"
michael@0: #include "casetrn.h"
michael@0:
michael@0: U_NAMESPACE_BEGIN
michael@0:
michael@0: /**
michael@0: * A transliterator that converts all letters (as defined by
michael@0: * UCharacter.isLetter()
) to lower case, except for those
michael@0: * letters preceded by non-letters. The latter are converted to title
michael@0: * case using u_totitle()
.
michael@0: * @author Alan Liu
michael@0: */
michael@0: class TitlecaseTransliterator : public CaseMapTransliterator {
michael@0: public:
michael@0:
michael@0: /**
michael@0: * Constructs a transliterator.
michael@0: * @param loc the given locale.
michael@0: */
michael@0: TitlecaseTransliterator();
michael@0:
michael@0: /**
michael@0: * Destructor.
michael@0: */
michael@0: virtual ~TitlecaseTransliterator();
michael@0:
michael@0: /**
michael@0: * Copy constructor.
michael@0: */
michael@0: TitlecaseTransliterator(const TitlecaseTransliterator&);
michael@0:
michael@0: /**
michael@0: * Transliterator API.
michael@0: * @return a copy of the object.
michael@0: */
michael@0: virtual Transliterator* clone(void) const;
michael@0:
michael@0: /**
michael@0: * ICU "poor man's RTTI", returns a UClassID for the actual class.
michael@0: */
michael@0: virtual UClassID getDynamicClassID() const;
michael@0:
michael@0: /**
michael@0: * ICU "poor man's RTTI", returns a UClassID for this class.
michael@0: */
michael@0: U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
michael@0:
michael@0: protected:
michael@0:
michael@0: /**
michael@0: * Implements {@link Transliterator#handleTransliterate}.
michael@0: * @param text the buffer holding transliterated and
michael@0: * untransliterated text
michael@0: * @param offset the start and limit of the text, the position
michael@0: * of the cursor, and the start and limit of transliteration.
michael@0: * @param incremental if true, assume more text may be coming after
michael@0: * pos.contextLimit. Otherwise, assume the text is complete.
michael@0: */
michael@0: virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
michael@0: UBool isIncremental) const;
michael@0:
michael@0: private:
michael@0: /**
michael@0: * Assignment operator.
michael@0: */
michael@0: TitlecaseTransliterator& operator=(const TitlecaseTransliterator&);
michael@0: };
michael@0:
michael@0: U_NAMESPACE_END
michael@0:
michael@0: #endif /* #if !UCONFIG_NO_TRANSLITERATION */
michael@0:
michael@0: #endif