Loading...
Searching...
No Matches
brkiter.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
* Copyright (C) 1997-2016, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
* File brkiter.h
*
* Modification History:
*
* Date Name Description
* 02/18/97 aliu Added typedef for TextCount. Made DONE const.
* 05/07/97 aliu Fixed DLL declaration.
* 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK
* 08/11/98 helena Sync-up JDK1.2.
* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods.
********************************************************************************
*/
#ifndef BRKITER_H
#define BRKITER_H
#include "unicode/utypes.h"
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if UCONFIG_NO_BREAK_ITERATION
U_NAMESPACE_BEGIN
/*
* Allow the declaration of APIs with pointers to BreakIterator
* even when break iteration is removed from the build.
*/
class BreakIterator;
U_NAMESPACE_END
#else
#include "unicode/uobject.h"
#include "unicode/unistr.h"
#include "unicode/chariter.h"
#include "unicode/locid.h"
#include "unicode/ubrk.h"
#include "unicode/strenum.h"
#include "unicode/utext.h"
#include "unicode/umisc.h"
U_NAMESPACE_BEGIN
class U_COMMON_API_CLASS BreakIterator : public UObject {
public:
U_COMMON_API virtual ~BreakIterator();
U_COMMON_API virtual bool operator==(const BreakIterator&) const = 0;
U_COMMON_API bool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); }
U_COMMON_API virtual BreakIterator* clone() const = 0;
U_COMMON_API virtual UClassID getDynamicClassID() const override = 0;
U_COMMON_API virtual CharacterIterator& getText() const = 0;
U_COMMON_API virtual UText* getUText(UText* fillIn, UErrorCode& status) const = 0;
U_COMMON_API virtual void setText(const UnicodeString& text) = 0;
U_COMMON_API virtual void setText(UText* text, UErrorCode& status) = 0;
U_COMMON_API virtual void adoptText(CharacterIterator* it) = 0;
enum {
DONE = static_cast<int32_t>(-1)
};
U_COMMON_API virtual int32_t first() = 0;
U_COMMON_API virtual int32_t last() = 0;
U_COMMON_API virtual int32_t previous() = 0;
U_COMMON_API virtual int32_t next() = 0;
U_COMMON_API virtual int32_t current() const = 0;
U_COMMON_API virtual int32_t following(int32_t offset) = 0;
U_COMMON_API virtual int32_t preceding(int32_t offset) = 0;
U_COMMON_API virtual UBool isBoundary(int32_t offset) = 0;
U_COMMON_API virtual int32_t next(int32_t n) = 0;
U_COMMON_API virtual int32_t getRuleStatus() const;
U_COMMON_API virtual int32_t getRuleStatusVec(int32_t* fillInVec,
int32_t capacity,
UErrorCode& status);
U_COMMON_API static BreakIterator* U_EXPORT2
createWordInstance(const Locale& where, UErrorCode& status);
U_COMMON_API static BreakIterator* U_EXPORT2
createLineInstance(const Locale& where, UErrorCode& status);
U_COMMON_API static BreakIterator* U_EXPORT2
createCharacterInstance(const Locale& where, UErrorCode& status);
U_COMMON_API static BreakIterator* U_EXPORT2
createSentenceInstance(const Locale& where, UErrorCode& status);
#ifndef U_HIDE_DEPRECATED_API
U_COMMON_API static BreakIterator* U_EXPORT2
createTitleInstance(const Locale& where, UErrorCode& status);
#endif /* U_HIDE_DEPRECATED_API */
U_COMMON_API static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
U_COMMON_API static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
const Locale& displayLocale,
UnicodeString& name);
U_COMMON_API static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
UnicodeString& name);
#ifndef U_FORCE_HIDE_DEPRECATED_API
U_COMMON_API virtual BreakIterator* createBufferClone(void* stackBuffer,
int32_t& BufferSize,
UErrorCode& status) = 0;
#endif // U_FORCE_HIDE_DEPRECATED_API
#ifndef U_HIDE_DEPRECATED_API
U_COMMON_API inline UBool isBufferClone();
#endif /* U_HIDE_DEPRECATED_API */
#if !UCONFIG_NO_SERVICE
U_COMMON_API static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt,
const Locale& locale,
UBreakIteratorType kind,
UErrorCode& status);
U_COMMON_API static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
U_COMMON_API static StringEnumeration* U_EXPORT2 getAvailableLocales();
#endif
U_COMMON_API Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
#ifndef U_HIDE_INTERNAL_API
U_COMMON_API const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const;
#endif /* U_HIDE_INTERNAL_API */
U_COMMON_API virtual BreakIterator& refreshInputText(UText* input, UErrorCode& status) = 0;
private:
static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status);
static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status);
static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status);
friend class ICUBreakIteratorFactory;
friend class ICUBreakIteratorService;
protected:
// Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API
// or else the compiler will create a public ones.
U_COMMON_API BreakIterator();
U_COMMON_API BreakIterator(const BreakIterator& other);
#ifndef U_HIDE_INTERNAL_API
U_COMMON_API BreakIterator(const Locale& valid, const Locale& actual);
U_COMMON_API BreakIterator& operator=(const BreakIterator& other);
#endif /* U_HIDE_INTERNAL_API */
private:
Locale actualLocale;
Locale validLocale;
Locale requestLocale;
};
#ifndef U_HIDE_DEPRECATED_API
inline UBool BreakIterator::isBufferClone()
{
return false;
}
#endif /* U_HIDE_DEPRECATED_API */
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // BRKITER_H
//eof
chariter.h
C++ API: Character Iterator.
icu::BreakIterator::adoptText
virtual U_COMMON_API void adoptText(CharacterIterator *it)=0
Change the text over which this operates.
icu::BreakIterator::isBoundary
virtual U_COMMON_API UBool isBoundary(int32_t offset)=0
Return true if the specified position is a boundary position.
icu::BreakIterator::createWordInstance
static U_COMMON_API BreakIterator * createWordInstance(const Locale &where, UErrorCode &status)
Create BreakIterator for word-breaks using the given locale.
icu::BreakIterator::unregister
static U_COMMON_API UBool unregister(URegistryKey key, UErrorCode &status)
Unregister a previously-registered BreakIterator using the key returned from the register call.
icu::BreakIterator::getLocale
U_COMMON_API Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const
Returns the locale for this break iterator.
icu::BreakIterator::following
virtual U_COMMON_API int32_t following(int32_t offset)=0
Advance the iterator to the first boundary following the specified offset.
icu::BreakIterator::current
virtual U_COMMON_API int32_t current() const =0
Return character index of the current iterator position within the text.
icu::BreakIterator::getAvailableLocales
static U_COMMON_API const Locale * getAvailableLocales(int32_t &count)
Get the set of Locales for which TextBoundaries are installed.
icu::BreakIterator::createLineInstance
static U_COMMON_API BreakIterator * createLineInstance(const Locale &where, UErrorCode &status)
Create BreakIterator for line-breaks using specified locale.
icu::BreakIterator::clone
virtual U_COMMON_API BreakIterator * clone() const =0
Return a polymorphic copy of this object.
icu::BreakIterator::getRuleStatus
virtual U_COMMON_API int32_t getRuleStatus() const
For RuleBasedBreakIterators, return the status tag from the break rule that determined the boundary a...
icu::BreakIterator::createBufferClone
virtual U_COMMON_API BreakIterator * createBufferClone(void *stackBuffer, int32_t &BufferSize, UErrorCode &status)=0
Deprecated functionality.
icu::BreakIterator::operator!=
U_COMMON_API bool operator!=(const BreakIterator &rhs) const
Returns the complement of the result of operator==.
Definition brkiter.h:135
icu::BreakIterator::operator=
U_COMMON_API BreakIterator & operator=(const BreakIterator &other)
icu::BreakIterator::BreakIterator
U_COMMON_API BreakIterator()
icu::BreakIterator::getLocaleID
U_COMMON_API const char * getLocaleID(ULocDataLocaleType type, UErrorCode &status) const
Get the locale for this break iterator object.
icu::BreakIterator::setText
virtual U_COMMON_API void setText(UText *text, UErrorCode &status)=0
Reset the break iterator to operate over the text represented by the UText.
icu::BreakIterator::operator==
virtual U_COMMON_API bool operator==(const BreakIterator &) const =0
Return true if another object is semantically equal to this one.
icu::BreakIterator::getText
virtual U_COMMON_API CharacterIterator & getText() const =0
Return a CharacterIterator over the text being analyzed.
icu::BreakIterator::createCharacterInstance
static U_COMMON_API BreakIterator * createCharacterInstance(const Locale &where, UErrorCode &status)
Create BreakIterator for character-breaks using specified locale Returns an instance of a BreakIterat...
icu::BreakIterator::previous
virtual U_COMMON_API int32_t previous()=0
Set the iterator position to the boundary preceding the current boundary.
icu::BreakIterator::createSentenceInstance
static U_COMMON_API BreakIterator * createSentenceInstance(const Locale &where, UErrorCode &status)
Create BreakIterator for sentence-breaks using specified locale Returns an instance of a BreakIterato...
icu::BreakIterator::getAvailableLocales
static U_COMMON_API StringEnumeration * getAvailableLocales()
Return a StringEnumeration over the locales available at the time of the call, including registered l...
icu::BreakIterator::preceding
virtual U_COMMON_API int32_t preceding(int32_t offset)=0
Set the iterator position to the first boundary preceding the specified offset.
icu::BreakIterator::~BreakIterator
virtual U_COMMON_API ~BreakIterator()
destructor
icu::BreakIterator::createTitleInstance
static U_COMMON_API BreakIterator * createTitleInstance(const Locale &where, UErrorCode &status)
Create BreakIterator for title-casing breaks using the specified locale Returns an instance of a Brea...
icu::BreakIterator::first
virtual U_COMMON_API int32_t first()=0
Sets the current iteration position to the beginning of the text, position zero.
icu::BreakIterator::getRuleStatusVec
virtual U_COMMON_API int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status)
For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) that determined the b...
icu::BreakIterator::setText
virtual U_COMMON_API void setText(const UnicodeString &text)=0
Change the text over which this operates.
icu::BreakIterator::registerInstance
static U_COMMON_API URegistryKey registerInstance(BreakIterator *toAdopt, const Locale &locale, UBreakIteratorType kind, UErrorCode &status)
Register a new break iterator of the indicated kind, to use in the given locale.
icu::BreakIterator::BreakIterator
U_COMMON_API BreakIterator(const Locale &valid, const Locale &actual)
icu::BreakIterator::isBufferClone
U_COMMON_API UBool isBufferClone()
Determine whether the BreakIterator was created in user memory by createBufferClone(),...
Definition brkiter.h:657
icu::BreakIterator::getDisplayName
static U_COMMON_API UnicodeString & getDisplayName(const Locale &objectLocale, UnicodeString &name)
Get name of the object for the desired Locale, in the language of the default locale.
icu::BreakIterator::last
virtual U_COMMON_API int32_t last()=0
Set the iterator position to the index immediately BEYOND the last character in the text being scanne...
icu::BreakIterator::BreakIterator
U_COMMON_API BreakIterator(const BreakIterator &other)
icu::BreakIterator::getDisplayName
static U_COMMON_API UnicodeString & getDisplayName(const Locale &objectLocale, const Locale &displayLocale, UnicodeString &name)
Get name of the object for the desired Locale, in the desired language.
icu::BreakIterator::next
virtual U_COMMON_API int32_t next()=0
Advance the iterator to the boundary following the current boundary.
icu::BreakIterator::next
virtual U_COMMON_API int32_t next(int32_t n)=0
Set the iterator position to the nth boundary from the current boundary.
icu::BreakIterator::refreshInputText
virtual U_COMMON_API BreakIterator & refreshInputText(UText *input, UErrorCode &status)=0
Set the subject text string upon which the break iterator is operating without changing any other asp...
icu::BreakIterator::getUText
virtual U_COMMON_API UText * getUText(UText *fillIn, UErrorCode &status) const =0
Get a UText for the text being analyzed.
icu::BreakIterator::getDynamicClassID
virtual U_COMMON_API UClassID getDynamicClassID() const override=0
Return a polymorphic class ID for this object.
icu::BreakIterator::DONE
@ DONE
DONE is returned by previous() and next() after all valid boundaries have been returned.
Definition brkiter.h:222
icu::CharacterIterator
Abstract class that defines an API for iteration on text objects.
Definition chariter.h:361
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:198
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition strenum.h:61
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition uobject.h:222
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:303
locid.h
C++ API: Locale ID object.
icu::operator==
U_COMMON_API UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
strenum.h
C++ API: String Enumeration.
UText
UText struct.
Definition utext.h:1328
ubrk.h
C API: BreakIterator.
UBreakIteratorType
UBreakIteratorType
The possible types of text boundaries.
Definition ubrk.h:102
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition uloc.h:338
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:269
umisc.h
C API: Miscellaneous definitions.
URegistryKey
const void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration.
Definition umisc.h:57
unistr.h
C++ API: Unicode String.
uobject.h
C++ API: Common ICU base class UObject.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:96
utext.h
C API: Abstract Unicode Text API.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:509
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition utypes.h:315
U_COMMON_API_CLASS
#define U_COMMON_API_CLASS
Set to export library symbols from inside the common library, and to import them from outside,...
Definition utypes.h:456