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


C++ Sxmlelement类代码示例

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


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

示例1: debug

//_______________________________________________________________________________
bool xmlreader::endElement (const char* eltName)
{
	debug("endElement", eltName);
	Sxmlelement top = fStack.top();
	fStack.pop();
	return top->getName() == eltName;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:8,代码来源:xmlreader.cpp

示例2: makePart

//------------------------------------------------------------------------
// creates a part containing 'count' measures
//------------------------------------------------------------------------
Sxmlelement makePart(int count) {
	Sxmlelement part = factory::instance().create(k_part);
	part->add (newAttribute("id", kPartID));
	for (int i=1; i<=count; i++)			// and 'count' times
		part->push (makemeasure(i));			// adds a new measure to the part
	return part;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:10,代码来源:RandomMusic.cpp

示例3: element

//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newrest (int duration, const char* type)
{
	Sxmlelement elt = element(k_note);
	if (duration) elt->push(element(k_duration, duration));
	if (type) elt->push(element(k_type, type));
	return elt;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:8,代码来源:musicxmlfactory.cpp

示例4: randomMusic

//------------------------------------------------------------------------
// the function that creates and writes the score
//------------------------------------------------------------------------
static Sxmlelement randomMusic(int measuresCount) {
	Sxmlelement score = factory::instance().create(k_score_partwise);
	score->push (newElement(k_movement_title, "Random Music"));
	score->push (makeIdentification());
	score->push (makePartList());
	score->push(makePart(measuresCount));			// adds a part to the score
	return score;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:11,代码来源:RandomMusic.cpp

示例5: visitStart

void unrolled_xml_tree_browser::visitStart( Sxmlelement& elt)
{
	bool forward = fForward;
	if (forward) enter(*elt);
	ctree<xmlelement>::literator iter;
	for (iter = elt->lbegin(); iter != elt->lend(); iter++)
		browse(**iter);
	if (forward) leave(*elt);
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:9,代码来源:unrolled_xml_tree_browser.cpp

示例6: addpart

//------------------------------------------------------------------------
void musicxmlfactory::addpart (const Sxmlelement& part)	
{ 
	switch (part->getType()) {
		case k_score_part:
			fPartList->push(part);
			break;
		case k_part:
			fRoot->push(part);
			break;
		default:
			cerr << "musicxmlfactory::addpart unexpected type " <<  part->getType() << endl;
	}
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:14,代码来源:musicxmlfactory.cpp

示例7: makePartList

//------------------------------------------------------------------------
// creates the part list element
//------------------------------------------------------------------------
static Sxmlelement makePartList() {
	Sxmlelement partlist = factory::instance().create(k_part_list);
	Sxmlelement scorepart = factory::instance().create(k_score_part);
	scorepart->add (newAttribute("id", kPartID));
	scorepart->push (newElement(k_part_name, "Part name"));
	Sxmlelement scoreinstr = factory::instance().create(k_score_instrument);
	scoreinstr->add (newAttribute("id", "I1"));
	scoreinstr->push (newElement(k_instrument_name, "Any instr."));
	scorepart->push (scoreinstr);
	partlist->push(scorepart);
	return partlist;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:15,代码来源:RandomMusic.cpp

示例8: convertion

//______________________________________________________________________________
void xml2guidovisitor::addPosition	( Sxmlelement elt, Sguidoelement& tag, int yoffset)
{
	float posx = elt->getAttributeFloatValue("default-x", 0) + elt->getAttributeFloatValue("relative-x", 0);
	if (posx) {
		posx = (posx / 10) * 2;   // convert to half spaces
		stringstream s;
		s << "dx=" << posx << "hs";
		tag->add (guidoparam::create(s.str(), false));
	}
	float posy = elt->getAttributeFloatValue("default-y", 0) + elt->getAttributeFloatValue("relative-y", 0);
	if (posy) {
		posy = (posy / 10) * 2;   // convert to half spaces
		posy += yoffset;		  // anchor point convertion (defaults to upper line in xml)
		stringstream s;
		s << "dy=" << posy << "hs";
		tag->add (guidoparam::create(s.str(), false));
	}
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:19,代码来源:xml2guidovisitor.cpp

示例9: test3

//_______________________________________________________________________________
static void test3(Sxmlelement elt)
{
	cerr << "test3: insert a note before the par notes" << endl;
	ctree<xmlelement>::iterator next, iter = elt->begin();
	int note=1;
	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		assert (xml);
		if (xml->getType() == k_note) {
			if (!(note & 1)) {
				Sxmlelement note = factory::instance().create(k_note);
				iter = elt->insert(iter, note);
				iter++;
			}
			note++;
		}
		iter++;
	}
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:20,代码来源:xmliter.cpp

示例10: makeAttributes

//------------------------------------------------------------------------
static Sxmlelement makeAttributes() {
	Sxmlelement attributes = factory::instance().create(k_attributes);
	attributes->push (newElementI(k_divisions, kDivision));

	Sxmlelement time = factory::instance().create(k_time);
	time->push (newElement(k_beats, "4"));
	time->push (newElement(k_beat_type, "4"));
	attributes->push (time);

	Sxmlelement clef = factory::instance().create(k_clef);
	clef->push (newElement(k_sign, "G"));
	clef->push (newElement(k_line, "2"));
	attributes->push (clef);
	
	return attributes;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:17,代码来源:RandomMusic.cpp

示例11: makeIdentification

//------------------------------------------------------------------------
// creates the identification element
//------------------------------------------------------------------------
static Sxmlelement makeIdentification() {
	Sxmlelement id = factory::instance().create(k_identification);
	Sxmlelement encoding = factory::instance().create(k_encoding);

	Sxmlelement creator = newElement(k_creator, "Georg Chance");
	creator->add(newAttribute("type", "Composer"));
	id->push (creator);
	
	encoding->push (newElement(k_software, "MusicXML Library v2"));
	id->push (encoding);
	return id;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:15,代码来源:RandomMusic.cpp

示例12: test1

//_______________________________________________________________________________
static void test1(Sxmlelement elt)
{
	cerr << "test1: iterate thru the tree" << endl;
	ctree<xmlelement>::iterator iter = elt->begin();
	cerr << "=> test1: iterate thru the tree" << endl;

	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		if (xml)
			cerr << "  element type " << xml->getType() 
				 << " - " << xml->getName()
				 << " - size: " << xml->size() << endl;
		else
			cerr << "iterate thru unknown element type " << endl;
		iter++;
	}

}
开发者ID:02191998,项目名称:libmusicxml,代码行数:19,代码来源:xmliter.cpp

示例13: test2

//_______________________________________________________________________________
static void test2(Sxmlelement elt)
{
	cerr << "test2: erasing all the par measures" << endl;
	ctree<xmlelement>::iterator next, iter = elt->begin();
	int measure=1;
	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		next = iter;
		next++;
		assert (xml);
		if (xml->getType() == k_software) {
				next = elt->erase(iter);			
		}
		else if (xml->getType() == k_measure) {
			if (!(measure & 1)) {
				next = elt->erase(iter);
			}
			measure++;
		}
		iter = next;
	}
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:23,代码来源:xmliter.cpp

示例14: __retainElt

//------------------------------------------------------------------------
static TElement		__retainElt  (Sxmlelement elt)		{ elt->addReference(); return (TElement)elt; }
开发者ID:02191998,项目名称:libmusicxml,代码行数:2,代码来源:libmusicxml.cpp

示例15: newElementI

//------------------------------------------------------------------------
static Sxmlelement newElementI(int type, int value)
{
	Sxmlelement elt = factory::instance().create(type);
	elt->setValue (value);
	return elt;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:7,代码来源:RandomMusic.cpp


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