本文整理汇总了C++中Hashtable::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Hashtable::count方法的具体用法?C++ Hashtable::count怎么用?C++ Hashtable::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hashtable
的用法示例。
在下文中一共展示了Hashtable::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeSTV
/**
* Remove a source-target/variant from the specDAG.
*/
void TransliteratorRegistry::removeSTV(const UnicodeString& source,
const UnicodeString& target,
const UnicodeString& variant) {
// assert(source.length() > 0);
// assert(target.length() > 0);
UErrorCode status = U_ZERO_ERROR;
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == NULL) {
return; // should never happen for valid s-t/v
}
uint32_t varMask = targets->geti(target);
if (varMask == 0) {
return; // should never happen for valid s-t/v
}
int32_t variantListIndex = variantList.indexOf((void*) &variant, 0);
if (variantListIndex < 0) {
return; // should never happen for valid s-t/v
}
int32_t remMask = 1 << variantListIndex;
varMask &= (~remMask);
if (varMask != 0) {
targets->puti(target, varMask, status);
} else {
targets->remove(target); // should delete variants
if (targets->count() == 0) {
specDAG.remove(source); // should delete targets
}
}
}
示例2: while
UBool
SelectFormat::operator==(const Format& other) const {
if( this == &other){
return TRUE;
}
if( other.getDynamicClassID() != SelectFormat::getStaticClassID() ){
return FALSE;
}
SelectFormat* fmt = (SelectFormat*)&other;
Hashtable* hashOther = fmt->parsedValuesHash;
if ( parsedValuesHash == NULL && hashOther == NULL)
return TRUE;
if ( parsedValuesHash == NULL || hashOther == NULL)
return FALSE;
if ( hashOther->count() != parsedValuesHash->count() ){
return FALSE;
}
const UHashElement* elem = NULL;
int32_t pos = -1;
while ((elem = hashOther->nextElement(pos)) != NULL) {
const UHashTok otherKeyTok = elem->key;
UnicodeString* otherKey = (UnicodeString*)otherKeyTok.pointer;
const UHashTok otherKeyToVal = elem->value;
UnicodeString* otherValue = (UnicodeString*)otherKeyToVal.pointer;
UnicodeString* thisElemValue = (UnicodeString*)parsedValuesHash->get(*otherKey);
if ( thisElemValue == NULL ){
return FALSE;
}
if ( *thisElemValue != *otherValue){
return FALSE;
}
}
pos = -1;
while ((elem = parsedValuesHash->nextElement(pos)) != NULL) {
const UHashTok thisKeyTok = elem->key;
UnicodeString* thisKey = (UnicodeString*)thisKeyTok.pointer;
const UHashTok thisKeyToVal = elem->value;
UnicodeString* thisValue = (UnicodeString*)thisKeyToVal.pointer;
UnicodeString* otherElemValue = (UnicodeString*)hashOther->get(*thisKey);
if ( otherElemValue == NULL ){
return FALSE;
}
if ( *otherElemValue != *thisValue){
return FALSE;
}
}
return TRUE;
}
示例3: removeSTV
/**
* Remove a source-target/variant from the specDAG.
*/
void TransliteratorRegistry::removeSTV(const UnicodeString& source,
const UnicodeString& target,
const UnicodeString& variant) {
// assert(source.length() > 0);
// assert(target.length() > 0);
// UErrorCode status = U_ZERO_ERROR;
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
return; // should never happen for valid s-t/v
}
UVector *variants = (UVector*) targets->get(target);
if (variants == 0) {
return; // should never happen for valid s-t/v
}
variants->removeElement((void*) &variant);
if (variants->size() == 0) {
targets->remove(target); // should delete variants
if (targets->count() == 0) {
specDAG.remove(source); // should delete targets
}
}
}
示例4: countAvailableTargets
int32_t TransliteratorRegistry::countAvailableTargets(const UnicodeString& source) const {
Hashtable *targets = (Hashtable*) specDAG.get(source);
return (targets == 0) ? 0 : targets->count();
}