本文整理汇总了C++中UVector::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ UVector::isEmpty方法的具体用法?C++ UVector::isEmpty怎么用?C++ UVector::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UVector
的用法示例。
在下文中一共展示了UVector::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUniquePatterns
void CompactData::getUniquePatterns(UVector &output, UErrorCode &status) const {
U_ASSERT(output.isEmpty());
// NOTE: In C++, this is done more manually with a UVector.
// In Java, we can take advantage of JDK HashSet.
for (auto pattern : patterns) {
if (pattern == nullptr || pattern == USE_FALLBACK) {
continue;
}
// Insert pattern into the UVector if the UVector does not already contain the pattern.
// Search the UVector from the end since identical patterns are likely to be adjacent.
for (int32_t i = output.size() - 1; i >= 0; i--) {
if (u_strcmp(pattern, static_cast<const UChar *>(output[i])) == 0) {
goto continue_outer;
}
}
// The string was not found; add it to the UVector.
// ANDY: This requires a const_cast. Why?
output.addElement(const_cast<UChar *>(pattern), status);
continue_outer:
continue;
}
}
示例2: countTransitionRules
//.........这里部分代码省略.........
if (newTimes == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
goto error;
}
for (int32_t newidx = 0; newidx < asize; newidx++) {
tar->getStartTimeAt(idx + newidx, newTimes[newidx]);
if (U_FAILURE(status)) {
uprv_free(newTimes);
newTimes = NULL;
goto error;
}
}
tar->getName(name);
TimeArrayTimeZoneRule *newTar = new TimeArrayTimeZoneRule(name,
tar->getRawOffset(), tar->getDSTSavings(), newTimes, asize, timeType);
uprv_free(newTimes);
filteredRules->addElement(newTar, status);
if (U_FAILURE(status)) {
goto error;
}
}
}
}
} else if ((ar = dynamic_cast<const AnnualTimeZoneRule *>(toRule)) != NULL) {
ar->getFirstStart(tzt.getFrom()->getRawOffset(), tzt.getFrom()->getDSTSavings(), firstStart);
if (firstStart == tzt.getTime()) {
// Just add the rule as is
filteredRules->addElement(ar->clone(), status);
if (U_FAILURE(status)) {
goto error;
}
} else {
// Calculate the transition year
int32_t year, month, dom, dow, doy, mid;
Grego::timeToFields(tzt.getTime(), year, month, dom, dow, doy, mid);
// Re-create the rule
ar->getName(name);
AnnualTimeZoneRule *newAr = new AnnualTimeZoneRule(name, ar->getRawOffset(), ar->getDSTSavings(),
*(ar->getRule()), year, ar->getEndYear());
filteredRules->addElement(newAr, status);
if (U_FAILURE(status)) {
goto error;
}
}
// check if this is a final rule
if (ar->getEndYear() == AnnualTimeZoneRule::MAX_YEAR) {
// After bot final standard and dst rules are processed,
// exit this while loop.
if (ar->getDSTSavings() == 0) {
bFinalStd = TRUE;
} else {
bFinalDst = TRUE;
}
}
}
done[i] = TRUE;
}
// Set the results
if (orgRules != NULL) {
while (!orgRules->isEmpty()) {
r = (TimeZoneRule*)orgRules->orphanElementAt(0);
delete r;
}
delete orgRules;
}
if (done != NULL) {
uprv_free(done);
}
initial = res_initial;
transitionRules = filteredRules;
return;
error:
if (orgtrs != NULL) {
uprv_free(orgtrs);
}
if (orgRules != NULL) {
while (!orgRules->isEmpty()) {
r = (TimeZoneRule*)orgRules->orphanElementAt(0);
delete r;
}
delete orgRules;
}
if (done != NULL) {
if (filteredRules != NULL) {
while (!filteredRules->isEmpty()) {
r = (TimeZoneRule*)filteredRules->orphanElementAt(0);
delete r;
}
delete filteredRules;
}
delete res_initial;
uprv_free(done);
}
initial = NULL;
transitionRules = NULL;
}