本文整理汇总了C++中CIMKeyBinding::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMKeyBinding::getType方法的具体用法?C++ CIMKeyBinding::getType怎么用?C++ CIMKeyBinding::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMKeyBinding
的用法示例。
在下文中一共展示了CIMKeyBinding::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equal
Boolean operator==(const CIMKeyBinding& x, const CIMKeyBinding& y)
{
// Check that the names and types match
if (!(x.getName().equal(y.getName())) ||
!(x.getType() == y.getType()))
{
return false;
}
switch (x.getType())
{
case CIMKeyBinding::REFERENCE:
try
{
// References should be compared as CIMObjectPaths
return (CIMObjectPath(x.getValue()) == CIMObjectPath(y.getValue()));
}
catch (Exception&)
{
// If CIMObjectPath parsing fails, just compare strings
return String::equal(x.getValue(), y.getValue());
}
case CIMKeyBinding::BOOLEAN:
// Case-insensitive comparison is sufficient for booleans
return String::equalNoCase(x.getValue(), y.getValue());
case CIMKeyBinding::NUMERIC:
// Note: This comparison assumes XML syntax for integers
// First try comparing as unsigned integers
{
Uint64 xValue;
Uint64 yValue;
if (StringConversion::stringToUnsignedInteger(
x.getValue().getCString(), xValue) &&
StringConversion::stringToUnsignedInteger(
y.getValue().getCString(), yValue))
{
return (xValue == yValue);
}
}
// Next try comparing as signed integers
{
Sint64 xValue;
Sint64 yValue;
if (StringConversion::stringToSignedInteger(
x.getValue().getCString(), xValue) &&
StringConversion::stringToSignedInteger(
y.getValue().getCString(), yValue))
{
return (xValue == yValue);
}
}
// Note: Keys may not be real values, so don't try comparing as reals
// We couldn't parse the numbers, so just compare the strings
return String::equal(x.getValue(), y.getValue());
default: // CIMKeyBinding::STRING
return String::equal(x.getValue(), y.getValue());
}
PEGASUS_UNREACHABLE(return false;)
}