// ***************************************************************************** // This file was generated from the java source file BreakIterator.java // *****************************************************************************
// ***************************************************************************** // class BreakIterator // This class implements methods for finding the location of boundaries in text. // Instances of BreakIterator maintain a current position and scan over text // returning the index of characters where boundaries occur. // *****************************************************************************
// Get the locale
UResourceBundle *b = ures_openNoDefault(U_ICUDATA_BRKITR, loc.getName(), &status);
// Get the "boundaries" array. if (U_SUCCESS(status)) {
brkRules = ures_getByKeyWithFallback(b, "boundaries", brkRules, &status); // Get the string object naming the rules file
brkName = ures_getByKeyWithFallback(brkRules, type, brkName, &status); // Get the actual string
brkfname = ures_getString(brkName, &size, &status);
U_ASSERT((size_t)size<sizeof(fnbuff)); if (static_cast<size_t>(size) >= sizeof(fnbuff)) {
size=0; if (U_SUCCESS(status)) {
status = U_BUFFER_OVERFLOW_ERROR;
}
}
// Use the string if we found it if (U_SUCCESS(status) && brkfname) {
actualLocale.append(ures_getLocaleInternal(brkName, &status), -1, status);
char16_t* extStart=u_strchr(brkfname, 0x002e); int len = 0; if (extStart != nullptr){
len = static_cast<int>(extStart - brkfname);
u_UCharsToChars(extStart+1, ext, sizeof(ext)); // nul terminates the buff
u_UCharsToChars(brkfname, fnbuff, len);
}
fnbuff[len]=0; // nul terminate
}
}
// Create a RuleBasedBreakIterator
result = new RuleBasedBreakIterator(file, uprv_strstr(type, "phrase") != nullptr, status);
// If there is a result, set the valid locale and actual locale, and the kind if (U_SUCCESS(status) && result != nullptr) {
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
// Creates a break iterator for title casing breaks.
BreakIterator* U_EXPORT2
BreakIterator::createTitleInstance(const Locale& key, UErrorCode& status)
{ return createInstance(key, UBRK_TITLE, status);
}
// -------------------------------------
// Gets all the available locales that has localized text boundary data. const Locale* U_EXPORT2
BreakIterator::getAvailableLocales(int32_t& count)
{ return Locale::getAvailableLocales(count);
}
#if !UCONFIG_NO_SERVICE if (hasService()) {
Locale actualLoc("");
BreakIterator *result = (BreakIterator*)gService->get(loc, kind, &actualLoc, status); // TODO: The way the service code works in ICU 2.8 is that if // there is a real registered break iterator, the actualLoc // will be populated, but if the handleDefault path is taken // (because nothing is registered that can handle the // requested locale) then the actualLoc comes back empty. In // that case, the returned object already has its actual/valid // locale data populated (by makeInstance, which is what // handleDefault calls), so we don't touch it. YES, A COMMENT // THIS LONG is a sign of bad code -- so the action item is to // revisit this in ICU 3.0 and clean it up/fix it/remove it. if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) {
U_LOCALE_BASED(locBased, *result);
locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName());
} return result;
} else #endif
{ return makeInstance(loc, kind, status);
}
}
// This implementation of getRuleStatus is a do-nothing stub, here to // provide a default implementation for any derived BreakIterator classes that // do not implement it themselves.
int32_t BreakIterator::getRuleStatus() const { return 0;
}
// This implementation of getRuleStatusVec is a do-nothing stub, here to // provide a default implementation for any derived BreakIterator classes that // do not implement it themselves.
int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status) { if (U_FAILURE(status)) { return 0;
} if (capacity < 1) {
status = U_BUFFER_OVERFLOW_ERROR; return 1;
}
*fillInVec = 0; return 1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.