本文整理汇总了C++中QDomNode::save方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::save方法的具体用法?C++ QDomNode::save怎么用?C++ QDomNode::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNode
的用法示例。
在下文中一共展示了QDomNode::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSource
// Helper function, get the source XML of a node.
QString XmlFunctions::getSource( const QDomNode &node, int indent )
{
QString source;
QTextStream textStream( &source, QIODevice::WriteOnly );
node.save( textStream, indent );
return source;
}
示例2: word_article_get
void BlackJackDealer::word_article_get(http_request message)
{
// message.method()
auto r_uri = message.request_uri();
uri_builder uri_b(r_uri);
string s_q = uri_b.query();
// stringstream ss;
// auto json = dictHandler->PrefixMatch();
// json.serialize(ss);
// auto str = ss.str();
UrlParameter url_par(s_q);
string s_res;
dictHandler->FindArticle(url_par.value, s_res);
cout << s_res << endl;
QString qt_str = QString::fromStdString(s_res);
QDomDocument qdoc;
qdoc.setContent(qt_str);
QDomNode child = qdoc.firstChild();
QString body_str;
QTextStream stream(&body_str);
child.save(stream, QDomNode::CDATASectionNode /* = 4 */);
s_res = body_str.toUtf8().constData();;
http_response http_resp(status_codes::OK);
// http_resp.set_body(s_res);
http_resp.set_body(s_res);
http_resp.headers().add("Access-Control-Allow-Origin", "*");
http_resp.headers().add("Content-Type","application/json");
message.reply(http_resp);
}
示例3: mystream
QMap<QString,QString> GraphicsWorkflow::extractSvgElements(const QString& xmltext) {
QDomDocument doc;
QMap<QString,QString> result;
bool isopen = doc.setContent(xmltext);
if ( !isopen) {
SafetYAWL::streamlog
<< SafetLog::Error
<< tr("Se presentó un error al tratar de extraer los elementos del archivo de flujo "
"de trabajo tipo SVG");
return result;
}
QDomNodeList list = doc.elementsByTagName("g");
for(int i = 0; i < list.count();i++) {
QString nodeid, nodetext;
QTextStream mystream(&nodetext);
QDomNode node = list.at(i);
QDomNamedNodeMap attrs = node.attributes();
nodeid = attrs.namedItem("id").nodeValue().trimmed();
if ( nodeid != "graph0") {
node.save(mystream,0);
mystream.flush();
// SafetYAWL::streamlog
// << SafetLog::Debug
// << tr("Grafico SVG nodetext numero \"%2\": \"%1\"")
// .arg(nodetext)
// .arg(i);
QString newdoc = Safet::templateSVGString1.arg(nodetext);
//result[nodeid] = localeNormalize(newdoc);
result[nodeid] = newdoc;
}
}
return result;
}
示例4: importXML
void DistroMesas::importXML(const QString val) {
QFile file ( g_confpr->value( CONF_DIR_USER ) + "distromesas_" + mainCompany()->dbName() + ".cfn" );
if (file.exists()) {
if ( !file.open ( QIODevice::ReadOnly ) ) {
return;
} // end if
QString result (file.readAll());
file.close();
QDomDocument doc ( "mydocument" );
if ( !doc.setContent ( result ) ) {
return;
} // end if
QDomElement docElem = doc.documentElement();
QDomElement principal = docElem.firstChildElement ( "BACKGROUND" );
m_background = principal.text();
principal = docElem.firstChildElement ( "ESCALA" );
g_escala = principal.text().toInt();
QDomNodeList nodos = docElem.elementsByTagName ( "MESA" );
int i = 0;
while (i < nodos.count() ) {
QDomNode ventana = nodos.item ( i++ );
QDomElement e1 = ventana.toElement(); /// try to convert the node to an element.
if ( !e1.isNull() ) { /// the node was really an element.
QString nodoText = e1.text();
/// Pasamos el XML a texto para poder procesarlo como tal.
QString result;
QTextStream stream ( &result );
ventana.save(stream,5);
Mesa *mesa = new Mesa((BtCompany *) mainCompany(), mui_widget);
mesa->importXML(result);
if (! m_listapantallas.contains(mesa->m_pantalla)) {
if (m_pantallaactual == "") {
m_pantallaactual = mesa->m_pantalla;
} // end if
m_listapantallas.append(mesa->m_pantalla);
QToolButton *but = new QToolButton(this);
but->setObjectName("p_"+mesa->m_pantalla);
but->setText(mesa->m_pantalla);
but->setMinimumHeight(42);
but->setMinimumWidth(42);
but->setCheckable(TRUE);
mui_espaciopantallas->addWidget(but);
connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla()));
} // end if
if (mesa->m_pantalla == m_pantallaactual)
mesa->show();
} // end if
} // end while
} // end if
}
示例5: save
void QDomNodeProto:: save(QTextStream& stream, int intarg, int policy) const
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
item->save(stream, intarg, (QDomNode::EncodingPolicy)policy);
}