当前位置: 首页>>代码示例>>C++>>正文


C++ XmlWriter::tag方法代码示例

本文整理汇总了C++中XmlWriter::tag方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlWriter::tag方法的具体用法?C++ XmlWriter::tag怎么用?C++ XmlWriter::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlWriter的用法示例。


在下文中一共展示了XmlWriter::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

void PageFormat::write(XmlWriter& xml) const
      {
      xml.stag("page-layout");

      // convert inch to 1/10 spatium units
      // 20 - font design size in point
      // SPATIUM = 20/4
      // qreal t = 10 * PPI / (20 / 4);
      qreal t = 2 * PPI;

      xml.tag("page-height", _size.height() * t);
      xml.tag("page-width",  _size.width() * t);

      const char* type = "both";
      if (_twosided) {
            type = "even";
            xml.stag(QString("page-margins type=\"%1\"").arg(type));
            xml.tag("left-margin",   evenLeftMargin() * t);
            xml.tag("right-margin",  evenRightMargin() * t);
            xml.tag("top-margin",    evenTopMargin() * t);
            xml.tag("bottom-margin", evenBottomMargin() * t);
            xml.etag();
            type = "odd";
            }
      xml.stag(QString("page-margins type=\"%1\"").arg(type));
      xml.tag("left-margin",   oddLeftMargin() * t);
      xml.tag("right-margin",  oddRightMargin() * t);
      xml.tag("top-margin",    oddTopMargin() * t);
      xml.tag("bottom-margin", oddBottomMargin() * t);
      xml.etag();

      xml.etag();
      }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: write

void Spacer::write(XmlWriter& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", int(_spacerType));
      Element::writeProperties(xml);
      xml.tag("space", _gap / spatium());
      xml.etag();
      }
开发者ID:AntonioBL,项目名称:MuseScore,代码行数:8,代码来源:spacer.cpp

示例3: write

void Image::write(XmlWriter& xml) const
      {
      // attempt to convert the _linkPath to a path relative to the score
      //
      // TODO : on Save As, score()->fileInfo() still contains the old path and fname
      //          if the Save As path is different, image relative path will be wrong!
      //
      QString relativeFilePath= QString();
      if (!_linkPath.isEmpty() && _linkIsValid) {
            QFileInfo fi(_linkPath);
            // score()->fileInfo()->canonicalPath() would be better
            // but we are saving under a temp file name and the 'final' file
            // might not exist yet, so canonicalFilePath() may return only "/"
            // OTOH, the score 'final' file name is practically always canonical, at this point
            QString scorePath = score()->masterScore()->fileInfo()->absolutePath();
            QString imgFPath  = fi.canonicalFilePath();
            // if imgFPath is in (or below) the directory of scorePath
            if (imgFPath.startsWith(scorePath, Qt::CaseSensitive)) {
                  // relative img path is the part exceeding scorePath
                  imgFPath.remove(0, scorePath.size());
                  if(imgFPath.startsWith('/'))
                        imgFPath.remove(0, 1);
                  relativeFilePath = imgFPath;
                  }
            // try 1 level up
            else {
                  // reduce scorePath by one path level
                  fi.setFile(scorePath);
                  scorePath = fi.path();
                  // if imgFPath is in (or below) the directory up the score directory
                  if (imgFPath.startsWith(scorePath, Qt::CaseSensitive)) {
                        // relative img path is the part exceeding new scorePath plus "../"
                        imgFPath.remove(0, scorePath.size());
                        if (!imgFPath.startsWith('/'))
                              imgFPath.prepend('/');
                        imgFPath.prepend("..");
                        relativeFilePath = imgFPath;
                        }
                  }
            }
      // if no match, use full _linkPath
      if (relativeFilePath.isEmpty())
            relativeFilePath = _linkPath;

      xml.stag(this);
      BSymbol::writeProperties(xml);
      // keep old "path" tag, for backward compatibility and because it is used elsewhere
      // (for instance by Box:read(), Measure:read(), Note:read(), ...)
      xml.tag("path", _storeItem ? _storeItem->hashName() : relativeFilePath);
      xml.tag("linkPath", relativeFilePath);

      writeProperty(xml, Pid::AUTOSCALE);
      writeProperty(xml, Pid::SIZE);
      writeProperty(xml, Pid::LOCK_ASPECT_RATIO);
      writeProperty(xml, Pid::SIZE_IS_SPATIUM);

      xml.etag();
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:58,代码来源:image.cpp

示例4: write

void Symbol::write(XmlWriter& xml) const
      {
      xml.stag(this);
      xml.tag("name", Sym::id2name(_sym));
      if (_scoreFont)
            xml.tag("font", _scoreFont->name());
      BSymbol::writeProperties(xml);
      xml.etag();
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:9,代码来源:symbol.cpp

示例5: write

void TempoText::write(XmlWriter& xml) const
      {
      xml.stag(name());
      xml.tag("tempo", _tempo);
      if (_followText)
            xml.tag("followText", _followText);
      TextBase::writeProperties(xml);
      xml.etag();
      }
开发者ID:Gai-Luron,项目名称:MuseScore,代码行数:9,代码来源:tempotext.cpp

示例6: write

void Jump::write(XmlWriter& xml) const
      {
      xml.stag(name());
      Text::writeProperties(xml);
      xml.tag("jumpTo", _jumpTo);
      xml.tag("playUntil", _playUntil);
      xml.tag("continueAt", _continueAt);
      writeProperty(xml, P_ID::PLAY_REPEATS);
      xml.etag();
      }
开发者ID:AntonioBL,项目名称:MuseScore,代码行数:10,代码来源:jump.cpp

示例7: writeProperty

void ScoreElement::writeProperty(XmlWriter& xml, P_ID id) const
      {
      if (propertyType(id) == P_TYPE::SP_REAL) {
            qreal _spatium = score()->spatium();
                  xml.tag(id, QVariant(getProperty(id).toReal()/_spatium),
                     QVariant(propertyDefault(id).toReal()/_spatium));
            }
      else
            xml.tag(id, getProperty(id), propertyDefault(id));
      }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: 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

示例9: write

void Part::write(XmlWriter& xml) const
      {
      xml.stag("Part");
      foreach(const Staff* staff, _staves)
            staff->write(xml);
      if (!_show)
            xml.tag("show", _show);
      xml.tag("trackName", _partName);
      instrument()->write(xml, const_cast<Part*>(this)); // Safe, we do not write anything to it
      xml.etag();
      }
开发者ID:AntonioBL,项目名称:MuseScore,代码行数:11,代码来源:part.cpp

示例10: write

void Omr::write(XmlWriter& xml) const
      {
      xml.stag("Omr");
      xml.tag("path", _path);
      xml.tag("spatium", _spatium);
      xml.tag("dpmm", _dpmm);
      for(OmrPage* page : _pages) {
            page->write(xml);
            }
      xml.etag();
      }
开发者ID:salewski,项目名称:MuseScore,代码行数:11,代码来源:omr.cpp

示例11: write

void StringData::write(XmlWriter& xml) const
      {
      xml.stag("StringData");
      xml.tag("frets", _frets);
      foreach(instrString strg, stringTable) {
            if (strg.open)
                  xml.tag("string open=\"1\"", strg.pitch);
            else
                  xml.tag("string", strg.pitch);
            }
      xml.etag();
      }
开发者ID:CammyVee,项目名称:MuseScore,代码行数:12,代码来源:stringdata.cpp

示例12: write

void Clef::write(XmlWriter& xml) const
      {
      xml.stag(name());
      if (_clefTypes._concertClef != ClefType::INVALID)
            xml.tag("concertClefType", ClefInfo::tag(_clefTypes._concertClef));
      if (_clefTypes._transposingClef != ClefType::INVALID)
            xml.tag("transposingClefType", ClefInfo::tag(_clefTypes._transposingClef));
      if (!_showCourtesy)
            xml.tag("showCourtesyClef", _showCourtesy);
      Element::writeProperties(xml);
      xml.etag();
      }
开发者ID:emeraldimp,项目名称:MuseScore,代码行数:12,代码来源:clef.cpp

示例13: write

void LayoutBreak::write(XmlWriter& xml) const
      {
      xml.stag(this);
      Element::writeProperties(xml);

      writeProperty(xml, Pid::LAYOUT_BREAK);
      writeProperty(xml, Pid::PAUSE);

      if (!_startWithLongNames)
            xml.tag("startWithLongNames", _startWithLongNames);
      if (!_startWithMeasureOne)
            xml.tag("startWithMeasureOne", _startWithMeasureOne);
      xml.etag();
      }
开发者ID:Laurelin,项目名称:MuseScore,代码行数:14,代码来源:layoutbreak.cpp

示例14: write

void StaffTextBase::write(XmlWriter& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag(name());

      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));
            }
      TextBase::writeProperties(xml);

      xml.etag();
      }
开发者ID:CombatCube,项目名称:MuseScore,代码行数:34,代码来源:stafftextbase.cpp

示例15: writeMenu

void Workspace::writeMenu(XmlWriter& xml, QMenu* menu)
      {
      // Recursively save QMenu
      for (QAction* action : menu->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));
                  }
            }
      }
开发者ID:salewski,项目名称:MuseScore,代码行数:16,代码来源:workspace.cpp


注:本文中的XmlWriter::tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。