+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 2014-2016, International Business Machines Corporation and
+* Copyright (C) 2014-2015, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
int32_t
SimpleFilteredSentenceBreakIterator::first(void) {
- return internalNext(fDelegate->first());
+ // Don't suppress a break opportunity at the beginning of text.
+ return fDelegate->first();
}
int32_t
}
UBool SimpleFilteredSentenceBreakIterator::isBoundary(int32_t offset) {
- if(!fDelegate->isBoundary(offset)) return false; // no break to suppress
+ if (!fDelegate->isBoundary(offset)) return false; // no break to suppress
+
+ if (fData->fBackwardsTrie.isNull()) return true; // no data = no suppressions
UErrorCode status = U_ZERO_ERROR;
resetState(status);
: fSet(status)
{
if(U_SUCCESS(status)) {
- LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &status));
- LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &status));
- LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &status));
- if(U_FAILURE(status)) return; // leaves the builder empty, if you try to use it.
+ UErrorCode subStatus = U_ZERO_ERROR;
+ LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &subStatus));
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
+#if FB_DEBUG
+ fprintf(stderr, "open BUNDLE %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
+#endif
+ return; // leaves the builder empty, if you try to use it.
+ }
+ LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus));
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
+#if FB_DEBUG
+ fprintf(stderr, "open EXCEPTIONS %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
+#endif
+ return; // leaves the builder empty, if you try to use it.
+ }
+ LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &subStatus));
+
+#if FB_DEBUG
+ {
+ UErrorCode subsub = subStatus;
+ fprintf(stderr, "open SentenceBreak %s => %s, %s\n", fromLocale.getBaseName(), ures_getLocale(breaks.getAlias(), &subsub), u_errorName(subStatus));
+ }
+#endif
+
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
+#if FB_DEBUG
+ fprintf(stderr, "open %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
+#endif
+ return; // leaves the builder empty, if you try to use it.
+ }
LocalUResourceBundlePointer strs;
- UErrorCode subStatus = status;
+ subStatus = status; // Pick up inherited warning status now
do {
strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus));
if(strs.isValid() && U_SUCCESS(subStatus)) {
U_NAMESPACE_END
-#endif //#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION
+#endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION