本文整理汇总了C++中DatatypeValidator::setOrdered方法的典型用法代码示例。如果您正苦于以下问题:C++ DatatypeValidator::setOrdered方法的具体用法?C++ DatatypeValidator::setOrdered怎么用?C++ DatatypeValidator::setOrdered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatatypeValidator
的用法示例。
在下文中一共展示了DatatypeValidator::setOrdered方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
DatatypeValidator* DatatypeValidatorFactory::createDatatypeValidator
(
const XMLCh* const typeName
, RefVectorOf<DatatypeValidator>* const validators
, const int finalSet
, const bool userDefined
, MemoryManager* const userManager
)
{
if (validators == 0)
return 0;
DatatypeValidator* datatypeValidator = 0;
MemoryManager* const manager = (userDefined)
? userManager : XMLPlatformUtils::fgMemoryManager;
datatypeValidator = new (manager) UnionDatatypeValidator(validators, finalSet, manager);
if (datatypeValidator != 0) {
if (userDefined) {
if (!fUserDefinedRegistry) {
fUserDefinedRegistry = new (userManager) RefHashTableOf<DatatypeValidator>(29, userManager);
}
fUserDefinedRegistry->put((void *)typeName, datatypeValidator);
}
else {
fBuiltInRegistry->put((void *)typeName, datatypeValidator);
}
datatypeValidator->setTypeName(typeName);
// Set PSVI information for Ordered, Numeric, Bounded & Finite
unsigned int valSize = validators->size();
if (valSize)
{
DatatypeValidator::ValidatorType ancestorId = getPrimitiveDV(validators->elementAt(0)->getType());
// For a union the ORDERED {value} is partial unless one of the following:
// 1. If every member of {member type definitions} is derived from a common ancestor other than the simple ur-type, then {value} is the same as that ancestor's ordered facet.
// 2. If every member of {member type definitions} has a {value} of false for the ordered facet, then {value} is false.
bool allOrderedFalse = true;
bool commonAnc = ancestorId != DatatypeValidator::AnySimpleType;
bool allNumeric = true;
bool allBounded = true;
bool allFinite = true;
for(unsigned int i = 0 ; (i < valSize) && (commonAnc || allOrderedFalse || allNumeric || allBounded || allFinite); i++)
{
// for the other member types, check whether the value is false
// and whether they have the same ancestor as the first one
if (commonAnc)
commonAnc = ancestorId == getPrimitiveDV(validators->elementAt(i)->getType());
if (allOrderedFalse)
allOrderedFalse = validators->elementAt(i)->getOrdered() == XSSimpleTypeDefinition::ORDERED_FALSE;
if (allNumeric && !validators->elementAt(i)->getNumeric())
{
allNumeric = false;
}
if (allBounded && (!validators->elementAt(i)->getBounded() ||
ancestorId != getPrimitiveDV(validators->elementAt(i)->getType())))
{
allBounded = false;
}
if (allFinite && !validators->elementAt(i)->getFinite())
{
allFinite = false;
}
}
if (commonAnc)
{
datatypeValidator->setOrdered(validators->elementAt(0)->getOrdered());
}
else if (allOrderedFalse)
{
datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_FALSE);
}
else
{
datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL);
}
datatypeValidator->setNumeric(allNumeric);
datatypeValidator->setBounded(allBounded);
datatypeValidator->setFinite(allFinite);
}
else // size = 0
{
datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL);
datatypeValidator->setNumeric(true);
datatypeValidator->setBounded(true);
datatypeValidator->setFinite(true);
}
}
return datatypeValidator;
}