本文整理汇总了C++中DynamicObject::getUInt64方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::getUInt64方法的具体用法?C++ DynamicObject::getUInt64怎么用?C++ DynamicObject::getUInt64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicObject
的用法示例。
在下文中一共展示了DynamicObject::getUInt64方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValid
bool Int::isValid(
DynamicObject& obj,
ValidatorContext* context)
{
bool rval;
DynamicObjectType objType;
rval = !obj.isNull();
if(rval)
{
objType = obj->getType();
if(objType == String)
{
objType = DynamicObject::determineType(obj->getString());
}
// type check
rval =
objType == Int32 ||
objType == UInt32 ||
objType == Int64 ||
objType == UInt64;
}
if(!rval)
{
DynamicObject detail =
context->addError("monarch.validation.ValueError", &obj);
detail["validator"] = "monarch.validator.Int";
detail["message"] =
mErrorMessage ? mErrorMessage :
"The given value type is required to be an integer.";
}
// absolute value of dyno value
uint64_t val = 0;
// flag if val is negative
bool valneg = false;
// get value for min/max check
if(rval)
{
// get value and sign
switch(objType)
{
case Int32:
case Int64:
{
int64_t raw = obj->getInt64();
valneg = (raw < 0);
val = (uint64_t)(valneg ? -raw : raw);
break;
}
case UInt32:
case UInt64:
{
valneg = false;
val = obj->getUInt64();
break;
}
default:
// never get here
break;
}
}
// min check
if(rval)
{
if(mMinNegative != valneg)
{
// signs are different
// val meets the minimum unless val is negative
rval = !valneg;
}
else
{
// signs are the same
// val meets the minimum if:
// 1. val is positive and larger than mMin
// 2. val is negative and smaller than mMin
rval = (!valneg ? val >= mMin : val <= mMin);
}
// set exception on failure
if(!rval)
{
DynamicObject detail =
context->addError("monarch.validation.ValueError", &obj);
detail["validator"] = "monarch.validator.Int";
detail["message"] = mErrorMessage ? mErrorMessage :
"The given integer value is less than the required minimum "
"integer value.";
detail["expectedMin"] = mMin;
}
}
// max check
if(rval)
//.........这里部分代码省略.........