• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Xml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: midiControllerType

void MidiController::write(int level, Xml& xml) const
{
      ControllerType t = midiControllerType(_num);
      if(t == Velo)
        return;
        
      QString type(int2ctrlType(t));

      int h = (_num >> 8) & 0x7f;
      int l = _num & 0x7f;

      QString sl;
      if (isPerNoteController())
            sl = "pitch";
      else
            sl.setNum(l);

      xml.nput(level, "<Controller name=\"%s\"", Xml::xmlString(_name).toLatin1().constData());
      if(t != Controller7)
        xml.nput(" type=\"%s\"", type.toLatin1().constData());
      
      int mn = 0;
      int mx = 0; 
      switch (t) 
      {
            case RPN:
            case NRPN:
                  xml.nput(" h=\"%d\"", h);
                  xml.nput(" l=\"%s\"", sl.toLatin1().constData());
                  mx = 127;
                  break;
            case Controller7:
                  xml.nput(" l=\"%s\"", sl.toLatin1().constData());
                  mx = 127;
                  break;
            case Controller14:
            case RPN14:
            case NRPN14:
                  xml.nput(" h=\"%d\"", h);
                  xml.nput(" l=\"%s\"", sl.toLatin1().constData());
                  mx = 16383;
                  break;
            case Pitch:
                  mn = -8192;
                  mx = 8191;
                  break;
            case PolyAftertouch:
                  mn = 0;
                  mx = 127;
                  break;
            case Aftertouch: 
                  mn = 0;
                  mx = 127;
                  break;
            case Program:
            case Velo:        // Cannot happen
                  break;
      }
      
      if(t == Program)
      {
        if(_initVal != CTRL_VAL_UNKNOWN && _initVal != 0xffffff)
          xml.nput(" init=\"0x%x\"", _initVal);
      }
      else
      {
        if(_minVal != mn)     
          xml.nput(" min=\"%d\"", _minVal);
        if(_maxVal != mx)     
          xml.nput(" max=\"%d\"", _maxVal);
        
        if(_initVal != CTRL_VAL_UNKNOWN)     
          xml.nput(" init=\"%d\"", _initVal);
      }

      if(_showInTracks != (ShowInDrum | ShowInMidi))
          xml.nput(" showType=\"%d\"", _showInTracks);
        
      xml.put(" />");
}
开发者ID:songo,项目名称:muse,代码行数:80,代码来源:midictrl.cpp


示例2: setAttr

int Msg_Define::setAttr(Xml &xml, TiXmlNode *node){
	std::string type, value, comt, sub1, sub2, key;
	std::string label = xml.get_key(node);
	if(label == "arg"){
		type = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "struct"){
		type = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "vector"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "map"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "key_type"));
		sub2 = trans_to_base_name(xml.get_attr_str(node, "type"));
		key = xml.get_attr_str(node, "key_name");
		
	}
	else if(label == "unordered_map"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "key_type"));
		sub2 = trans_to_base_name(xml.get_attr_str(node, "type"));
		key = xml.get_attr_str(node, "key_name");
	}
	value = xml.get_attr_str(node, "name");
	if((comt = xml.get_attr_str(node, "desc")) != "" )
		comt = "//" + comt;
	typeName_.push_back(type);
	subType1_.push_back(sub1);
	subType2_.push_back(sub2);
	keyName_.push_back(key);
	valueName_.push_back(value);
	comment_.push_back(comt);
	return 0;
}
开发者ID:jice1001,项目名称:struct_tool,代码行数:37,代码来源:msg_define.cpp


示例3: GetType

Format* GetType(void* file_pointer, size_t file_size, const string& filename) {
  if (depth > max_depth)
    return new Format(file_pointer, file_size);

  if (!filename.empty()) {
    size_t dot = filename.find_last_of('.');
    if (dot != string::npos) {
      string ext = filename.substr(dot + 1);
      // toupper
      for (auto& c : ext)
        c &= ~0x20;

      if (ext == "HTML" || ext == "HTM" || ext == "JS" || ext == "CSS") {
        VerbosePrint(ext, " detected.");
        return new DataURI(file_pointer, file_size);
      }
      if (ext == "VCF" || ext == "VCARD") {
        VerbosePrint(ext, " detected.");
        return new Vcf(file_pointer, file_size);
      }
      if (ext == "MHT" || ext == "MHTML" || ext == "MIM" || ext == "MIME" || ext == "EML") {
        VerbosePrint(ext, " detected.");
        return new Mime(file_pointer, file_size);
      }
    }
  }
  if (memcmp(file_pointer, Png::header_magic, sizeof(Png::header_magic)) == 0) {
    VerbosePrint("PNG detected.");
    return new Png(file_pointer, file_size);
  } else if (memcmp(file_pointer, Jpeg::header_magic, sizeof(Jpeg::header_magic)) == 0) {
    VerbosePrint("JPEG detected.");
    return new Jpeg(file_pointer, file_size);
  } else if (memcmp(file_pointer, Lua::header_magic, sizeof(Lua::header_magic)) == 0) {
    VerbosePrint("Lua detected.");
    return new Lua(file_pointer, file_size);
  } else if (memcmp(file_pointer, Zip::header_magic, sizeof(Zip::header_magic)) == 0) {
    VerbosePrint("ZIP detected.");
    return new Zip(file_pointer, file_size);
  } else if (memcmp(file_pointer, Pe::header_magic, sizeof(Pe::header_magic)) == 0) {
    VerbosePrint("PE detected.");
    return new Pe(file_pointer, file_size);
  } else if (memcmp(file_pointer, Gz::header_magic, sizeof(Gz::header_magic)) == 0) {
    VerbosePrint("GZ detected.");
    return new Gz(file_pointer, file_size);
  } else if (memcmp(file_pointer, Ico::header_magic, sizeof(Ico::header_magic)) == 0) {
    VerbosePrint("ICO detected.");
    return new Ico(file_pointer, file_size);
  } else if (memcmp(file_pointer, Dwf::header_magic, sizeof(Dwf::header_magic)) == 0) {
    VerbosePrint("DWF detected.");
    return new Dwf(file_pointer, file_size);
  } else if (memcmp(file_pointer, Gft::header_magic, sizeof(Gft::header_magic)) == 0) {
    VerbosePrint("GFT detected.");
    return new Gft(file_pointer, file_size);
  } else if (memcmp(file_pointer, Rdb::header_magic, sizeof(Rdb::header_magic)) == 0) {
    VerbosePrint("RDB detected.");
    return new Rdb(file_pointer, file_size);
  } else if (memcmp(file_pointer, Swf::header_magic, sizeof(Swf::header_magic)) == 0 ||
             memcmp(file_pointer, Swf::header_magic_deflate, sizeof(Swf::header_magic_deflate)) == 0 ||
             memcmp(file_pointer, Swf::header_magic_lzma, sizeof(Swf::header_magic_lzma)) == 0) {
    VerbosePrint("SWF detected.");
    return new Swf(file_pointer, file_size);
  } else {
    // Search for vcard magic which might not be at the very beginning.
    const string vcard_magic = "BEGIN:VCARD";
    const char* fp = static_cast<char*>(file_pointer);
    const char* search_end = fp + std::min(static_cast<size_t>(1024), file_size);
    if (std::search(fp, search_end, vcard_magic.begin(), vcard_magic.end()) < search_end) {
      VerbosePrint("VCF detected.");
      return new Vcf(file_pointer, file_size);
    }

    // tar file does not have header magic
    // ustar is optional
    {
      Tar* t = new Tar(file_pointer, file_size);
      // checking first record checksum
      if (t->IsValid()) {
        VerbosePrint("tar detected.");
        return t;
      }
      delete t;
    }

    // XML file does not have header magic
    // have to parse and see if there are any errors.
    {
      Xml* x = new Xml(file_pointer, file_size);
      if (x->IsValid()) {
        VerbosePrint("XML detected.");
        return x;
      }
      delete x;
    }
  }

  VerbosePrint("Format not supported!");
  // for unsupported format, just memmove it.
  return new Format(file_pointer, file_size);
}
开发者ID:miniers,项目名称:Leanify,代码行数:99,代码来源:leanify.cpp


示例4: switch

void Patch::read(Xml& xml)
{
    typ = -1;
    hbank = -1;
    lbank = -1;
    prog = 0;
    drum = false;
    keys.clear();
    keyswitches.clear();
    for (;;)
    {
        Xml::Token token = xml.parse();
        const QString& tag = xml.s1();
        switch (token)
        {
        case Xml::Error:
        case Xml::End:
            return;
        case Xml::TagStart:
            xml.unknown("Patch");
            break;
        case Xml::Attribut:
            if (tag == "name")
                name = xml.s2();
            else if (tag == "mode")
                typ = xml.s2().toInt();
            else if (tag == "hbank")
                hbank = xml.s2().toInt();
            else if (tag == "lbank")
                lbank = xml.s2().toInt();
            else if (tag == "prog")
                prog = xml.s2().toInt();
            else if (tag == "drum")
                drum = xml.s2().toInt();
            else if(tag == "keys")
            {
                QStringList klist = ((QString)xml.s2()).split(QString(" "), QString::SkipEmptyParts);
                for (QStringList::Iterator it = klist.begin(); it != klist.end(); ++it)
                {
                    int val = (*it).toInt();
                    keys.append(val);
                }
            }
            else if(tag == "keyswitches")
            {
                QStringList klist = ((QString)xml.s2()).split(QString(" "), QString::SkipEmptyParts);
                for (QStringList::Iterator it = klist.begin(); it != klist.end(); ++it)
                {
                    int val = (*it).toInt();
                    keyswitches.append(val);
                }
            }
            break;
        case Xml::TagEnd:
            if (tag == "Patch")
                return;
        default:
            break;
        }
    }
}
开发者ID:faesong,项目名称:oom,代码行数:61,代码来源:minstrument.cpp


示例5: createFromXml

void MindGlobalCircuitRegionDef::createFromXml( Xml xml ) {
	id = xml.getAttribute( "id" );
	role = xml.getAttribute( "role" );
}
开发者ID:sarbjit-longia,项目名称:ahuman,代码行数:4,代码来源:mindglobalcircuitregiondef.cpp


示例6: switch

void CtrlList::read(Xml& xml)
{
	QLocale loc = QLocale::c();
	bool ok;
	for (;;)
	{
		Xml::Token token = xml.parse();
		const QString& tag = xml.s1();
		switch (token)
		{
			case Xml::Error:
			case Xml::End:
				return;
			case Xml::Attribut:
				if (tag == "id")
				{
					//_id = xml.s2().toInt();
					_id = loc.toInt(xml.s2(), &ok);
					if (!ok)
					{
						printf("CtrlList::read failed reading _id string: %s\n", xml.s2().toLatin1().constData());
						initColor(0); //Set the default color if we have an error
					}
					else {
						initColor(_id);
					}
				}
				else if (tag == "cur")
				{
					//_curVal = xml.s2().toDouble();
					_curVal = loc.toDouble(xml.s2(), &ok);
					if (!ok)
						printf("CtrlList::read failed reading _curVal string: %s\n", xml.s2().toLatin1().constData());
				}
				else if(tag == "visible")
				{
					_visible = (bool)xml.s2().toInt();
				}
				else if(tag == "color")
				{
					;//xml.skip(tag);
				}
				else
					printf("unknown tag %s\n", tag.toLatin1().constData());
				break;
			case Xml::Text:
			{
				// Changed by Tim. Users in some locales reported corrupt reading,
				//  because of the way floating point is represented (2,3456 not 2.3456).
				/*
				QByteArray ba = tag.toLatin1();
				const char* s = ba;.constData();
				int frame;
				double val;

				for (;;) {
					  char* endp;
					  while (*s == ' ' || *s == '\n')
							++s;
					  if (*s == 0)
							break;
					  frame = strtol(s, &endp, 10);
					  s     = endp;
					  while (*s == ' ' || *s == '\n')
							++s;
					  val = strtod(s, &endp);
					  add(frame, val);
					  s = endp;
					  ++s;
					  }
				 */

				// Added by Tim. p3.3.6
				//printf("CtrlList::read tag:%s\n", tag.toLatin1().constData());

				int len = tag.length();
				int frame;
				double val;

				int i = 0;
				for (;;)
				{
					while (i < len && (tag[i] == ',' || tag[i] == ' ' || tag[i] == '\n'))
						++i;
					if (i == len)
						break;

					QString fs;
					while (i < len && tag[i] != ' ')
					{
						fs.append(tag[i]);
						++i;
					}
					if (i == len)
						break;

					// Works OK, but only because if current locale fails it falls back on 'C' locale.
					// So, let's skip the fallback and force use of 'C' locale.
					//frame = fs.toInt(&ok);
					frame = loc.toInt(fs, &ok);
//.........这里部分代码省略.........
开发者ID:faesong,项目名称:oom,代码行数:101,代码来源:ctrl.cpp


示例7: writeProperties

void TextLine::writeProperties(Xml& xml, const TextLine* proto) const
      {
      if (_beginHook) {
            if (proto == 0 || proto->beginHookHeight() != _beginHookHeight)
                  xml.tag("beginHookHeight", _beginHookHeight.val());
            if (proto == 0 || proto->beginHookType() != _beginHookType)
                  xml.tag("beginHookType", int(_beginHookType));
            }
      if (_endHook) {
            if (proto == 0 || proto->endHookHeight() != _endHookHeight)
                  xml.tag("endHookHeight", _endHookHeight.val());
            if (proto == 0 || proto->endHookType() != _endHookType)
                  xml.tag("endHookType", int(_endHookType));
            }

      if (proto == 0 || proto->lineWidth() != _lineWidth)
            xml.tag("lineWidth", _lineWidth.val());
      if (proto == 0 || proto->lineStyle() != _lineStyle)
            xml.tag("lineStyle", _lineStyle);
      if (proto == 0 || proto->lineColor() != _lineColor)
            xml.tag("lineColor", _lineColor);
      if (proto == 0 || proto->beginTextPlace() != _beginTextPlace)
            xml.pTag("beginTextPlace", _beginTextPlace);
      if (proto == 0 || proto->continueTextPlace() != _continueTextPlace)
            xml.pTag("continueTextPlace", _continueTextPlace);

      SLine::writeProperties(xml);
      if (_beginText) {
            xml.stag("beginText");
            _beginText->writeProperties(xml);
            xml.etag();
            }
      if (_continueText) {
            xml.stag("continueText");
            _continueText->writeProperties(xml);
            xml.etag();
            }
      if (_beginSymbol != -1) {
            xml.tag("beginSymbol", Sym::id2name(_beginSymbol));
            xml.tag("beginSymbolOffset", _beginSymbolOffset);
            }
      if (_continueSymbol != -1) {
            xml.tag("continueSymbol", Sym::id2name(_continueSymbol));
            xml.tag("continueSymbolOffset", _continueSymbolOffset);
            }
      if (_endSymbol != -1) {
            xml.tag("endSymbol", Sym::id2name(_endSymbol));
            xml.tag("endSymbolOffset", _endSymbolOffset);
            }
      }
开发者ID:Isenbarth,项目名称:MuseScore,代码行数:50,代码来源:textline.cpp


示例8: fileOpen

void LOS::importPartToTrack(QString& filename, unsigned tick, Track* track)
{
    bool popenFlag = false;
    FILE* fp = fileOpen(this, filename, ".mpt", "r", popenFlag, false, false);

    if (fp)
    {
        Xml xml = Xml(fp);
        bool firstPart = true;
        int posOffset = 0;
        int notDone = 0;
        int done = 0;

        bool end = false;
        song->startUndo();
        for (;;)
        {
            Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token)
            {
                case Xml::Error:
                case Xml::End:
                    end = true;
                    break;
                case Xml::TagStart:
                    if (tag == "part")
                    {

                        // Read the part.
                        Part* p = 0;
                        p = readXmlPart(xml, track);
                        // If it could not be created...
                        if (!p)
                        {
                            // Increment the number of parts not done and break.
                            ++notDone;
                            break;
                        }

                        // Increment the number of parts done.
                        ++done;

                        if (firstPart)
                        {
                            firstPart = false;
                            posOffset = tick - p->tick();
                        }
                        p->setTick(p->tick() + posOffset);
                        p->setColorIndex(track->getDefaultPartColor());
                        audio->msgAddPart(p, false);
                    }
                    else
                        xml.unknown("LOS::importPartToTrack");
                    break;
                case Xml::TagEnd:
                    break;
                default:
                    end = true;
                    break;
            }
            if (end)
                break;
        }
        fclose(fp);
        song->endUndo(SC_PART_INSERTED);

        if (notDone)
        {
            int tot = notDone + done;
            QMessageBox::critical(this, QString("LOS"),
                    QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) +
                    (tot > 1 ? tr(" parts") : tr(" part")) +
                    tr(" could not be imported.\nLikely the track is the wrong type."));
        }

        return;
    }
}
开发者ID:Adamiko,项目名称:los,代码行数:79,代码来源:importmidi.cpp


示例9: write

void NoteDot::write(Xml& xml) const
      {
      xml.stag(name());
      Element::writeProperties(xml);
      xml.etag();
      }
开发者ID:Archer90,项目名称:MuseScore,代码行数:6,代码来源:notedot.cpp


示例10: write

void TextLine::write(Xml& xml) const
      {
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(id()));
      writeProperties(xml);
      xml.etag();
      }
开发者ID:Isenbarth,项目名称:MuseScore,代码行数:6,代码来源:textline.cpp


示例11: write

void StaffTypeTablature::write(Xml& xml, int idx) const
      {
      xml.stag(QString("StaffType idx=\"%1\" group=\"%2\"").arg(idx).arg(groupName()));
      StaffType::writeProperties(xml);
      xml.tag("durations",        _genDurations);
      xml.tag("durationFontName", _durationFontName);
      xml.tag("durationFontSize", _durationFontSize);
      xml.tag("durationFontY",    _durationFontUserY);
      xml.tag("fretFontName",     _fretFontName);
      xml.tag("fretFontSize",     _fretFontSize);
      xml.tag("fretFontY",        _fretFontUserY);
      xml.tag("linesThrough",     _linesThrough);
      xml.tag("onLines",          _onLines);
      xml.tag("timesig",          _genTimesig);
      xml.tag("upsideDown",       _upsideDown);
      xml.tag("useNumbers",       _useNumbers);
      xml.etag();
      }
开发者ID:Archer90,项目名称:MuseScore,代码行数:18,代码来源:stafftype.cpp


示例12: write

void Audio::write(Xml& xml) const
{
    xml.stag("Audio");
    xml.tag("path", _path);
    xml.etag();
}
开发者ID:musescore,项目名称:musescore-old,代码行数:6,代码来源:audio.cpp


示例13: log

void Blaster::gotDoc4 ( void *state, TcpSocket *s){
	StateBD *st=(StateBD *)state;
	st->m_numUrlDocsReceived++;
	if (!s) {
		//Shouldn't happen, but still putting a checkpoint
		log (LOG_WARN,"blaster: Got a null s in gotDoc4."
		     "Happened because ip could not be found for gigablast"
		     "server");
		if (st->m_numUrlDocsReceived==st->m_numUrlDocsSent){
			m_launched--;
			// Free stateBD
			freeStateBD(st);
		}
		return;
	}
	// bail if got cut off
	if ( s->m_readOffset == 0 ) {
		log("blasterDiff : lost the Request in gotDoc4");
		if (st->m_numUrlDocsReceived==st->m_numUrlDocsSent){
			m_launched--;
			freeStateBD(st);
		}
		return;
	}
	char *reply = s->m_readBuf ;
	int32_t  size  = s->m_readOffset;
	HttpMime mime;
	mime.set ( reply , size , NULL );
	char *content    = reply + mime.getMimeLen();
	int32_t  contentLen = size  - mime.getMimeLen();

	//int16_t csEnum = get_iana_charset(mime.getCharset(), 
	//				mime.getCharsetLen());
	/*	if (csEnum == csUnknown)
		log(LOG_DEBUG, "blaster: Unknown charset : %s", mime.getCharset());*/
	
	Xml xml;
	if (!xml.set(
		     content, 
		     contentLen,
		     false,
		     0,
		     false,
		     TITLEREC_CURRENT_VERSION,
		     true, // setparents
		     0, // niceness
		     CT_XML )){
		log(LOG_WARN,"blaster: Couldn't set XML Class in gotDoc4");
	}
	Links links;
	Url *url=mime.getLocationUrl();
	if (!links.set(0,//siterec xml
		       &xml,
		       url,
		       false,
		       NULL,
		       TITLEREC_CURRENT_VERSION,
		       0,
		       false,
		       NULL)){
		log(LOG_WARN, "blaster: Coudn't set Links class in gotDoc4");
	}
	for (int32_t i=0;i<links.getNumLinks();i++){
		char *ss=links.getLink(i);
		char *p;
		// This page *should* always be a gigablast page. So not adding
		// checks for msn or yahoo or google page.
		p=strstr(ss,"google.");
		if(p) continue;
		p=strstr(ss,"cache:");  //googles cache page
		if(p) continue;
		p= strstr(ss,"gigablast.");
		if(p) continue;
		p= strstr(ss,"web.archive.org");//older copies on gigablast
		if(p) continue;
		p= strstr(ss,"search.yahoo.com");//from gigablast search
		if(p) continue;
		p= strstr(ss,"search.msn.com");//from gigablast search
		if(p) continue;
		p= strstr(ss,"s.teoma.com");//from gigablast search
		if(p) continue;
		p= strstr(ss,"search.dmoz.org");//from gigablast search
		if(p) continue;
		p= strstr(ss,"www.answers.com");//from gigablast search
		if(p) continue;
       		if (m_verbose)
			log(LOG_WARN,"blaster: Link Present on server2=%s",ss);
	}
	
	// So if one of the links that is returned is the exact url,
	// then we know that the url is present.So get the url from the
	// mime, search for it in the links that are returned.
	char tmp[1024];
	char *sendBuf=s->m_sendBuf;
	char *p1,*p2;

	// First get the Host, which is the domain. Since socket s is going to
	// be useless after this function, changing m_sendBuf instead of using 
	// more space
	p1=strstr(sendBuf,"%3A");
//.........这里部分代码省略.........
开发者ID:DeadNumbers,项目名称:open-source-search-engine,代码行数:101,代码来源:Blaster.cpp


示例14: write

void PageFormat::write(Xml& 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:MatthewStein,项目名称:MuseScore,代码行数:33,代码来源:page.cpp


示例15: writeProperties

void DurationElement::writeProperties(Xml& xml) const
      {
      Element::writeProperties(xml);
      if (tuplet())
            xml.tag("Tuplet", tuplet()->id());
      }
开发者ID:AdrianShe,项目名称:MuseScore,代码行数:6,代码来源:duration.cpp


示例16: write

void StaffType::write(Xml& xml) const
      {
      xml.stag(QString("StaffType group=\"%1\"").arg(fileGroupNames[(int)_group]));
      if (!_xmlName.isEmpty())
            xml.tag("name", _xmlName);
      if (_lines != 5)
            xml.tag("lines", _lines);
      if (_lineDistance.val() != 1.0)
            xml.tag("lineDistance", _lineDistance.val());
      if (!_genClef)
            xml.tag("clef", _genClef);
      if (_slashStyle)
            xml.tag("slashStyle", _slashStyle);
      if (!_showBarlines)
            xml.tag("barlines", _showBarlines);
      if (!_genTimesig)
            xml.tag("timesig", _genTimesig);
      if (_group == StaffGroup::STANDARD || _group == StaffGroup::PERCUSSION) {
            if (!_genKeysig)
                  xml.tag("keysig", _genKeysig);
            if (!_showLedgerLines)
                  xml.tag("ledgerlines", _showLedgerLines);
            }
      else {
            xml.tag("durations",        _genDurations);
            xml.tag("durationFontName", _durationFonts[_durationFontIdx].displayName);
            xml.tag("durationFontSize", _durationFontSize);
            xml.tag("durationFontY",    _durationFontUserY);
            xml.tag("fretFontName",     _fretFonts[_fretFontIdx].displayName);
            xml.tag("fretFontSize",     _fretFontSize);
            xml.tag("fretFontY",        _fretFontUserY);
            if (_symRepeat != TablatureSymbolRepeat::NEVER)
                  xml.tag("symbolRepeat",     int(_symRepeat));
            xml.tag("linesThrough",     _linesThrough);
            xml.tag("minimStyle",       int(_minimStyle));
            xml.tag("onLines",          _onLines);
            xml.tag("showRests",        _showRests);
            xml.tag("stemsDown",        _stemsDown);
            xml.tag("stemsThrough",     _stemsThrough);
            xml.tag("upsideDown",       _upsideDown);
            xml.tag("useNumbers",       _useNumbers);
            }
      xml.etag();
      }
开发者ID:flelax,项目名称:MuseScore,代码行数:44,代码来源:stafftype.cpp


示例17: readProperties

bool AudioTrack::readProperties(Xml& xml, const QString& tag)
{
    if (tag == "LadspaPlugin" || tag == "plugin")
    {
         BasePlugin* pi = new LadspaPlugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "Lv2Plugin")
    {
         Lv2Plugin* pi = new Lv2Plugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "VstPlugin")
    {
         VstPlugin* pi = new VstPlugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "auxSend")
        readAuxSend(xml);
    else if (tag == "prefader")
        _prefader = xml.parseInt();
    else if (tag == "sendMetronome")
        _sendMetronome = xml.parseInt();
    else if (tag == "automation")
        setAutomationType(AutomationType(xml.parseInt()));
    else if (tag == "controller")
    {
        CtrlList* l = new CtrlList();
        l->read(xml);

        // Since (until now) oom wrote a 'zero' for plugin controller current value
        //  in the XML file, we can't use that value, now that plugin automation is added.
        // We must take the value from the plugin control value.
        // Otherwise we break all existing .oom files with plugins, because the gui
        //  controls would all be set to zero.
        // But we will allow for the (unintended, useless) possibility of a controller
        //  with no matching plugin control.
        BasePlugin* p = 0;
        bool ctlfound = false;
        int m = l->id() & AC_PLUGIN_CTL_ID_MASK;
        int n = (l->id() >> AC_PLUGIN_CTL_BASE_POW) - 1;
		int pdepth = _efxPipe->size();
        if (n >= 0 && n < pdepth)
        {
            p = (*_efxPipe)[n];
            if (p)
            {
                ParameterPort* cport = p->getParameterPort(m);
                if (cport && cport->type == PARAMETER_INPUT && (cport->hints & PARAMETER_IS_AUTOMABLE) > 0)
                    ctlfound = true;
            }
        }

        iCtrlList icl = _controller.find(l->id());
        if (icl == _controller.end())
            _controller.add(l);
        else
        {
            CtrlList* d = icl->second;
            for (iCtrl i = l->begin(); i != l->end(); ++i)
                d->add(i->second.getFrame(), i->second.val);

            if (!ctlfound)
                d->setCurVal(l->curVal());
            d->setColor(l->color());
            d->setVisible(l->isVisible());

            d->setDefault(l->getDefault());
            delete l;
            l = d;
        }

        if (ctlfound)
        {
            l->setCurVal(p->getParameterValue(m));
            ParameterPort* cport = p->getParameterPort(m);
            if (cport && cport->hints & PARAMETER_IS_TOGGLED)
                l->setMode(CtrlList::DISCRETE);
            else
                l->setMode(CtrlList::INTERPOLATE);
        }
    }
开发者ID:87maxi,项目名称:oom,代码行数:97,代码来源:audiotrack.cpp


示例18: write

void Text::write(Xml& xml) const
      {
      xml.stag(name());
      writeProperties(xml, true);
      xml.etag();
      }
开发者ID:fivearrows,项目名称:MuseScore,代码行数:6,代码来源:text.cpp


示例19: write

void Rest::write(Xml& xml) const
      {
      xml.stag(name());
      ChordRest::writeProperties(xml);
      xml.etag();
      }
开发者ID:musescore,项目名称:musescore-old,代码行数:6,代码来源:rest.cpp


示例20: writeConfiguration

void MasterEdit::writeConfiguration(int level, Xml& xml)
{
	xml.tag(level++, "masteredit");
	xml.intTag(level, "raster", _rasterInit);
	xml.tag(level, "/masteredit");
}
开发者ID:faesong,项目名称:oom,代码行数:6,代码来源:masteredit.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XmlAttribute类代码示例发布时间:2022-05-31
下一篇:
C++ XercesDOMParser类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap