本文整理汇总了C++中DatatypeValidator::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ DatatypeValidator::getType方法的具体用法?C++ DatatypeValidator::getType怎么用?C++ DatatypeValidator::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatatypeValidator
的用法示例。
在下文中一共展示了DatatypeValidator::getType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getItemTypeDTV
DatatypeValidator* ListDatatypeValidator::getItemTypeDTV() const
{
DatatypeValidator* bdv = this->getBaseValidator();
while (bdv->getType() == DatatypeValidator::List)
bdv = bdv->getBaseValidator();
return bdv;
}
示例2: if
// ---------------------------------------------------------------------------
// DatatypeValidatorFactory: factory methods
// ---------------------------------------------------------------------------
DatatypeValidator* DatatypeValidatorFactory::createDatatypeValidator
(
const XMLCh* const typeName
, DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefArrayVectorOf<XMLCh>* const enums
, const bool isDerivedByList
, const int finalSet
, const bool isUserDefined
, MemoryManager* const userManager
)
{
if (baseValidator == 0) {
if (facets) {
Janitor<KVStringPairHashTable> janFacets(facets);
}
if (enums) {
Janitor<XMLChRefVector> janEnums(enums);
}
return 0;
}
DatatypeValidator* datatypeValidator = 0;
MemoryManager* const manager = (isUserDefined)
? userManager : XMLPlatformUtils::fgMemoryManager;
if (isDerivedByList) {
datatypeValidator = new (manager) ListDatatypeValidator(baseValidator, facets, enums, finalSet, manager);
// Set PSVI information for Ordered, Numeric, Bounded & Finite
datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_FALSE);
datatypeValidator->setNumeric(false);
if (facets &&
((facets->get(SchemaSymbols::fgELT_LENGTH) ||
(facets->get(SchemaSymbols::fgELT_MINLENGTH) && facets->get(SchemaSymbols::fgELT_MAXLENGTH)))))
{
datatypeValidator->setBounded(true);
datatypeValidator->setFinite(true);
}
else
{
datatypeValidator->setBounded(false);
datatypeValidator->setFinite(false);
}
}
else {
if ((baseValidator->getType() != DatatypeValidator::String) && facets) {
KVStringPair* value = facets->get(SchemaSymbols::fgELT_WHITESPACE);
if (value != 0) {
facets->removeKey(SchemaSymbols::fgELT_WHITESPACE);
}
}
datatypeValidator = baseValidator->newInstance
(
facets
, enums
, finalSet
, manager
);
// Set PSVI information for Ordered, Numeric, Bounded & Finite
datatypeValidator->setOrdered(baseValidator->getOrdered());
datatypeValidator->setNumeric(baseValidator->getNumeric());
RefHashTableOf<KVStringPair>* baseFacets = baseValidator->getFacets();
if (facets &&
((facets->get(SchemaSymbols::fgELT_MININCLUSIVE) ||
facets->get(SchemaSymbols::fgELT_MINEXCLUSIVE) ||
(baseFacets && (baseFacets->get(SchemaSymbols::fgELT_MININCLUSIVE) ||
baseFacets->get(SchemaSymbols::fgELT_MINEXCLUSIVE))))) &&
(facets->get(SchemaSymbols::fgELT_MAXINCLUSIVE) ||
facets->get(SchemaSymbols::fgELT_MAXEXCLUSIVE) ||
(baseFacets && ((baseFacets->get(SchemaSymbols::fgELT_MAXINCLUSIVE) ||
baseFacets->get(SchemaSymbols::fgELT_MAXEXCLUSIVE))))))
{
datatypeValidator->setBounded(true);
}
else
{
datatypeValidator->setBounded(false);
}
if (baseValidator->getFinite())
{
datatypeValidator->setFinite(true);
}
else if (!facets)
{
datatypeValidator->setFinite(false);
}
else if (facets->get(SchemaSymbols::fgELT_LENGTH) || facets->get(SchemaSymbols::fgELT_MAXLENGTH) ||
facets->get(SchemaSymbols::fgELT_TOTALDIGITS))
//.........这里部分代码省略.........
示例3: checkContent
//
// here content is a list of items
//
void ListDatatypeValidator::checkContent( BaseRefVectorOf<XMLCh>* tokenVector
, const XMLCh* const content
, ValidationContext* const context
, bool asBase
, MemoryManager* const manager)
{
DatatypeValidator* bv = getBaseValidator();
if (bv->getType() == DatatypeValidator::List)
((ListDatatypeValidator*)bv)->checkContent(tokenVector, content, context, true, manager);
else
{ // the ultimate itemType DTV
for (unsigned int i = 0; i < tokenVector->size(); i++)
bv->validate(tokenVector->elementAt(i), context, manager);
}
int thisFacetsDefined = getFacetsDefined();
// we check pattern first
if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
if (getRegex() == 0)
{
try {
setRegex(new (fMemoryManager) RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption, fMemoryManager));
}
catch (XMLException &e)
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage(), manager);
}
}
//check every item in the list as a whole
if (getRegex()->matches(content, manager) == false)
{
ThrowXMLwithMemMgr2(InvalidDatatypeValueException
, XMLExcepts::VALUE_NotMatch_Pattern
, content
, getPattern()
, manager);
}
}
// if this is a base validator, we only need to check pattern facet
// all other facet were inherited by the derived type
if (asBase)
return;
unsigned int tokenNumber = tokenVector->size();
if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) &&
(tokenNumber > getMaxLength()))
{
XMLCh value1[BUF_LEN+1];
XMLCh value2[BUF_LEN+1];
XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
XMLString::binToText(getMaxLength(), value2, BUF_LEN, 10, manager);
ThrowXMLwithMemMgr3(InvalidDatatypeValueException
, XMLExcepts::VALUE_GT_maxLen
, getContent()
, value1
, value2
, manager);
}
if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) != 0) &&
(tokenNumber < getMinLength()))
{
XMLCh value1[BUF_LEN+1];
XMLCh value2[BUF_LEN+1];
XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
XMLString::binToText(getMinLength(), value2, BUF_LEN, 10, manager);
ThrowXMLwithMemMgr3(InvalidDatatypeValueException
, XMLExcepts::VALUE_LT_minLen
, getContent()
, value1
, value2
, manager);
}
if (((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) != 0) &&
(tokenNumber != AbstractStringValidator::getLength()))
{
XMLCh value1[BUF_LEN+1];
XMLCh value2[BUF_LEN+1];
XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
XMLString::binToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager);
ThrowXMLwithMemMgr3(InvalidDatatypeValueException
, XMLExcepts::VALUE_NE_Len
, getContent()
, value1
, value2
//.........这里部分代码省略.........
示例4: if
XSSimpleTypeDefinition*
XSObjectFactory::addOrFind(DatatypeValidator* const validator,
XSModel* const xsModel,
bool isAnySimpleType)
{
XSSimpleTypeDefinition* xsObj = (XSSimpleTypeDefinition*) xsModel->getXSObject(validator);
if (!xsObj)
{
XSTypeDefinition* baseType = 0;
XSSimpleTypeDefinitionList* memberTypes = 0;
XSSimpleTypeDefinition* primitiveOrItemType = 0;
XSSimpleTypeDefinition::VARIETY typeVariety = XSSimpleTypeDefinition::VARIETY_ATOMIC;
bool primitiveTypeSelf = false;
//REVISIT: the getFixed method is protected so added friend XSObjectFactory
// to DatatypeValidator class...
DatatypeValidator::ValidatorType dvType = validator->getType();
DatatypeValidator* baseDV = validator->getBaseValidator();
if (dvType == DatatypeValidator::Union)
{
typeVariety = XSSimpleTypeDefinition::VARIETY_UNION;
RefVectorOf<DatatypeValidator>* membersDV = ((UnionDatatypeValidator*)validator)->getMemberTypeValidators();
XMLSize_t size = membersDV->size();
if (size)
{
memberTypes = new (fMemoryManager) RefVectorOf<XSSimpleTypeDefinition>(size, false, fMemoryManager);
for (XMLSize_t i=0; i<size; i++)
memberTypes->addElement(addOrFind(membersDV->elementAt(i), xsModel));
}
if (baseDV)
{
baseType = addOrFind(baseDV, xsModel);
}
else
{
baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition
(
SchemaSymbols::fgDT_ANYSIMPLETYPE
, SchemaSymbols::fgURI_SCHEMAFORSCHEMA
);
}
}
else if (dvType == DatatypeValidator::List)
{
typeVariety = XSSimpleTypeDefinition::VARIETY_LIST;
if (baseDV->getType() == DatatypeValidator::List)
{
baseType = addOrFind(baseDV, xsModel);
primitiveOrItemType = ((XSSimpleTypeDefinition*) baseType)->getItemType();
}
else
{
baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition
(
SchemaSymbols::fgDT_ANYSIMPLETYPE
, SchemaSymbols::fgURI_SCHEMAFORSCHEMA
);
primitiveOrItemType = addOrFind(baseDV, xsModel);
}
}
else if (!isAnySimpleType)
{
if (baseDV)
{
baseType = addOrFind(baseDV, xsModel);
primitiveOrItemType = ((XSSimpleTypeDefinition*) baseType)->getPrimitiveType();
}
else // built-in
{
baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition
(
SchemaSymbols::fgDT_ANYSIMPLETYPE
, SchemaSymbols::fgURI_SCHEMAFORSCHEMA
);
primitiveTypeSelf = true;
}
}
else
{
baseType = xsModel->getTypeDefinition(SchemaSymbols::fgATTVAL_ANYTYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA);
}
xsObj = new (fMemoryManager) XSSimpleTypeDefinition
(
validator
, typeVariety
, baseType
, primitiveOrItemType
, memberTypes
, getAnnotationFromModel(xsModel, validator)
, xsModel
, fMemoryManager
);
putObjectInMap(validator, xsObj);
if (primitiveTypeSelf)
xsObj->setPrimitiveType(xsObj);
//.........这里部分代码省略.........