本文整理汇总了C++中Collator::getDynamicClassID方法的典型用法代码示例。如果您正苦于以下问题:C++ Collator::getDynamicClassID方法的具体用法?C++ Collator::getDynamicClassID怎么用?C++ Collator::getDynamicClassID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collator
的用法示例。
在下文中一共展示了Collator::getDynamicClassID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: desiredLocale
UCollator*
Collator::createUCollator(const char *loc,
UErrorCode *status)
{
UCollator *result = 0;
if (status && U_SUCCESS(*status) && hasService()) {
Locale desiredLocale(loc);
Collator *col = (Collator*)gService->get(desiredLocale, *status);
if (col && col->getDynamicClassID() == RuleBasedCollator::getStaticClassID()) {
RuleBasedCollator *rbc = (RuleBasedCollator *)col;
if (!rbc->dataIsOwned) {
result = ucol_safeClone(rbc->ucollator, NULL, NULL, status);
} else {
result = rbc->ucollator;
rbc->ucollator = NULL; // to prevent free on delete
}
}
delete col;
}
return result;
}
示例2: ucol_equals
UBool RuleBasedCollator::operator==(const Collator& that) const
{
/* only checks for address equals here */
if (Collator::operator==(that))
return TRUE;
if (getDynamicClassID() != that.getDynamicClassID())
return FALSE; /* not the same class */
RuleBasedCollator& thatAlias = (RuleBasedCollator&)that;
// weiv: use C function, commented code below is wrong
return ucol_equals(this->ucollator, thatAlias.ucollator);
/*
synwee : orginal code does not check for data compatibility
*/
/*
if (ucollator != thatAlias.ucollator)
return FALSE;
return TRUE;
*/
}