本文整理汇总了C++中BarLine::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ BarLine::addAttribute方法的具体用法?C++ BarLine::addAttribute怎么用?C++ BarLine::addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarLine
的用法示例。
在下文中一共展示了BarLine::addAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: staffnum
Staff* CScribeToNeoScribeXML::Scribe2MEIXMLStaff(const CScribeReaderVisitable& scribe_data, const scribe_part& partit, StaffGrp* staffgrp, const int i)
{
std::string staffnum("s");
staffnum += std::to_string(i); //autogenerate staff ids
//finish score definitions
//add staff definition for current part
//NB. look to alternatively embedding these in staffs
StaffDef* staffdef = new StaffDef;
//define staff from data
staffgrp->addChild(staffdef);
staffdef->addAttribute("id", staffnum);
staffdef->addAttribute("lines", std::to_string(partit.initial_staff_data.staff_lines));
staffdef->addAttribute("label", CScribeCodes::voice_labels[partit.voice_type].c_str());
//define clef from data
Clef* clef = new Clef;
staffdef->addChild(clef);
scribe_clef loc_clef;
loc_clef.clef_line = partit.initial_staff_data.clef_line;
loc_clef.clef = partit.initial_staff_data.clef;
//convert scribe-based clef position to mei
//int mei_clef_line = ((loc_clef.clef_line + 1)/2) - 1; = incorrect
int mei_clef_line = 1 + (loc_clef.clef_line-3)/2;
//4-line staves are numbered 3, 5, 7, 9 in scribe
//if (partit->staff_lines<=4) mei_clef_line -= (5 - partit->staff_lines);
clef->addAttribute("line", std::to_string(mei_clef_line)); //these need to be set for each staff/part
clef->addAttribute("shape", std::string(&(partit.initial_staff_data.clef),1).c_str()); //the first event in stored memory should be the initial clef
Staff* staff = new Staff;
staff->addAttribute("id", staffnum);
staff->addAttribute("source", partit.abbrev_ms);
//folio on which part appears
Pb* pb = new Pb; //new ELEMENT?
staff->addChild(pb);
pb->addAttribute("n", partit.folios);
//first staff on which part appears
Sb* sb = new Sb;
sb->addAttribute("n", "0"); //set to "0" since this isn't encoded in scribe; data will need to be enhanced later
staff->addChild(sb);
coloration_type current_color = coloration_type::full_black; // this needs to be better handled with a default coloration in a part
for (std::vector<scribe_row>::const_iterator rowit = partit.rows.begin(); rowit!=partit.rows.end(); rowit++)
{
if (rowit->is_comment) {
//check it this is the correct way to handle a comment
MeiCommentNode* comment = new MeiCommentNode;
comment->setValue(rowit->comment);
staff->addChild(comment);
//NB. syl can have a type (eg. initial) attribute and also encode color as <rend> child element
} else {
//syllable container (holds syllables, notes, neumes, and ligatures)
Syllable* syllable = new Syllable; //neumes.h
staff->addChild(syllable);
//add actual syllable if present
if (!rowit->syllable.empty()) {
Syl* syl = new Syl;
syl->setValue(rowit->syllable);
syllable->addChild(syl);
}
//extract events - notes, rests ligatures, uneumes and/or ligatures
for (std::vector<scribe_event>::const_iterator eventit = rowit->events.begin(); eventit!=rowit->events.end(); eventit++ )
{
current_color = eventit->local_coloration;
//use temp TiXML pointer which is either syllable, uneume/ineume or ligature - add notes to this, but make sure that uneume/inueme/ligature pointer is preinserted into syllable
//handle events for each row
code_t event_type = scribe_data.GetCodes()->get_code_type(eventit->code);//codes->get_code_type(eventit->code);
//foster parent will change roles according to child elements that need to be added
MeiElement* foster = syllable;
switch (event_type)
{
case code_t::ineume:
{
#ifdef IGNOREGAPS
Ineume* ineume = new Ineume;
//ineume->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(ineume);
foster = ineume;
#else //this needs work, hence excluded
if (!eventit->preceding_gap || foster->getChildren().empty())
{
Ineume* ineume = new Ineume;
//ineume->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(ineume);
foster = ineume;
}
//.........这里部分代码省略.........