本文整理汇总了C++中QDomNode::isComment方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::isComment方法的具体用法?C++ QDomNode::isComment怎么用?C++ QDomNode::isComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNode
的用法示例。
在下文中一共展示了QDomNode::isComment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextGroup
/**
* Jump to the next group, KateSyntaxContextData::currentGroup will point to the next group
*/
bool KateSyntaxDocument::nextGroup( KateSyntaxContextData* data)
{
if(!data)
return false;
// No group yet so go to first child
if (data->currentGroup.isNull())
{
// Skip over non-elements. So far non-elements are just comments
QDomNode node = data->parent.firstChild();
while (node.isComment())
node = node.nextSibling();
data->currentGroup = node.toElement();
}
else
{
// common case, iterate over siblings, skipping comments as we go
QDomNode node = data->currentGroup.nextSibling();
while (node.isComment())
node = node.nextSibling();
data->currentGroup = node.toElement();
}
return !data->currentGroup.isNull();
}
示例2: loadXML
bool Journal::loadXML( const QDomDocument& document )
{
QDomElement top = document.documentElement();
if ( top.tagName() != "journal" ) {
qWarning( "XML error: Top tag was %s instead of the expected Journal",
top.tagName().ascii() );
return false;
}
for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) {
if ( n.isComment() )
continue;
if ( n.isElement() ) {
QDomElement e = n.toElement();
if ( !loadAttribute( e ) ) {
// Unhandled tag - save for later storage
//qDebug( "Unhandled tag: %s", e.toCString().data() );
}
} else
qDebug( "Node is not a comment or an element???" );
}
return true;
}
示例3: if
SWBuildCommand::SWBuildCommand( QDomNode& swBuildNode ):
fileType_(),
command_(),
flags_(),
replaceDefault_(false) {
for (int i = 0; i < swBuildNode.childNodes().count(); ++i) {
QDomNode node = swBuildNode.childNodes().at(i);
if (node.isComment()) {
continue;
}
else if (node.nodeName() == QString("kactus2:fileType")) {
fileType_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("spirit:command")) {
command_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("spirit:flags")) {
flags_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("spirit:replaceDefaultFlags")) {
const QString value = node.childNodes().at(0).nodeValue();
replaceDefault_ = General::str2Bool(value, false);
}
}
}
示例4: loadXML
bool Task::loadXML( const QDomDocument& document )
{
mKolabPriorityFromDom = -1;
mKCalPriorityFromDom = -1;
QDomElement top = document.documentElement();
if ( top.tagName() != "task" ) {
qWarning( "XML error: Top tag was %s instead of the expected task",
top.tagName().toAscii().data() );
return false;
}
setHasStartDate( false ); // todo's don't necessarily have one
for ( QDomNode n = top.firstChild(); !n.isNull(); n = n.nextSibling() ) {
if ( n.isComment() )
continue;
if ( n.isElement() ) {
QDomElement e = n.toElement();
if ( !loadAttribute( e ) )
// TODO: Unhandled tag - save for later storage
kDebug() <<"Warning: Unhandled tag" << e.tagName();
} else
kDebug() <<"Node is not a comment or an element???";
}
loadAttachments();
decideAndSetPriority();
return true;
}
示例5: SearchGivenNodeFrom
bool XmlRelationCheckerCoreImpl::SearchGivenNodeFrom(QDomNode nodeToCheck, const QString& key, XmlRelation* xmlRelation) const
{
if(!nodeToCheck.isNull())
{
if(nodeToCheck.isElement() && !nodeToCheck.isComment())
{
//For debug
//const QString& nodeName = nodeToCheck.nodeName();
//Controll if the node is a node to key
QList<QString>* keyList = CheckIsNodeFrom(nodeToCheck, xmlRelation);
bool found = false;
for(int i=0; i < keyList->size() && !found; ++i)
{
if(key.compare(keyList->at(i), Qt::CaseInsensitive) == 0)
{
found = true;
}
}
delete keyList;
//Check this is the wanted node to
if(found || SearchGivenNodeFrom(nodeToCheck.firstChildElement(), key, xmlRelation))
{
return true;
}
}
//Recursive call
return SearchGivenNodeFrom(nodeToCheck.nextSiblingElement(), key, xmlRelation);
}
return false;
}
示例6: if
//-----------------------------------------------------------------------------
// Function: ApiInterface::ApiInterface()
//-----------------------------------------------------------------------------
ApiInterface::ApiInterface(QDomNode& node)
: nameGroup_(node),
apiType_(),
dependencyDir_(DEPENDENCY_PROVIDER),
defaultPos_()
{
for (int i = 0; i < node.childNodes().count(); ++i)
{
QDomNode childNode = node.childNodes().at(i);
if (childNode.isComment())
{
continue;
}
if (childNode.nodeName() == "kactus2:apiType")
{
apiType_ = VLNV::createVLNV(childNode, VLNV::APIDEFINITION);
}
else if (childNode.nodeName() == "kactus2:dependencyDirection")
{
dependencyDir_ = str2DependencyDirection(childNode.childNodes().at(0).nodeValue(), DEPENDENCY_PROVIDER);
}
else if (childNode.nodeName() == "kactus2:position")
{
defaultPos_.setX(childNode.attributes().namedItem("x").nodeValue().toInt());
defaultPos_.setY(childNode.attributes().namedItem("y").nodeValue().toInt());
}
}
}
示例7: if
BSPBuildCommand::BSPBuildCommand( QDomNode& bspNode ):
fileType_(),
command_(),
arguments_(),
cpuName_() {
for (int i = 0; i < bspNode.childNodes().count(); ++i) {
QDomNode node = bspNode.childNodes().at(i);
if (node.isComment()) {
continue;
}
else if (node.nodeName() == QString("kactus2:fileType")) {
fileType_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("spirit:command")) {
command_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("kactus2:arguments")) {
arguments_ = node.childNodes().at(0).nodeValue();
}
else if (node.nodeName() == QString("kactus2:cpuName")) {
cpuName_ = node.childNodes().at(0).nodeValue();
}
}
}
示例8: isComment
bool QDomNodeProto:: isComment() const
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
return item->isComment();
return false;
}
示例9: nextItem
/**
* Jump to the next item, KateSyntaxContextData::item will point to the next item
*/
bool KateSyntaxDocument::nextItem( KateSyntaxContextData* data)
{
if(!data)
return false;
if (data->item.isNull())
{
QDomNode node = data->currentGroup.firstChild();
while (node.isComment())
node = node.nextSibling();
data->item = node.toElement();
}
else
{
QDomNode node = data->item.nextSibling();
while (node.isComment())
node = node.nextSibling();
data->item = node.toElement();
}
return !data->item.isNull();
}
示例10: parseRootNode
void XmlVendorParser::parseRootNode( const QDomElement &node )
{
for ( QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling() )
{
if ( child.toElement().tagName() == "Vendor" )
{
parseVendorNode( child.toElement() );
}
else if ( !child.isComment() )
{
qWarning() << "Warning: bad element: "
<< child.toElement().tagName()
<< ", Ignored.";
}
}
}
示例11: load
bool UMLAttribute::load( QDomElement & element ) {
m_SecondaryId = element.attribute( "type", "" );
// We use the m_SecondaryId as a temporary store for the xmi.id
// of the attribute type model object.
// It is resolved later on, when all classes have been loaded.
// This deferred resolution is required because the xmi.id may
// be a forward reference, i.e. it may identify a model object
// that has not yet been loaded.
if (m_SecondaryId.isEmpty()) {
// Perhaps the type is stored in a child node:
QDomNode node = element.firstChild();
while (!node.isNull()) {
if (node.isComment()) {
node = node.nextSibling();
continue;
}
QDomElement tempElement = node.toElement();
QString tag = tempElement.tagName();
if (!Uml::tagEq(tag, "type")) {
node = node.nextSibling();
continue;
}
m_SecondaryId = tempElement.attribute( "xmi.id", "" );
if (m_SecondaryId.isEmpty())
m_SecondaryId = tempElement.attribute( "xmi.idref", "" );
if (m_SecondaryId.isEmpty()) {
QDomNode inner = node.firstChild();
QDomElement tmpElem = inner.toElement();
m_SecondaryId = tmpElem.attribute( "xmi.id", "" );
if (m_SecondaryId.isEmpty())
m_SecondaryId = tmpElem.attribute( "xmi.idref", "" );
}
break;
}
if (m_SecondaryId.isEmpty()) {
kDebug() << "UMLAttribute::load(" << m_Name << "): "
<< "cannot find type." << endl;
}
}
m_InitialValue = element.attribute( "initialValue", "" );
if (m_InitialValue.isEmpty()) {
// for backward compatibility
m_InitialValue = element.attribute( "value", "" );
}
return true;
}
示例12: SearchGivenNodeTo
QString XmlRelationCheckerCoreImpl::SearchGivenNodeTo(QDomNode nodeToCheck, const QString& key, XmlRelation* xmlRelation,
const QString& parentNumberBase, int number) const
{
if(!nodeToCheck.isNull())
{
if(nodeToCheck.isElement() && !nodeToCheck.isComment())
{
//Initialize the identifiersNumber string with the base number
QString identifierNumber = parentNumberBase;
//If it's not empty is because it's the first node and it needn't the dot seprator
if(!parentNumberBase.isEmpty())
{
identifierNumber.append('.');
}
//Attach the number
identifierNumber.append(QString::number(number));
//Controll if the node is a node to key
const QString& nodeToKey = CheckIsNodeTo(nodeToCheck, xmlRelation);
//Check this is the wanted node to
if(key.compare(nodeToKey, Qt::CaseInsensitive) == 0)
{
return identifierNumber;
}
//Check the son
else
{
const QString& sonIdentifier = SearchGivenNodeTo(nodeToCheck.firstChildElement(), key, xmlRelation, identifierNumber, 1);
//If the son is the node searched
if( ! sonIdentifier.isEmpty())
{
//return the child identifier number
return sonIdentifier;
}
}
}
//Recursive call on the sibling
return SearchGivenNodeTo(nodeToCheck.nextSiblingElement(), key, xmlRelation, parentNumberBase, number+1);
}
return "";
}
示例13: loadAttendeeAttribute
bool Incidence::loadAttendeeAttribute(QDomElement &element,
Attendee &attendee)
{
for(QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
{
if(n.isComment())
continue;
if(n.isElement())
{
QDomElement e = n.toElement();
QString tagName = e.tagName();
if(tagName == "display-name")
attendee.displayName = e.text();
else if(tagName == "smtp-address")
attendee.smtpAddress = e.text();
else if(tagName == "status")
attendee.status = e.text();
else if(tagName == "request-response")
// This sets reqResp to false, if the text is "false". Otherwise it
// sets it to true. This means the default setting is true.
attendee.requestResponse = (e.text().lower() != "false");
else if(tagName == "invitation-sent")
// Like above, only this defaults to false
attendee.invitationSent = (e.text().lower() != "true");
else if(tagName == "role")
attendee.role = e.text();
else if(tagName == "delegated-to")
attendee.delegate = e.text();
else if(tagName == "delegated-from")
attendee.delegator = e.text();
else
// TODO: Unhandled tag - save for later storage
kdDebug() << "Warning: Unhandled tag " << e.tagName() << endl;
}
else
kdDebug() << "Node is not a comment or an element???" << endl;
}
return true;
}
示例14: loadRecurrence
void Incidence::loadRecurrence(const QDomElement &element)
{
mRecurrence.interval = 0;
mRecurrence.cycle = element.attribute("cycle");
mRecurrence.type = element.attribute("type");
for(QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
{
if(n.isComment())
continue;
if(n.isElement())
{
QDomElement e = n.toElement();
QString tagName = e.tagName();
if(tagName == "interval")
mRecurrence.interval = e.text().toInt();
else if(tagName == "day") // can be present multiple times
mRecurrence.days.append(e.text());
else if(tagName == "daynumber")
mRecurrence.dayNumber = e.text();
else if(tagName == "month")
mRecurrence.month = e.text();
else if(tagName == "range")
{
mRecurrence.rangeType = e.attribute("type");
mRecurrence.range = e.text();
}
else if(tagName == "exclusion")
{
mRecurrence.exclusions.append(stringToDate(e.text()));
}
else
// TODO: Unhandled tag - save for later storage
kdDebug() << "Warning: Unhandled tag " << e.tagName() << endl;
}
}
}
示例15: loadFromXMI
//.........这里部分代码省略.........
} else {
QString visibility = element.attribute(QLatin1String("visibility"), QLatin1String("public"));
if (visibility == QLatin1String("private")
|| visibility == QLatin1String("private_vis")) // for compatibility with other programs
m_visibility = Uml::Visibility::Private;
else if (visibility == QLatin1String("protected")
|| visibility == QLatin1String("protected_vis")) // for compatibility with other programs
m_visibility = Uml::Visibility::Protected;
else if (visibility == QLatin1String("implementation"))
m_visibility = Uml::Visibility::Implementation;
}
QString stereo = element.attribute(QLatin1String("stereotype"));
if (!stereo.isEmpty()) {
Uml::ID::Type stereoID = Uml::ID::fromString(stereo);
m_pStereotype = umldoc->findStereotypeById(stereoID);
if (m_pStereotype) {
m_pStereotype->incrRefCount();
} else {
uDebug() << m_name << ": UMLStereotype " << Uml::ID::toString(stereoID)
<< " not found, creating now.";
setStereotypeCmd(stereo);
}
}
if (element.hasAttribute(QLatin1String("abstract"))) { // for bkwd compat.
QString abstract = element.attribute(QLatin1String("abstract"), QLatin1String("0"));
m_bAbstract = (bool)abstract.toInt();
} else {
QString isAbstract = element.attribute(QLatin1String("isAbstract"), QLatin1String("false"));
m_bAbstract = (isAbstract == QLatin1String("true"));
}
if (element.hasAttribute(QLatin1String("static"))) { // for bkwd compat.
QString staticScope = element.attribute(QLatin1String("static"), QLatin1String("0"));
m_bStatic = (bool)staticScope.toInt();
} else {
QString ownerScope = element.attribute(QLatin1String("ownerScope"), QLatin1String("instance"));
m_bStatic = (ownerScope == QLatin1String("classifier"));
}
// If the node has child nodes, check whether attributes can be
// extracted from them.
if (element.hasChildNodes()) {
QDomNode node = element.firstChild();
if (node.isComment())
node = node.nextSibling();
QDomElement elem = node.toElement();
while (!elem.isNull()) {
QString tag = elem.tagName();
if (UMLDoc::tagEq(tag, QLatin1String("name"))) {
m_name = elem.attribute(QLatin1String("xmi.value"));
if (m_name.isEmpty())
m_name = elem.text();
} else if (UMLDoc::tagEq(tag, QLatin1String("visibility"))) {
QString vis = elem.attribute(QLatin1String("xmi.value"));
if (vis.isEmpty())
vis = elem.text();
if (vis == QLatin1String("private") || vis == QLatin1String("private_vis"))
m_visibility = Uml::Visibility::Private;
else if (vis == QLatin1String("protected") || vis == QLatin1String("protected_vis"))
m_visibility = Uml::Visibility::Protected;
else if (vis == QLatin1String("implementation"))
m_visibility = Uml::Visibility::Implementation;
} else if (UMLDoc::tagEq(tag, QLatin1String("isAbstract"))) {
QString isAbstract = elem.attribute(QLatin1String("xmi.value"));
if (isAbstract.isEmpty())
isAbstract = elem.text();
m_bAbstract = (isAbstract == QLatin1String("true"));
} else if (UMLDoc::tagEq(tag, QLatin1String("ownerScope"))) {
QString ownerScope = elem.attribute(QLatin1String("xmi.value"));
if (ownerScope.isEmpty())
ownerScope = elem.text();
m_bStatic = (ownerScope == QLatin1String("classifier"));
} else {
loadStereotype(elem);
}
node = node.nextSibling();
if (node.isComment())
node = node.nextSibling();
elem = node.toElement();
}
}
// Operations, attributes, enum literals, templates, stereotypes,
// and association role objects get added and signaled elsewhere.
if (m_BaseType != ot_Operation && m_BaseType != ot_Attribute &&
m_BaseType != ot_EnumLiteral && m_BaseType != ot_EntityAttribute &&
m_BaseType != ot_Template && m_BaseType != ot_Stereotype &&
m_BaseType != ot_Role && m_BaseType != ot_UniqueConstraint &&
m_BaseType != ot_ForeignKeyConstraint && m_BaseType != ot_CheckConstraint) {
if (m_pUMLPackage) {
m_pUMLPackage->addObject(this);
} else if (umldoc->rootFolderType(this) == Uml::ModelType::N_MODELTYPES) {
// m_pUMLPackage is not set on the root folders.
uDebug() << m_name << ": m_pUMLPackage is not set";
}
}
return load(element);
}