ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
icu::FilteredBreakIteratorBuilder Class Reference

The BreakIteratorFilter is used to modify the behavior of a BreakIterator by constructing a new BreakIterator which suppresses certain segment boundaries. More...

`#include <filteredbrk.h>`

Inheritance diagram for icu::FilteredBreakIteratorBuilder:

## Public Member Functions
virtual | ~FilteredBreakIteratorBuilder ()
| destructor.
virtual UBool | suppressBreakAfter (const UnicodeString &string, UErrorCode &status)=0
| Suppress a certain string from being the end of a segment.
virtual UBool | unsuppressBreakAfter (const UnicodeString &string, UErrorCode &status)=0
| Stop suppressing a certain string from being the end of the segment.
virtual BreakIterator * | build (BreakIterator *adoptBreakIterator, UErrorCode &status)=0
| Wrap (adopt) an existing break iterator in a new filtered instance.
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor.
virtual UClassID | getDynamicClassID () const
| ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.

## Static Public Member Functions
static FilteredBreakIteratorBuilder * | createInstance (const Locale &where, UErrorCode &status)
| Construct a FilteredBreakIteratorBuilder based on rules in a locale.
static FilteredBreakIteratorBuilder * | createInstance (UErrorCode &status)
| Construct an empty FilteredBreakIteratorBuilder.

## Protected Member Functions
| FilteredBreakIteratorBuilder ()
| For subclass use.

## Detailed Description

The BreakIteratorFilter is used to modify the behavior of a BreakIterator by constructing a new BreakIterator which suppresses certain segment boundaries.

See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . For example, a typical English Sentence Break Iterator would break on the space in the string "Mr. Smith" (resulting in two segments), but with "Mr." as an exception, a filtered break iterator would consider the string "Mr. Smith" to be a single segment.

Note: An instance of BreakIterator returned by this builder class currently does not support following operations in this technology preview version:

- next(int32_t n)
- previous(void)
- following(int32_t offset)
- preceding(int32_t offset)

When one of above methods is called, BreakIterator.DONE will be returned immediately without updating the internal state.

Internal:
  Do not use. This API is for internal use only. technology preview

Definition at line 47 of file filteredbrk.h.

## Constructor & Destructor Documentation

virtual icu::FilteredBreakIteratorBuilder::~FilteredBreakIteratorBuilder | ( |  | ) |
| virtual

destructor.

Internal:
  Do not use. This API is for internal use only. technology preview

icu::FilteredBreakIteratorBuilder::FilteredBreakIteratorBuilder | ( |  | ) |
| protected

For subclass use.

Internal:
  Do not use. This API is for internal use only. technology preview

## Member Function Documentation

virtual BreakIterator* icu::FilteredBreakIteratorBuilder::build | ( | BreakIterator * | adoptBreakIterator,
|  | UErrorCode & | status
| ) |  |
| pure virtual

Wrap (adopt) an existing break iterator in a new filtered instance.

The resulting BreakIterator is owned by the caller. The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. Note that the adoptBreakIterator is adopted by the new BreakIterator and should no longer be used by the caller. The FilteredBreakIteratorBuilder may be reused.

Parameters

  adoptBreakIterator | the break iterator to adopt
  status | error code

Returns
  the new BreakIterator, owned by the caller.

Internal:
  Do not use. This API is for internal use only. technology preview

static FilteredBreakIteratorBuilder* icu::FilteredBreakIteratorBuilder::createInstance | ( | const Locale & | where,
|  | UErrorCode & | status
| ) |  |
| static

Construct a FilteredBreakIteratorBuilder based on rules in a locale.

The rules are taken from CLDR exception data for the locale, see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions This is the equivalent of calling createInstance(UErrorCode&) and then repeatedly calling addNoBreakAfter(...) with the contents of the CLDR exception data.

Parameters

  where | the locale.
  status | The error code.

Returns
  the new builder

Internal:
  Do not use. This API is for internal use only. technology preview

static FilteredBreakIteratorBuilder* icu::FilteredBreakIteratorBuilder::createInstance | ( | UErrorCode & | status | ) |
| static

Construct an empty FilteredBreakIteratorBuilder.

In this state, it will not suppress any segment boundaries.

Parameters

  status | The error code.

Returns
  the new builder

Internal:
  Do not use. This API is for internal use only. technology preview

virtual UBool icu::FilteredBreakIteratorBuilder::suppressBreakAfter | ( | const UnicodeString & | string,
|  | UErrorCode & | status
| ) |  |
| pure virtual

Suppress a certain string from being the end of a segment.

For example, suppressing "Mr.", then segments ending in "Mr." will not be returned by the iterator.

Parameters

  string | the string to suppress, such as "Mr."
  status | error code

Returns
  returns TRUE if the string was not present and now added, FALSE if the call was a no-op because the string was already being suppressed.

Internal:
  Do not use. This API is for internal use only. technology preview

virtual UBool icu::FilteredBreakIteratorBuilder::unsuppressBreakAfter | ( | const UnicodeString & | string,
|  | UErrorCode & | status
| ) |  |
| pure virtual

Stop suppressing a certain string from being the end of the segment.

This function does not create any new segment boundaries, but only serves to un-do the effect of earlier calls to suppressBreakAfter, or to un-do the effect of locale data which may be suppressing certain strings.

Parameters

  exception | the exception to remove
  status | error code

Returns
  returns TRUE if the string was present and now removed, FALSE if the call was a no-op because the string was not being suppressed.

Internal:
  Do not use. This API is for internal use only. technology preview

The documentation for this class was generated from the following file:

- filteredbrk.h