本文整理汇总了C++中QXmlAttributes::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlAttributes::value方法的具体用法?C++ QXmlAttributes::value怎么用?C++ QXmlAttributes::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlAttributes
的用法示例。
在下文中一共展示了QXmlAttributes::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
{
if(depth == 0) {
Parser::Event *e = new Parser::Event;
QXmlAttributes a;
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
if(a.index(uri, ln) == -1)
a.append(atts.qName(n), uri, ln, atts.value(n));
}
e->setDocumentOpen(namespaceURI, localName, qName, a, nsnames, nsvalues);
nsnames.clear();
nsvalues.clear();
e->setActualString(in->lastString());
in->resetLastData();
eventList.append(e);
in->pause(true);
}
else {
QDomElement e = doc->createElementNS(namespaceURI, qName);
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
bool have;
if(!uri.isEmpty()) {
have = e.hasAttributeNS(uri, ln);
if(qt_bug_have)
have = !have;
}
else
have = e.hasAttribute(ln);
if(!have)
e.setAttributeNS(uri, atts.qName(n), atts.value(n));
}
if(depth == 1) {
elem = e;
current = e;
}
else {
current.appendChild(e);
current = e;
}
}
++depth;
return true;
}
示例2: startElement
bool nftrcreader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
if (name == "name")
inName = true;
else if (name == "file")
inFile = true;
else if (name == "tnail")
inTNail = true;
else if (name == "img")
inImg = true;
else if (name == "psize")
inPSize = true;
else if (name == "color")
inColor = true;
else if (name == "descr")
inDescr = true;
else if (name == "usage")
inUsage = true;
else if (name == "scribus_version")
inScribusVersion = true;
else if (name == "date")
inDate = true;
else if (name == "author")
inAuthor = true;
else if (name == "email")
inEmail = true;
if (name == "template") { // new template starts here
inTemplate = true;
QString category;
QString enCat;
for (int i = 0; i < attrs.count(); i++)
{
if (attrs.localName(i) == "category")
{
category = getCategory(attrs.value(i));
enCat = attrs.value(i);
}
}
tmpTemplate = new nfttemplate(new QFile(currentFile), category); // create a new template
tmpTemplate->enCategory = enCat;
}
if (name == "settings")
inSettings = true;
return true;
}
示例3: startRef
void LinkedTextHandler::startRef(const QXmlAttributes& attrib)
{
if (!m_curString.isEmpty())
{
m_children.append(new LT_Text(m_curString));
debug(2,"LinkedTextHandler: add text `%s'\n",m_curString.data());
m_curString="";
}
ASSERT(m_ref==0);
m_ref = new LT_Ref;
m_ref->setRefId(attrib.value("refid"));
m_ref->setExtId(attrib.value("external"));
ASSERT(attrib.value("kindref")=="compound" || attrib.value("kindref")=="member");
m_ref->setTargetKind(attrib.value("kindref")=="compound" ? ILT_Ref::Compound : ILT_Ref::Member);
}
示例4: startElement
bool CGrammtabHandler::startElement(const QString& /*namespaceURI*/,
const QString& /*localName*/,
const QString& qName,
const QXmlAttributes& atts)
{
if (qName == "PoS")
{
currentItem = gramTab->AddPart(atts.value("id").toInt(), atts.value("short"));
}
else if (qName == "grammem")
{
currentItem = gramTab->AddGrammem(atts.value("id").toInt(), atts.value("short"));
}
return true;
}
示例5: startElement
bool UiHandler::startElement( const QString& /* namespaceURI */,
const QString& /* localName */,
const QString& qName,
const QXmlAttributes& atts )
{
if ( qName == QString("item") ) {
flush();
if ( !atts.value(QString("text")).isEmpty() )
source = atts.value( QString("text") );
} else if ( qName == QString("string") ) {
flush();
}
accum.truncate( 0 );
return TRUE;
}
示例6: startTag
bool ListParser::startTag(const QString &tag, const QXmlAttributes &atts)
{
if (root() == "list") {
if (tag == "options") {
k->pattern = atts.value("pattern");
k->type = atts.value("type").toInt();
} else if (tag == "caseSensitive") {
k->caseSensitive = bool(atts.value("enabled").toInt());
} else if (tag == "regexp") {
k->regexp = bool(atts.value("enabled").toInt());
}
}
return true;
}
示例7: startInclude
void IncludeHandler::startInclude(const QXmlAttributes &attrib)
{
m_curString = "";
m_refId = attrib.value("refid");
m_isLocal = attrib.value("local")=="yes";
m_parent->setDelegate(this);
}
示例8: xml_start
bool Button::xml_start(const QString & qName, const QXmlAttributes & atts)
{
//printf("Procesando botón %s\n",qName.toLocal8Bit().data() );
//mButton *w=(mButton *)widget;
if(qName=="button" && check_id(atts) )
{
//QString icon=atts.value("icon");
//if(!title.isEmpty()) widget->setWindowTitle ( atts.value("title") );
widget_properties(atts,this);
return true;
}
else if(qName=="text")
{
return true;
}
else if(qName=="icon")
{
return true;
}
else if(qName=="signal")
{
QString signal=atts.value("name");
if(signal=="clicked")
QObject::connect((mButton*)widget, SIGNAL(clicked()), (mButton*)widget, SLOT(clicked_cb()) );
return true;
}
return false;
}
示例9: startElement
bool SimpleXMLHandler::startElement(const QString &namespaceURI, const QString &localName,
const QString &qName, const QXmlAttributes &attributes)
{
// maybe check for double opening lines?
//qDebug("lol");
if (qName == "LINES") {
bool ok1 = true, ok2 = true;
row = 0;
readingCards = true;
properties.resize(attributes.value("ColCount").toInt(&ok1));
// cards.resize(attributes.value("RowCount").toInt(&ok2) - 1);
if (!ok1 || !ok2 ) {
errorStr = "Can't convert string to double.";
return false;
}
} else if (!readingCards) {
return true;
} else if (qName == "LINE") {
column = 0;
currentCard = Card();
} else if (qName == "CELL") {
currentText.clear();
}
return true;
}
示例10: startElement
bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts )
{
// Some Parent Elements have special meanings
if ( stack.isEmpty() )
{
if ( qName == "definitions" )
return true;
// Include another file
if ( qName == "include" )
{
QString value = atts.value( "file" );
impl->imports.push_back( value );
return true;
}
}
cElement* element = new cElement;
element->setName( localName.latin1() );
element->copyAttributes( atts );
// Child Element ?
if ( stack.count() > 0 )
{
cElement* parent = stack.current(); // Pop the potential parent
parent->addChild( element ); // Add the child to it's parent
element->setParent( parent );
}
stack.push( element ); // Push our element (there may be children)
return true;
}
示例11: kWarning
bool KWord13Parser::startElementLayout(const QString&, const QXmlAttributes& attributes, KWord13StackItem *stackItem)
{
// ### TODO: check parent?
if (stackItem->elementType == KWord13TypeIgnore) {
return true;
}
stackItem->elementType = KWord13TypeLayout;
if (m_currentFormat) {
kWarning(30520) << "Current format defined! (Layout)";
delete m_currentFormat;
m_currentFormat = 0;
}
if (m_currentLayout) {
// Delete an eventually already existing paragraph (should not happen)
kWarning(30520) << "Current layout already defined!";
delete m_currentLayout;
}
m_currentLayout = new KWord13Layout;
m_currentLayout->m_outline = (attributes.value("outline") == "true");
return true;
}
示例12: startElement
bool QphHandler::startElement(const QString & /* namespaceURI */,
const QString & /* localName */,
const QString &qName,
const QXmlAttributes &atts)
{
if (qName == QLatin1String("QPH")) {
m_language = atts.value(QLatin1String("language"));
m_sourceLanguage = atts.value(QLatin1String("sourcelanguage"));
} else if (qName == QLatin1String("phrase")) {
source.truncate(0);
target.truncate(0);
definition.truncate(0);
}
accum.truncate(0);
return true;
}
示例13: startElement
bool Handler::startElement(const QString &, const QString &,
const QString & qName, const QXmlAttributes &attr)
{
if (qName == "item") {
if (inItem)
return false;
else {
inItem = true;
linkString = attr.value("rdf:about");
}
}
else if (qName == "title") {
if (inTitle)
return false;
else if (!titleString.isEmpty())
return false;
else if (inItem)
inTitle = true;
}
else if (qName == "link") {
if (inLink)
return false;
else if (inItem)
inLink = true;
}
return true;
}
示例14: if
static bool encodingIsUtf8( const QXmlAttributes& atts )
{
for ( int i = 0; i < atts.length(); i++ )
{
// utf8="true" is a pre-3.0 syntax
if ( atts.qName( i ) == QString( "utf8" ) )
{
return ( atts.value( i ) == QString( "true" ) );
}
else if ( atts.qName( i ) == QString( "encoding" ) )
{
return ( atts.value( i ) == QString( "UTF-8" ) );
}
}
return FALSE;
}
示例15: startElement
bool TemplateQueryHandler::startElement ( const QString & /*namespaceURI*/, const QString & /*localName*/, const QString & qName, const QXmlAttributes & atts )
{
//qDebug() << "startElement: " << qName;
if(!m_inTripleList && (qName.compare("triple_list")==0 ))
{
m_inTripleList = true;
return true;
}
if(m_currentTriple)
{
if(qName.compare("subject") == 0 )
{
// no need to check for element type, since subject are always URIs (when received)
m_component = ESubject;
}
else if(qName.compare("predicate") == 0 )
{
// no need to check for element type, since predicates are always URIs
m_component = EPredicate;
}
else if(qName.compare("object") == 0 &&
(atts.length() == 1) &&
(atts.qName(0).compare("type") == 0))
{
//check elementtype for object, bNode is illegal when received.
QString attrvalue = atts.value(0);
m_component = EObject;
if( attrvalue.compare("literal", Qt::CaseInsensitive) == 0)
m_elementType = TripleElement::ElementTypeLiteral;
else if (attrvalue.compare("URI", Qt::CaseInsensitive) == 0)
m_elementType = TripleElement::ElementTypeURI;
else
{
m_errorString = "Invalid object type: ";
m_errorString.append(attrvalue);
return false;
}
m_component = EObject;
}
else
{
m_errorString = "Invalid element name for a triple: ";
m_errorString.append(qName);
return false;
}
}
else
{
if(qName.compare("triple") == 0 )
{
m_currentTriple = new Triple();
}
else
{
m_errorString = "starting something other than triple element";
return false;
}
}
return true;
}