本文整理汇总了C++中UnicodeString::fastCopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::fastCopyFrom方法的具体用法?C++ UnicodeString::fastCopyFrom怎么用?C++ UnicodeString::fastCopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::fastCopyFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void
TextTrieMap::putImpl(const UnicodeString &key, void *value, UErrorCode &status) {
if (fNodes == NULL) {
fNodesCapacity = 512;
fNodes = (CharacterNode *)uprv_malloc(fNodesCapacity * sizeof(CharacterNode));
fNodes[0].clear(); // Init root node.
fNodesCount = 1;
}
UnicodeString foldedKey;
const UChar *keyBuffer;
int32_t keyLength;
if (fIgnoreCase) {
// Ok to use fastCopyFrom() because we discard the copy when we return.
foldedKey.fastCopyFrom(key).foldCase();
keyBuffer = foldedKey.getBuffer();
keyLength = foldedKey.length();
} else {
keyBuffer = key.getBuffer();
keyLength = key.length();
}
CharacterNode *node = fNodes;
int32_t index;
for (index = 0; index < keyLength; ++index) {
node = addChildNode(node, keyBuffer[index], status);
}
node->addValue(value, fValueDeleter, status);
}
示例2: openOlsonResource
const UnicodeString U_EXPORT2
TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
U_DEBUG_TZ_MSG(("gEI(%d)\n", index));
UnicodeString result;
UErrorCode ec = U_ZERO_ERROR;
UResourceBundle res;
ures_initStackObject(&res);
UResourceBundle *top = openOlsonResource(id, res, ec);
int32_t zone = -1;
if (U_SUCCESS(ec)) {
int32_t size = ures_getSize(&res);
if (size == 4 || size == 6) {
UResourceBundle r;
ures_initStackObject(&r);
ures_getByIndex(&res, size-1, &r, &ec);
const int32_t* v = ures_getIntVector(&r, &size, &ec);
if (index >= 0 && index < size && getOlsonMeta()) {
zone = v[index];
}
ures_close(&r);
}
}
ures_close(&res);
if (zone >= 0) {
UResourceBundle *ares = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Zones section
if (U_SUCCESS(ec)) {
int32_t idLen = 0;
const UChar* id = ures_getStringByIndex(ares, zone, &idLen, &ec);
result.fastCopyFrom(UnicodeString(TRUE, id, idLen));
U_DEBUG_TZ_MSG(("gei(%d) -> %d, len%d, %s\n", index, zone, result.length(), u_errorName(ec)));
}
ures_close(ares);
}
ures_close(top);
#if defined(U_DEBUG_TZ)
if(result.length() ==0) {
U_DEBUG_TZ_MSG(("equiv [__, #%d] -> 0 (%s)\n", index, u_errorName(ec)));
}
#endif
return result;
}