本文整理汇总了C++中OSNumber::isEqualTo方法的典型用法代码示例。如果您正苦于以下问题:C++ OSNumber::isEqualTo方法的具体用法?C++ OSNumber::isEqualTo怎么用?C++ OSNumber::isEqualTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSNumber
的用法示例。
在下文中一共展示了OSNumber::isEqualTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareNumberPropertyArray
bool CompareNumberPropertyArray( IOService * owner, OSDictionary * matching, const char * arrayName, const char * key, SInt32 * score, SInt32 increment)
{
OSNumber *registryProperty = (OSNumber *)owner->copyProperty(key);
OSArray *propertyArray = (OSArray *)matching->getObject(arrayName);
CONVERT_TO_STACK_RETAIN(registryProperty);
// If the property in the matching doesn't exist return true
if ( OSDynamicCast(OSArray, propertyArray) )
{
if ( OSDynamicCast(OSNumber, registryProperty ) )
{
OSNumber *propertyFromArray;
int i = 0;
for ( i = 0; i < propertyArray->getCount(); i ++ )
{
propertyFromArray = OSDynamicCast(OSNumber, propertyArray->getObject(i));
if ( propertyFromArray && propertyFromArray->isEqualTo(registryProperty) )
{
if ( score )
*score += increment;
return true;
}
}
}
}
else
return true;
return false;
}
示例2: OSDynamicCast
// This routine will look to see if the OSArray contains any matching keys. The OSArray has to contain a list of OSNumbers.
bool
IOUSBNub::USBComparePropertyInArray( OSDictionary *matching, const char * arrayName, const char * key, UInt32 * theProductIDThatMatched )
{
// We return success iff we match any entry in the array with the key
OSArray * propertyIDArray = NULL;
OSNumber * registryProperty = NULL;
OSNumber * propertyFromArrayItem = NULL;
bool matches = false;
unsigned int index;
*theProductIDThatMatched = 0;
// Get our nub's value for the key
registryProperty = OSDynamicCast(OSNumber, getProperty(key));
propertyIDArray = OSDynamicCast(OSArray, matching->getObject(arrayName));
// Iterate over the array looking for the entries
if (propertyIDArray && registryProperty)
{
USBLog(7, "%s[%p]::USBComparePropertyInArray - found array with capacity of %d", getName(), this, propertyIDArray->getCount());
for (index = 0; index < propertyIDArray->getCount(); index++)
{
propertyFromArrayItem = OSDynamicCast(OSNumber, propertyIDArray->getObject(index));
if (propertyFromArrayItem)
{
// See if this item has the same value as the one in our registry for this key
matches = propertyFromArrayItem->isEqualTo( registryProperty);
if (matches)
{
*theProductIDThatMatched = propertyFromArrayItem->unsigned32BitValue();
USBLog(7, "%s[%p]::USBComparePropertyInArray - item %d matched: id = 0x%x", getName(), this, index, (uint32_t) *theProductIDThatMatched);
break;
}
else
{
USBLog(7, "%s[%p]::USBComparePropertyInArray - item %d did not match", getName(), this, index);
}
}
}
}
return matches;
}