本文整理汇总了C++中Sxmlelement::push方法的典型用法代码示例。如果您正苦于以下问题:C++ Sxmlelement::push方法的具体用法?C++ Sxmlelement::push怎么用?C++ Sxmlelement::push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sxmlelement
的用法示例。
在下文中一共展示了Sxmlelement::push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newrest
//------------------------------------------------------------------------
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;
}
示例2: 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;
}
示例3: 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;
}
示例4: newmeasure
//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newmeasure (int number, const char* time, const char* clef, int line, int key, int division) const
{
Sxmlelement m = newmeasure (number);
Sxmlelement attributes = getAttributes (m);
if (division) attributes->push (element(k_divisions, division));
if (time) {
int beat, beatType;
int n = sscanf (time, "%d/%d", &beat, &beatType);
if (n == 2) {
Sxmlelement t = element (k_time);
t->push (element(k_beats, beat));
t->push (element(k_beat_type, beatType));
attributes->push (t);
}
}
if (clef) {
Sxmlelement c = element (k_clef);
c->push (element (k_sign, clef));
if (line) c->push (element (k_line, line));
attributes->push (c);
}
if (key) {
Sxmlelement k = element (k_key);
k->push (element (k_fifths, key));
attributes->push (k);
}
return m;
}
示例5: encoding
//------------------------------------------------------------------------
void musicxmlfactory::encoding(const char* software)
{
Sxmlelement encoding = element (k_encoding);
if (software) encoding->push (element(k_software, software));
string lib = "MusicXML Library version ";
lib += musicxmllibVersionStr();
encoding->push (element(k_software, lib.c_str()));
encoding->push (element (k_encoding_date, timestring()));
fIdentification->push (encoding);
}
示例6: header
//------------------------------------------------------------------------
void musicxmlfactory::header (const char* worknumber, const char* worktitle, const char* movementnumber, const char* movementtitle)
{
if (worknumber || worktitle) {
Sxmlelement work = element(k_work);
if (worknumber) work->push (element(k_work_number, worknumber));
if (worktitle) work->push (element(k_work_title, worktitle));
fRoot->push (work);
}
if (movementnumber) fRoot->push (element(k_movement_number, movementnumber));
if (movementtitle) fRoot->push (element(k_movement_title, movementtitle));
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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);
}
示例12: 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;
}
示例13: 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);
}
示例14: 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);
}
示例15: newnote
//------------------------------------------------------------------------
Sxmlelement musicxmlfactory::newnote (const char* step, float alter, int octave, int duration, const char* type)
{
Sxmlelement elt = element(k_note);
Sxmlelement pitch = element(k_pitch);
pitch->push (element (k_step, step));
if (alter) pitch->push (element (k_alter, alter));
pitch->push (element (k_octave, octave));
elt->push(pitch);
if (duration) elt->push(element(k_duration, duration));
if (type) elt->push(element(k_type, type));
return elt;
}