|
||||
Warning, file /include/unicode/filteredbrk.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // © 2016 and later: Unicode, Inc. and others. 0002 // License & terms of use: http://www.unicode.org/copyright.html 0003 /* 0004 ******************************************************************************** 0005 * Copyright (C) 1997-2015, International Business Machines 0006 * Corporation and others. All Rights Reserved. 0007 ******************************************************************************** 0008 */ 0009 0010 #ifndef FILTEREDBRK_H 0011 #define FILTEREDBRK_H 0012 0013 #include "unicode/utypes.h" 0014 0015 #if U_SHOW_CPLUSPLUS_API 0016 0017 #include "unicode/brkiter.h" 0018 0019 #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION 0020 0021 U_NAMESPACE_BEGIN 0022 0023 /** 0024 * \file 0025 * \brief C++ API: FilteredBreakIteratorBuilder 0026 */ 0027 0028 /** 0029 * The BreakIteratorFilter is used to modify the behavior of a BreakIterator 0030 * by constructing a new BreakIterator which suppresses certain segment boundaries. 0031 * See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . 0032 * For example, a typical English Sentence Break Iterator would break on the space 0033 * in the string "Mr. Smith" (resulting in two segments), 0034 * but with "Mr." as an exception, a filtered break iterator 0035 * would consider the string "Mr. Smith" to be a single segment. 0036 * 0037 * @stable ICU 56 0038 */ 0039 class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { 0040 public: 0041 /** 0042 * destructor. 0043 * @stable ICU 56 0044 */ 0045 virtual ~FilteredBreakIteratorBuilder(); 0046 0047 /** 0048 * Construct a FilteredBreakIteratorBuilder based on rules in a locale. 0049 * The rules are taken from CLDR exception data for the locale, 0050 * see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions 0051 * This is the equivalent of calling createInstance(UErrorCode&) 0052 * and then repeatedly calling addNoBreakAfter(...) with the contents 0053 * of the CLDR exception data. 0054 * @param where the locale. 0055 * @param status The error code. 0056 * @return the new builder 0057 * @stable ICU 56 0058 */ 0059 static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); 0060 0061 #ifndef U_HIDE_DEPRECATED_API 0062 /** 0063 * This function has been deprecated in favor of createEmptyInstance, which has 0064 * identical behavior. 0065 * @param status The error code. 0066 * @return the new builder 0067 * @deprecated ICU 60 use createEmptyInstance instead 0068 * @see createEmptyInstance() 0069 */ 0070 static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); 0071 #endif /* U_HIDE_DEPRECATED_API */ 0072 0073 /** 0074 * Construct an empty FilteredBreakIteratorBuilder. 0075 * In this state, it will not suppress any segment boundaries. 0076 * @param status The error code. 0077 * @return the new builder 0078 * @stable ICU 60 0079 */ 0080 static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); 0081 0082 /** 0083 * Suppress a certain string from being the end of a segment. 0084 * For example, suppressing "Mr.", then segments ending in "Mr." will not be returned 0085 * by the iterator. 0086 * @param string the string to suppress, such as "Mr." 0087 * @param status error code 0088 * @return returns true if the string was not present and now added, 0089 * false if the call was a no-op because the string was already being suppressed. 0090 * @stable ICU 56 0091 */ 0092 virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; 0093 0094 /** 0095 * Stop suppressing a certain string from being the end of the segment. 0096 * This function does not create any new segment boundaries, but only serves to un-do 0097 * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of 0098 * locale data which may be suppressing certain strings. 0099 * @param string the exception to remove 0100 * @param status error code 0101 * @return returns true if the string was present and now removed, 0102 * false if the call was a no-op because the string was not being suppressed. 0103 * @stable ICU 56 0104 */ 0105 virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; 0106 0107 #ifndef U_FORCE_HIDE_DEPRECATED_API 0108 /** 0109 * This function has been deprecated in favor of wrapIteratorWithFilter() 0110 * The behavior is identical. 0111 * @param adoptBreakIterator the break iterator to adopt 0112 * @param status error code 0113 * @return the new BreakIterator, owned by the caller. 0114 * @deprecated ICU 60 use wrapIteratorWithFilter() instead 0115 * @see wrapBreakIteratorWithFilter() 0116 */ 0117 virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; 0118 #endif // U_FORCE_HIDE_DEPRECATED_API 0119 0120 /** 0121 * Wrap (adopt) an existing break iterator in a new filtered instance. 0122 * The resulting BreakIterator is owned by the caller. 0123 * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. 0124 * Note that the adoptBreakIterator is adopted by the new BreakIterator 0125 * and should no longer be used by the caller. 0126 * The FilteredBreakIteratorBuilder may be reused. 0127 * This function is an alias for build() 0128 * @param adoptBreakIterator the break iterator to adopt 0129 * @param status error code 0130 * @return the new BreakIterator, owned by the caller. 0131 * @stable ICU 60 0132 */ 0133 inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { 0134 return build(adoptBreakIterator, status); 0135 } 0136 0137 protected: 0138 /** 0139 * For subclass use 0140 * @stable ICU 56 0141 */ 0142 FilteredBreakIteratorBuilder(); 0143 }; 0144 0145 0146 U_NAMESPACE_END 0147 0148 #endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION 0149 0150 #endif /* U_SHOW_CPLUSPLUS_API */ 0151 0152 #endif // #ifndef FILTEREDBRK_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |