本文整理汇总了C++中Compositor::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ Compositor::setType方法的具体用法?C++ Compositor::setType怎么用?C++ Compositor::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compositor
的用法示例。
在下文中一共展示了Compositor::setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseCompositor
void Parser::parseCompositor( ParserContext *context,
const QDomElement &element, ComplexType &ct )
{
QName name = element.tagName();
bool isChoice = name.localName() == "choice";
bool isSequence = name.localName() == "sequence";
Compositor compositor;
if ( isChoice ) compositor.setType( Compositor::Choice );
else if ( isSequence ) compositor.setType( Compositor::Sequence );
if ( isChoice || isSequence ) {
Element::List newElements;
QDomElement childElement = element.firstChildElement();
while ( !childElement.isNull() ) {
QName csName = childElement.tagName();
if ( csName.localName() == "element" ) {
Element newElement;
if ( isChoice ) {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
} else {
if ( isSequence ) {
// occurence attributes can be either in the
// parent (sequence) to on the current element
if ( childElement.hasAttribute("minOccurs") ||
childElement.hasAttribute("maxOccurs")) {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
}
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
}
}
newElements.append( newElement );
compositor.addChild( csName );
} else if ( csName.localName() == "any" ) {
addAny( context, childElement, ct );
} else if ( isChoice ) {
parseCompositor( context, childElement, ct );
} else if ( isSequence ) {
parseCompositor( context, childElement, ct );
}
childElement = childElement.nextSiblingElement();
}
foreach( Element e, newElements ) {
e.setCompositor( compositor );
ct.addElement( e );
}
示例2: parseCompositor
void Parser::parseCompositor( ParserContext *context,
const QDomElement &element, ComplexType &ct )
{
const QName name( element.tagName() );
bool isChoice = name.localName() == QLatin1String("choice");
bool isSequence = name.localName() == QLatin1String("sequence");
Compositor compositor;
if ( isChoice ) compositor.setType( Compositor::Choice );
else if ( isSequence ) compositor.setType( Compositor::Sequence );
compositor.setMaxOccurs( readMaxOccurs( element ) );
if ( isChoice || isSequence ) {
Element::List newElements;
QDomElement childElement = element.firstChildElement();
while ( !childElement.isNull() ) {
NSManager namespaceManager( context, childElement );
const QName csName( childElement.tagName() );
if ( csName.localName() == QLatin1String("element") ) {
Element newElement;
if ( isChoice ) {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
}
newElements.append( newElement );
compositor.addChild( csName );
} else if ( csName.localName() == QLatin1String("any") ) {
addAny( context, childElement, ct );
} else if ( isChoice ) {
parseCompositor( context, childElement, ct );
} else if ( isSequence ) {
parseCompositor( context, childElement, ct );
}
childElement = childElement.nextSiblingElement();
}
foreach( Element e, newElements ) {
e.setCompositor( compositor );
ct.addElement( e );
}