本文整理汇总了C++中XmlWriter类的典型用法代码示例。如果您正苦于以下问题:C++ XmlWriter类的具体用法?C++ XmlWriter怎么用?C++ XmlWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void RawStruct<RPG::TreeMap>::WriteXml(const RPG::TreeMap& ref, XmlWriter& stream) {
stream.BeginElement("TreeMap");
stream.BeginElement("maps");
Struct<RPG::MapInfo>::WriteXml(ref.maps, stream);
stream.EndElement("maps");
stream.BeginElement("tree_order");
stream.Write<std::vector<int> >(ref.tree_order);
stream.EndElement("tree_order");
stream.WriteNode<int>("active_node", ref.active_node);
stream.BeginElement("start");
Struct<RPG::Start>::WriteXml(ref.start, stream);
stream.EndElement("start");
stream.EndElement("TreeMap");
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例2: writePalettes
void writePalettes(XmlWriter& xml, const NamedList<PaletteInput>& palettes)
{
for (const auto& p : palettes) {
xml.writeTag("palette");
xml.writeTagAttribute("name", p.name);
xml.writeTagAttributeFilename("image", p.paletteImageFilename);
xml.writeTagAttribute("rows-per-frame", p.rowsPerFrame);
xml.writeTagAttribute("skip-first", p.skipFirstFrame);
if (p.animationDelay > 0) {
xml.writeTagAttribute("animation-delay", p.animationDelay);
}
xml.writeCloseTag();
}
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:16,代码来源:resources-serializer.cpp
示例3: write
void Glissando::write(XmlWriter& xml) const
{
if (!xml.canWrite(this))
return;
xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(xml.spannerId(this)));
if (_showText && !_text.isEmpty())
xml.tag("text", _text);
xml.tag("subtype", int(_glissandoType));
writeProperty(xml, P_ID::PLAY);
writeProperty(xml, P_ID::GLISSANDO_STYLE);
SLine::writeProperties(xml);
xml.etag();
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例4: writeSurface
/** writes a surface value.
*/
void iom_file::writeSurface(XmlWriter &out, IomObject &obj)
{
/*
object: MULTISURFACE [INCOMPLETE]
surface // if incomplete; multi surface values
object: SURFACE
boundary
object: BOUNDARY
polyline
object: POLYLINE
<SURFACE>
<BOUNDARY>
<POLYLINE .../>
<POLYLINE .../>
</BOUNDARY>
<BOUNDARY>
<POLYLINE .../>
<POLYLINE .../>
</BOUNDARY>
</SURFACE>
*/
out.startElement(tags::get_SURFACE(),0,0);
bool clipped=obj->getConsistency()==IOM_INCOMPLETE;
for(int surfacei=0;surfacei<obj->getAttrValueCount(tags::get_surface());surfacei++){
if(clipped){
out.startElement(tags::get_CLIPPED(),0,0);
}else{
// an unclipped surface should have only one surface element
if(surfacei>0){
iom_issueerr("unclipped surface with multi 'surface' elements");
break;
}
}
IomObject surface=obj->getAttrObj(tags::get_surface(),surfacei);
for(int boundaryi=0;boundaryi<surface->getAttrValueCount(tags::get_boundary());boundaryi++){
IomObject boundary=surface->getAttrObj(tags::get_boundary(),boundaryi);
out.startElement(tags::get_BOUNDARY(),0,0);
for(int polylinei=0;polylinei<boundary->getAttrValueCount(tags::get_polyline());polylinei++){
IomObject polyline=boundary->getAttrObj(tags::get_polyline(),polylinei);
writePolyline(out,polyline,true);
}
out.endElement(/*BOUNDARY*/);
}
if(clipped){
out.endElement(/*CLIPPED*/);
}
}
out.endElement(/*SURFACE*/);
}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:53,代码来源:writer.cpp
示例5: writeXmlTestCase
void writeXmlTestCase(XmlWriter& writer, const Test& test)
{
writer.beginElement("testcase");
writer.attribute("name", test.name());
if (test.assertions() != 0)
{
writer.attribute("assertions", (int64_t)test.assertions());
writer.attribute("name", "NONE");
writer.attribute("time", test.elapsedTime());
auto& errors = test.errors();
for (auto it = begin(errors); it != end(errors); ++it)
writeXmlError(writer, *it);
}
writer.endElement();
}
开发者ID:jebreimo,项目名称:JEBTest,代码行数:15,代码来源:JUnitReport.cpp
示例6: write
void StaffTextBase::write(XmlWriter& xml) const
{
if (!xml.canWrite(this))
return;
xml.stag(this);
for (ChannelActions s : _channelActions) {
int channel = s.channel;
for (QString name : s.midiActionNames)
xml.tagE(QString("MidiAction channel=\"%1\" name=\"%2\"").arg(channel).arg(name));
}
for (int voice = 0; voice < VOICES; ++voice) {
if (!_channelNames[voice].isEmpty())
xml.tagE(QString("channelSwitch voice=\"%1\" name=\"%2\"").arg(voice).arg(_channelNames[voice]));
}
if (_setAeolusStops) {
for (int i = 0; i < 4; ++i)
xml.tag(QString("aeolus group=\"%1\"").arg(i), aeolusStops[i]);
}
if (swing()) {
QString swingUnit;
if (swingParameters()->swingUnit == MScore::division / 2)
swingUnit = TDuration(TDuration::DurationType::V_EIGHTH).name();
else if (swingParameters()->swingUnit == MScore::division / 4)
swingUnit = TDuration(TDuration::DurationType::V_16TH).name();
else
swingUnit = TDuration(TDuration::DurationType::V_ZERO).name();
int swingRatio = swingParameters()->swingRatio;
xml.tagE(QString("swing unit=\"%1\" ratio= \"%2\"").arg(swingUnit).arg(swingRatio));
}
if (capo() != 0)
xml.tagE(QString("capo fretId=\"%1\"").arg(capo()));
TextBase::writeProperties(xml);
xml.etag();
}
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:36,代码来源:stafftextbase.cpp
示例7: OutputTestCases
void OutputTestCases( XmlWriter& xml, const Stats& stats ) {
std::vector<TestCaseStats>::const_iterator it = stats.m_testCaseStats.begin();
std::vector<TestCaseStats>::const_iterator itEnd = stats.m_testCaseStats.end();
for(; it != itEnd; ++it ) {
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
xml.writeAttribute( "classname", it->m_className );
xml.writeAttribute( "name", it->m_name );
xml.writeAttribute( "time", "tbd" );
OutputTestResult( xml, *it );
std::string stdOut = trim( it->m_stdOut );
if( !stdOut.empty() )
xml.scopedElement( "system-out" ).writeText( stdOut, false );
std::string stdErr = trim( it->m_stdErr );
if( !stdErr.empty() )
xml.scopedElement( "system-err" ).writeText( stdErr, false );
}
}
开发者ID:NonSleep,项目名称:Catch,代码行数:20,代码来源:catch_reporter_junit.hpp
示例8: writeMenuBar
void Workspace::writeMenuBar(XmlWriter& xml, QMenuBar* mb)
{
// Loop through each menu in menubar. For each menu, call writeMenu.
xml.stag("MenuBar");
if (!mb)
mb = mscore->menuBar();
for (QAction* action : mb->actions()) {
if (action->isSeparator())
xml.tag("action", "");
else if (action->menu()) {
xml.stag("Menu name=\"" + findStringFromMenu(action->menu()) + "\"");
writeMenu(xml, action->menu());
xml.etag();
}
else
xml.tag("action", findStringFromAction(action));
}
xml.etag();
}
开发者ID:salewski,项目名称:MuseScore,代码行数:20,代码来源:workspace.cpp
示例9: write
void TimeSig::write(XmlWriter& xml) const
{
xml.stag("TimeSig");
writeProperty(xml, P_ID::TIMESIG_TYPE);
Element::writeProperties(xml);
xml.tag("sigN", _sig.numerator());
xml.tag("sigD", _sig.denominator());
if (stretch() != Fraction(1,1)) {
xml.tag("stretchN", stretch().numerator());
xml.tag("stretchD", stretch().denominator());
}
writeProperty(xml, P_ID::NUMERATOR_STRING);
writeProperty(xml, P_ID::DENOMINATOR_STRING);
if (!_groups.empty())
_groups.write(xml);
writeProperty(xml, P_ID::SHOW_COURTESY);
writeProperty(xml, P_ID::SCALE);
xml.etag();
}
开发者ID:akdor1154,项目名称:MuseScore,代码行数:21,代码来源:timesig.cpp
示例10: write
void MidiCoreEvent::write(XmlWriter& xml) const
{
switch(_type) {
case ME_NOTEON:
xml.tagE(QString("note-on channel=\"%1\" pitch=\"%2\" velo=\"%3\"")
.arg(_channel).arg(_a).arg(_b));
break;
case ME_NOTEOFF:
xml.tagE(QString("note-off channel=\"%1\" pitch=\"%2\" velo=\"%3\"")
.arg(_channel).arg(_a).arg(_b));
break;
case ME_CONTROLLER:
if (_a == CTRL_PROGRAM) {
if (_channel == 0) {
xml.tagE(QString("program value=\"%1\"").arg(_b));
}
else {
xml.tagE(QString("program channel=\"%1\" value=\"%2\"")
.arg(channel()).arg(_b));
}
}
else {
if (channel() == 0) {
xml.tagE(QString("controller ctrl=\"%1\" value=\"%2\"")
.arg(_a).arg(_b));
}
else {
xml.tagE(QString("controller channel=\"%1\" ctrl=\"%2\" value=\"%3\"")
.arg(channel()).arg(_a).arg(_b));
}
}
break;
default:
qDebug("MidiCoreEvent::write: unknown type");
break;
}
}
开发者ID:MarcSabatella,项目名称:MuseScore,代码行数:39,代码来源:event.cpp
示例11: writeXmlError
void writeXmlError(XmlWriter& writer, const Error& error)
{
if (error.type() == Error::UnhandledException)
writer.beginElement("error");
else
writer.beginElement("failure");
writer.attribute("message", error.message());
writer.attribute("type", Error::levelName(error.type()));
writer.characterData(error.file());
writer.characterData("[");
writer.characterData((int)error.lineNo());
writer.characterData("]");
auto& context = error.context();
for (auto c = begin(context); c != end(context); ++c)
{
writer.characterData("\n");
writer.characterData(c->text());
}
writer.endElement();
}
开发者ID:jebreimo,项目名称:JEBTest,代码行数:20,代码来源:JUnitReport.cpp
示例12: writeFlagsOn
void LightReaderWriter::writeFlagsOn(std::shared_ptr<XmlChunk> lightChunk, const Light *light, XmlWriter &xmlWriter) const
{
std::shared_ptr<XmlChunk> produceShadowChunk = xmlWriter.createChunk(PRODUCE_SHADOW_TAG, XmlAttribute(), lightChunk);
produceShadowChunk->setBoolValue(light->isProduceShadow());
}
开发者ID:ServerGame,项目名称:UrchinEngine,代码行数:5,代码来源:LightReaderWriter.cpp
示例13: write
void Page::write(XmlWriter& xml) const
{
xml.stag("Page");
foreach(System* system, _systems) {
system->write(xml);
}
开发者ID:CombatCube,项目名称:MuseScore,代码行数:6,代码来源:page.cpp
示例14: write
void Ambitus::write(XmlWriter& xml) const
{
xml.stag(this);
xml.tag(Pid::HEAD_GROUP, int(_noteHeadGroup), int(NOTEHEADGROUP_DEFAULT));
xml.tag(Pid::HEAD_TYPE, int(_noteHeadType), int(NOTEHEADTYPE_DEFAULT));
xml.tag(Pid::MIRROR_HEAD,int(_dir), int(DIR_DEFAULT));
xml.tag("hasLine", _hasLine, true);
xml.tag(Pid::LINE_WIDTH, _lineWidth, LINEWIDTH_DEFAULT);
xml.tag("topPitch", _topPitch);
xml.tag("topTpc", _topTpc);
xml.tag("bottomPitch",_bottomPitch);
xml.tag("bottomTpc", _bottomTpc);
if (_topAccid.accidentalType() != AccidentalType::NONE) {
xml.stag("topAccidental");
_topAccid.write(xml);
xml.etag();
}
if (_bottomAccid.accidentalType() != AccidentalType::NONE) {
xml.stag("bottomAccidental");
_bottomAccid.write(xml);
xml.etag();
}
Element::writeProperties(xml);
xml.etag();
}
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:25,代码来源:ambitus.cpp
示例15: writePropertiesOn
void LightReaderWriter::writePropertiesOn(std::shared_ptr<XmlChunk> lightChunk, const Light *light, XmlWriter &xmlWriter) const
{
std::shared_ptr<XmlChunk> ambientColorChunk = xmlWriter.createChunk(AMBIENT_COLOR_TAG, XmlAttribute(), lightChunk);
ambientColorChunk->setPoint3Value(light->getAmbientColor());
}
开发者ID:ServerGame,项目名称:UrchinEngine,代码行数:5,代码来源:LightReaderWriter.cpp
示例16: createDatabase
//////////////////////////////////////////////////////////////////////////////////////////
///Creates the XML database file from a set of filepaths and returns number of new paths
int FileSniffer::createDatabase(std::set<std::string>& filelist)
{
int count=0;
try{
XmlWriter writer; //create new xml
writer.addDeclaration();
writer.start("filelist");
newfilesList.clear();
for (std::set<std::string>::iterator it=filelist.begin(); it != filelist.end(); it++) //add all paths in fileset to the xml
{
if(!isInExcluded(*it))
{
count++;
XmlWriter childnode;
childnode.start("filepath"); //add filepath tag for each path
childnode.addBody(*it); //add path
childnode.end(); //add ending tag
writer.addBody(childnode.xml());
newfilesList.insert(*it);
}
}
writer.end();
std::ofstream myfile; //create new file and write the xml in it
myfile.open (databaseFilePath.c_str());
myfile << writer.xml();
myfile.close();
StoreResult();
}
catch(std::exception ex)
{
std::cout << "\n " << ex.what() << "\n\n";
}
return count;
}
开发者ID:ayelkawar2,项目名称:HTML5basedCrossPlatformSniffer,代码行数:36,代码来源:Filesniffer.cpp
示例17: to_string
void MALItem::serialize(XmlWriter& writer) const
{
writer.startElement("MALitem");
writer.writeAttribute("version", "1");
using std::to_string;
writer.writeElement("series_itemdb_id", to_string(series_itemdb_id));
writer.writeElement("series_title", series_title);
writer.writeElement("series_preferred_title", series_preferred_title);
writer.writeElement("series_date_begin", series_date_begin);
writer.writeElement("series_date_end", series_date_end);
writer.writeElement("image_url", image_url);
writer.startElement("series_synonyms");
std::for_each(std::begin(series_synonyms), std::end(series_synonyms),
std::bind(&XmlWriter::writeElement,
std::ref(writer),
"series_synonym",
std::placeholders::_1));
writer.endElement();
writer.writeElement("series_synopsis", series_synopsis );
writer.startElement("tags");
std::for_each(std::begin(tags), std::end(tags),
std::bind(&XmlWriter::writeElement,
std::ref(writer),
"tag",
std::placeholders::_1));
writer.endElement();
writer.writeElement("date_start", date_start);
writer.writeElement("date_finish", date_finish);
writer.writeElement("id", to_string(id));
writer.writeElement("last_updated", to_string(last_updated));
writer.writeElement("score", to_string(score));
writer.writeElement("enable_reconsuming", to_string(enable_reconsuming));
writer.writeElement("fansub_group", fansub_group);
writer.writeElement("comments", comments);
writer.writeElement("downloaded_items", to_string(downloaded_items));
writer.writeElement("times_consumed", to_string(times_consumed));
writer.writeElement("reconsume_value", to_string(reconsume_value));
writer.writeElement("priority", to_string(priority));
writer.writeElement("enable_discussion", to_string(enable_discussion));
writer.writeElement("has_details", to_string(has_details));
writer.endElement();
}
开发者ID:,项目名称:,代码行数:47,代码来源:
示例18: writeSection
//! \internal
void XmlPreferencesPrivate::writeSection(XmlWriter& out, const QString& name, const Section& section)
{
QHash<QString,QString> attrs;
attrs.insert("name", name);
out.writeOpenTag("section", attrs);
attrs.clear();
for (Section::ConstIterator sectionIterator = section.constBegin();
sectionIterator != section.constEnd(); ++sectionIterator)
{
const EncVariant& v = sectionIterator.value();
attrs.insert("name", sectionIterator.key());
switch (v.data.type())
{
case QVariant::String :
attrs.insert("type", "string");
out.writeTaggedString("setting", v.data.toString(), attrs);
break;
case QVariant::StringList :
{
attrs.insert("type", "stringlist");
out.writeOpenTag("setting", attrs);
attrs.clear();
QStringList list = v.data.toStringList();
for (int i = 0; i < list.size(); ++i)
out.writeTaggedString("value", list.at(i), attrs);
out.writeCloseTag("setting");
}
break;
case QVariant::Bool :
attrs.insert("type", "bool");
out.writeTaggedString("setting", v.data.toBool() ? "true" : "false", attrs);
break;
case QVariant::Int :
attrs.insert("type", "int");
out.writeTaggedString("setting", QString::number(v.data.toInt()), attrs);
break;
case QVariant::LongLong :
attrs.insert("type", "int64");
out.writeTaggedString("setting", QString::number(v.data.toLongLong()), attrs);
break;
case QVariant::Rect :
{
attrs.insert("type", "rect");
QRect rect = v.data.toRect();
QString s = QString("%1;%2;%3;%4").arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
out.writeTaggedString("setting", s, attrs);
}
break;
case QVariant::Point :
{
attrs.insert("type", "point");
QPoint point = v.data.toPoint();
QString s = QString("%1;%2").arg(point.x()).arg(point.y());
out.writeTaggedString("setting", s, attrs);
}
break;
case QVariant::Size :
{
attrs.insert("type", "size");
QSize size = v.data.toSize();
QString s = QString("%1;%2").arg(size.width()).arg(size.height());
out.writeTaggedString("setting", s, attrs);
}
break;
case QVariant::ByteArray :
{
attrs.insert("type", "bytearray");
const QByteArray ba = v.data.toByteArray();
switch (v.encoding)
{
case XmlPreferences::Base64:
attrs.insert("encoding", "base64");
out.writeTaggedString("setting", Base64::encode(ba), attrs);
break;
default:
attrs.insert("encoding", "csv");
QString s;
for (uint i = 0; i < (uint) ba.size(); ++i)
(i != 0) ? s += "," + QString::number((uint)ba.at(i), 16) : s += QString::number((uint)ba.at(i), 16);
out.writeTaggedString("setting", s, attrs);
}
attrs.clear();
}
break;
case QVariant::BitArray :
{
attrs.insert("type", "bitarray");
const QBitArray ba = v.data.toBitArray();
attrs.insert("size", QString::number(ba.size()));
switch (v.encoding)
{
case XmlPreferences::Base64:
attrs.insert("encoding", "base64");
out.writeTaggedString("setting", Base64::encode(ba), attrs);
break;
//.........这里部分代码省略.........
开发者ID:hippydream,项目名称:osdab,代码行数:101,代码来源:xmlpreferences.cpp
示例19: main
void main()
{
//mOut("Testing XmlWriter");
//mOut("=================");
//mOut("creating XML writer object:");
XmlWriter wtr;
//mOut("adding XML declaration:");
wtr.addDeclaration();
//mOut(wtr.xml());
//mOut("adding comment:");
wtr.addComment("top level comment");
//mOut(wtr.xml());
//mOut("adding root element:");
wtr.start("root");
//mOut(wtr.xml());
//mOut("adding attributes:");
wtr.addAttribute("att1","val1");
wtr.addAttribute("att2","val2");
//mOut(wtr.xml());
//mOut("adding comment:");
wtr.addComment("comment in root's body");
//mOut(wtr.xml());
//mOut("Creating self-closing element:");
XmlWriter sub1;
sub1.start("child1 /");
// mOut(sub1.xml());
//mOut("adding attribute:");
sub1.addAttribute("c1name","c1value");
XmlWriter subsub1;
subsub1.start("grand");
subsub1.addBody("test grandchild");
subsub1.end();
sub1.addBody(subsub1.xml());
//mOut(sub1.xml());
//mOut("adding child to root's body:");
wtr.addBody(sub1.xml());
//mOut(wtr.xml());
//mOut("adding another comment");
wtr.addComment("another root's body comment");
//mOut(wtr.xml());
//mOut("adding string to root's body:");
wtr.addBody("root's body");
//mOut(wtr.xml());
//mOut("closing root element:\n");
wtr.end();
mOut(wtr.xml());
mOut("\n writing XML to file \"Test.xml\":");
std::ofstream out("test.xml");
if(out.good())
{
out << wtr.xml().c_str();
out.close();
}
std::cout << std::endl;
/* mOut("creating composite element:");
XmlWriter cwtr, bcwtr1, bcwtr2;
std::string temp =
bcwtr1.element("child1","child1's body")
.element("child2","child2's body").xml();
std::cout << "\n " << bcwtr1.xml();
bcwtr1.clear();
std::cout << "\n " <<
cwtr.start("parent")
.addBody(bcwtr1.element("child1","child1's body").xml())
.addBody(bcwtr2.element("child2","body2").xml())
.end().xml();
std::cout << "\n\n";*/
}
开发者ID:newton449,项目名称:virtual-server,代码行数:86,代码来源:XmlWriter.cpp
示例20: writeProperty
void ScoreElement::writeProperty(XmlWriter& xml, P_ID id) const
{
xml.tag(id, getProperty(id), propertyDefault(id));
}
开发者ID:,项目名称:,代码行数:4,代码来源:
注:本文中的XmlWriter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论