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


C++ Sxmlelement::add方法代码示例

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


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

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

示例2: newbarline

//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newbarline (const char* location, const char* barstyle, const char *repeat)
{
	Sxmlelement barline = element (k_barline);
	if (location)
		barline->add (attribute( "location", location));
	if (barstyle)
		barline->push (element(k_bar_style, barstyle));
	if (repeat) {
		Sxmlelement repeatelt = (element(k_repeat));
		repeatelt->add (attribute( "direction", repeat));
		barline->push (repeatelt);
	}
	return barline;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:15,代码来源:musicxmlfactory.cpp

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

示例4: tie

//------------------------------------------------------------------------
void musicxmlfactory::tie (Sxmlelement start, Sxmlelement stop)
{
	Sxmlelement tieStart = element (k_tie);
	tieStart->add (attribute ("type", "start"));
	start->push (tieStart);
	Sxmlelement tiedStart = element (k_tied);
	tiedStart->add (attribute ("type", "start"));
	addnotation (start, tiedStart);
	
	Sxmlelement tieStop = element (k_tie);
	tieStop->add (attribute ("type", "stop"));
	stop->push (tieStop);
	Sxmlelement tiedStop = element (k_tied);
	tiedStop->add (attribute ("type", "stop"));
	addnotation (stop, tiedStop);
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:17,代码来源:musicxmlfactory.cpp

示例5: element

//------------------------------------------------------------------------
Sxmlelement	musicxmlfactory::scorepart (const char* id, const char* name, const char* abbrev)
{
	Sxmlelement part = element(k_score_part);
	part->add (attribute("id", id));
	if (name)			part->push (element(k_part_name, name));
	if (abbrev)			part->push (element(k_part_abbreviation, abbrev));
	return part;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:9,代码来源:musicxmlfactory.cpp

示例6: newdynamics

//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newdynamics (int type, const char* placement)
{
	Sxmlelement dynamics = element (k_dynamics);
	if (placement)
		dynamics->add (attribute( "placement", placement));
	dynamics->push (element(type));
	return dynamics;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:9,代码来源:musicxmlfactory.cpp

示例7: addgroup

//------------------------------------------------------------------------
void musicxmlfactory::addgroup (int number, const char* name, const char* abbrev, bool groupbarline, vector<Sxmlelement>& parts)
{
	Sxmlelement groupStart = element(k_part_group);
	groupStart->add (attribute ("number", number));
	groupStart->add (attribute ("type", "start"));
	if (name)			groupStart->push (element(k_group_name, name));
	if (abbrev)			groupStart->push (element(k_group_abbreviation, abbrev));
	if (groupbarline)	groupStart->push (element(k_group_barline, "yes"));
	fPartList->push (groupStart);

	for (vector<Sxmlelement>::const_iterator i = parts.begin(); i != parts.end(); i++)
		addpart(*i);

	Sxmlelement groupStop = element(k_part_group);
	groupStop->add (attribute ("number", number));
	groupStop->add (attribute ("type", "stop"));
	fPartList->push (groupStop);	
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:19,代码来源:musicxmlfactory.cpp

示例8: maketuplet

//------------------------------------------------------------------------
void musicxmlfactory::maketuplet(int actual, int normal, const std::vector<Sxmlelement>& notes)
{
	if (notes.empty()) return;
	Sxmlelement timemod = element(k_time_modification);
	timemod->push (element (k_actual_notes, actual));
	timemod->push (element (k_normal_notes, normal));
	for (unsigned int i=0; i < notes.size(); i++)
		notes[i]->push(timemod);
	Sxmlelement notations = getNotations (notes[0]);
	Sxmlelement tuplet = element (k_tuplet);
	tuplet->add (attribute ("type", "start"));
	notations->push (tuplet);

	notations = getNotations (notes[notes.size()-1]);
	tuplet = element (k_tuplet);
	tuplet->add (attribute ("type", "stop"));
	notations->push (tuplet);
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:19,代码来源:musicxmlfactory.cpp

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

示例10: makemeasure

//------------------------------------------------------------------------
// creates a measure containing random notes
// the function takes the measure number as an argument
//------------------------------------------------------------------------
static Sxmlelement makemeasure(unsigned long num) {
	Sxmlelement measure = factory::instance().create(k_measure);
	measure->add (newAttributeI("number", num));
	if (num==1) {					//  creates specific elements of the first measure
		measure->push(makeAttributes());		// division, time, clef...
	}
	for (int i = 0; i < 4; i++) {		// next adds 4 quarter notes
		Sxmlelement note = factory::instance().create(k_note);		// creates the note
		Sxmlelement pitch = factory::instance().create(k_pitch);	// creates a pitch
		pitch->push (newElement(k_step, randomNote()));				// sets the pitch to a random value
		pitch->push (newElementI(k_octave, 4 + getrandom(2)));		// sets the octave to a random value
		note->push (pitch);											// adds the pitch to the note
		note->push (newElementI(k_duration, kDivision));				// sets the note duration to a quarter note
		note->push (newElement(k_type, "quarter"));					// creates the graphic elements of the note
		measure->push (note);		// and finally adds the note to the measure
	}
	return measure;
}
开发者ID:02191998,项目名称:libmusicxml,代码行数:22,代码来源:RandomMusic.cpp

示例11: rights

//------------------------------------------------------------------------
void musicxmlfactory::rights (const char* c, const char* type)
{
	Sxmlelement rights = element(k_rights, c);
	if (type) rights->add (attribute("type", type));
	fIdentification->push (rights);
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:7,代码来源:musicxmlfactory.cpp

示例12: creator

//------------------------------------------------------------------------
void musicxmlfactory::creator (const char* c, const char* type)
{
	Sxmlelement creator = element(k_creator, c);
	if (type) creator->add (attribute("type", type));
	fIdentification->push (creator);
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:7,代码来源:musicxmlfactory.cpp

示例13: newmeasure

//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newmeasure(int number) const
{
	Sxmlelement measure = element (k_measure);
	measure->add (attribute ("number", number));
	return measure;
}
开发者ID:k4rm,项目名称:AscoGraph,代码行数:7,代码来源:musicxmlfactory.cpp


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