本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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));
}
}
示例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++;
}
}
示例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;
}
示例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;
}
示例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++;
}
}
示例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;
}
}
示例14: __retainElt
//------------------------------------------------------------------------
static TElement __retainElt (Sxmlelement elt) { elt->addReference(); return (TElement)elt; }
示例15: newElementI
//------------------------------------------------------------------------
static Sxmlelement newElementI(int type, int value)
{
Sxmlelement elt = factory::instance().create(type);
elt->setValue (value);
return elt;
}